diff --git a/Documentation/Docs-MGM-Hurry.md b/Documentation/Docs-MGM-Hurry.md index 020e0b7..ee38f95 100644 --- a/Documentation/Docs-MGM-Hurry.md +++ b/Documentation/Docs-MGM-Hurry.md @@ -239,6 +239,10 @@ Export the `.fthypt` results to an easy to interpret/sort/filter `.csv` SpreadSh - **Defaults to:** The last known `.fthypt` file. Provide `True` to launch a prompt to easily choose a specific. `.fthypt` file. +### `mgm-hurry export_results` +Export the results that are selected. Creates a `.zip` archive of the various files created by HyperOpt runs after the user selects which HyperOpt run they would like to export. Archive is placed in `user_data/mgm_result_export`. + + ### `mgm-hurry hyperopt_show_epoch` Prints & applies the HyperOpt Results for an epoch of choice. #### Options diff --git a/Documentation/Docs-MoniGoMani.md b/Documentation/Docs-MoniGoMani.md index 3fde40b..292ed47 100644 --- a/Documentation/Docs-MoniGoMani.md +++ b/Documentation/Docs-MoniGoMani.md @@ -445,11 +445,12 @@ A different amount of buy and sell signals is possible, and the initial search s #### Defining Indicators Examples First add the technical analysis indicators you wish to use to MGM's `do_populate_indicators()` function. -Check out these **+200 Easy to implement Indicators** for toying with the Weighted Signal Interface: +Check out these **+300 Easy to implement Indicators** for toying with the Weighted Signal Interface: - [Freqtrade Technical](https://github.com/freqtrade/technical) - [TA-Lib](https://mrjbq7.github.io/ta-lib/funcs.html) - [Pandas-TA](https://twopirllc.github.io/pandas-ta) +- [FinTA](https://github.com/peerchemist/finta) - [Hacks for Life Blog](https://hacks-for-life.blogspot.com) But feel free to look for other means of implementing indicators too. diff --git a/Pipfile b/Pipfile index f16b0fe..56516a4 100644 --- a/Pipfile +++ b/Pipfile @@ -2,7 +2,7 @@ python_version = "3.9" [packages] -art = "==5.3" +art = "==5.4" cached-property = "==1.5.2" coloredlogs = "==15.0.1" cryptography = "==36.0.1" @@ -15,7 +15,7 @@ inquirerpy = "==0.3.1" logger = "==1.4" numpy = "==1.21.5" pandas = "==1.3.5" -plotly = "==5.4.0" +plotly = "==5.5.0" prompt-toolkit = "==3.0.24" pygit2 = "*" python-rapidjson = "==1.5" diff --git a/Pipfile.lock b/Pipfile.lock index 50f51d7..d8f34ef 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "4a3213fce24ceb13dfe62923c73cdd8eb15f9af41466e65f5af3a0da8aa19923" + "sha256": "c6d20b0770806e8af67905baa830485c7a28348ec9482bf7d1ba3a386f426b75" }, "pipfile-spec": 6, "requires": { @@ -18,10 +18,10 @@ "default": { "art": { "hashes": [ - "sha256:ba0e090ebb2ca58f016fc2d4c38e8fb3d964d068f558b1f223411771a4e1b485", - "sha256:da3d533fa0de602dc821d66d949d39fa6845d3c52f576003a4f4f09c0b9e73c5" + "sha256:50969b793501b706d8ac7dacacc74b80083d3550137bfe3f7388a2c20b35dc1c", + "sha256:b745544b09a7ae9747e6ef852f59c2316a9605e4d7f51ed806c294d00cfb7154" ], - "version": "==5.3" + "version": "==5.4" }, "cached-property": { "hashes": [ @@ -94,11 +94,11 @@ }, "charset-normalizer": { "hashes": [ - "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721", - "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c" + "sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd", + "sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455" ], "markers": "python_version >= '3'", - "version": "==2.0.9" + "version": "==2.0.10" }, "coloredlogs": { "hashes": [ @@ -421,57 +421,18 @@ }, "pillow": { "hashes": [ - "sha256:066f3999cb3b070a95c3652712cffa1a748cd02d60ad7b4e485c3748a04d9d76", - "sha256:0a0956fdc5defc34462bb1c765ee88d933239f9a94bc37d132004775241a7585", - "sha256:0b052a619a8bfcf26bd8b3f48f45283f9e977890263e4571f2393ed8898d331b", - "sha256:1394a6ad5abc838c5cd8a92c5a07535648cdf6d09e8e2d6df916dfa9ea86ead8", - "sha256:1bc723b434fbc4ab50bb68e11e93ce5fb69866ad621e3c2c9bdb0cd70e345f55", - "sha256:244cf3b97802c34c41905d22810846802a3329ddcb93ccc432870243211c79fc", - "sha256:25a49dc2e2f74e65efaa32b153527fc5ac98508d502fa46e74fa4fd678ed6645", - "sha256:2e4440b8f00f504ee4b53fe30f4e381aae30b0568193be305256b1462216feff", - "sha256:3862b7256046fcd950618ed22d1d60b842e3a40a48236a5498746f21189afbbc", - "sha256:3eb1ce5f65908556c2d8685a8f0a6e989d887ec4057326f6c22b24e8a172c66b", - "sha256:3f97cfb1e5a392d75dd8b9fd274d205404729923840ca94ca45a0af57e13dbe6", - "sha256:493cb4e415f44cd601fcec11c99836f707bb714ab03f5ed46ac25713baf0ff20", - "sha256:4acc0985ddf39d1bc969a9220b51d94ed51695d455c228d8ac29fcdb25810e6e", - "sha256:5503c86916d27c2e101b7f71c2ae2cddba01a2cf55b8395b0255fd33fa4d1f1a", - "sha256:5b7bb9de00197fb4261825c15551adf7605cf14a80badf1761d61e59da347779", - "sha256:5e9ac5f66616b87d4da618a20ab0a38324dbe88d8a39b55be8964eb520021e02", - "sha256:620582db2a85b2df5f8a82ddeb52116560d7e5e6b055095f04ad828d1b0baa39", - "sha256:62cc1afda735a8d109007164714e73771b499768b9bb5afcbbee9d0ff374b43f", - "sha256:70ad9e5c6cb9b8487280a02c0ad8a51581dcbbe8484ce058477692a27c151c0a", - "sha256:72b9e656e340447f827885b8d7a15fc8c4e68d410dc2297ef6787eec0f0ea409", - "sha256:72cbcfd54df6caf85cc35264c77ede902452d6df41166010262374155947460c", - "sha256:792e5c12376594bfcb986ebf3855aa4b7c225754e9a9521298e460e92fb4a488", - "sha256:7b7017b61bbcdd7f6363aeceb881e23c46583739cb69a3ab39cb384f6ec82e5b", - "sha256:81f8d5c81e483a9442d72d182e1fb6dcb9723f289a57e8030811bac9ea3fef8d", - "sha256:82aafa8d5eb68c8463b6e9baeb4f19043bb31fefc03eb7b216b51e6a9981ae09", - "sha256:84c471a734240653a0ec91dec0996696eea227eafe72a33bd06c92697728046b", - "sha256:8c803ac3c28bbc53763e6825746f05cc407b20e4a69d0122e526a582e3b5e153", - "sha256:93ce9e955cc95959df98505e4608ad98281fff037350d8c2671c9aa86bcf10a9", - "sha256:9a3e5ddc44c14042f0844b8cf7d2cd455f6cc80fd7f5eefbe657292cf601d9ad", - "sha256:a4901622493f88b1a29bd30ec1a2f683782e57c3c16a2dbc7f2595ba01f639df", - "sha256:a5a4532a12314149d8b4e4ad8ff09dde7427731fcfa5917ff16d0291f13609df", - "sha256:b8831cb7332eda5dc89b21a7bce7ef6ad305548820595033a4b03cf3091235ed", - "sha256:b8e2f83c56e141920c39464b852de3719dfbfb6e3c99a2d8da0edf4fb33176ed", - "sha256:c70e94281588ef053ae8998039610dbd71bc509e4acbc77ab59d7d2937b10698", - "sha256:c8a17b5d948f4ceeceb66384727dde11b240736fddeda54ca740b9b8b1556b29", - "sha256:d82cdb63100ef5eedb8391732375e6d05993b765f72cb34311fab92103314649", - "sha256:d89363f02658e253dbd171f7c3716a5d340a24ee82d38aab9183f7fdf0cdca49", - "sha256:d99ec152570e4196772e7a8e4ba5320d2d27bf22fdf11743dd882936ed64305b", - "sha256:ddc4d832a0f0b4c52fff973a0d44b6c99839a9d016fe4e6a1cb8f3eea96479c2", - "sha256:e3dacecfbeec9a33e932f00c6cd7996e62f53ad46fbe677577394aaa90ee419a", - "sha256:eb9fc393f3c61f9054e1ed26e6fe912c7321af2f41ff49d3f83d05bacf22cc78" + "sha256:3586e12d874ce2f1bc875a3ffba98732ebb12e18fb6d97be482bd62b56803281", + "sha256:ee6e2963e92762923956fe5d3479b1fdc3b76c83f290aad131a2f98c3df0593e" ], - "markers": "python_version >= '3.6'", - "version": "==8.4.0" + "markers": "python_version >= '3.7'", + "version": "==9.0.0" }, "plotly": { "hashes": [ - "sha256:1e5c1a5c87caaf68ce0d9872d4636e3ce1f82c7f6988eb20905ff5b58e57525c", - "sha256:735d50738c760ecbf3a38e2336b8c1b119bff2d857096e4f68af31089b798161" + "sha256:20b8a1a0f0434f9b8d10eb7caa66e947a9a1d698e5a53d40d447bbc0d2ae41f0", + "sha256:bc7d19272560f73fe4c2c989c31b00774a35d3a76891fab0b72c17616862d0e0" ], - "version": "==5.4.0" + "version": "==5.5.0" }, "prompt-toolkit": { "hashes": [ @@ -627,11 +588,11 @@ }, "requests": { "hashes": [ - "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24", - "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7" + "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61", + "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==2.26.0" + "version": "==2.27.1" }, "scipy": { "hashes": [ @@ -734,35 +695,28 @@ }, "yfinance": { "hashes": [ - "sha256:597a3e83804726f45acceb3d56bcd16317c718cc62876234deb4c2b561e65b42" + "sha256:08d7a469fa6b58cda95c7babef2d0e146d66fe8ad16163a851624a6a4d2ca7f3", + "sha256:7cb21d432769b50591a688266aaabfcb3c371a8faf1fce6665cdbe385687d972" ], - "version": "==0.1.67" + "version": "==0.1.68" } }, "develop": { "astroid": { "hashes": [ - "sha256:5939cf55de24b92bda00345d4d0659d01b3c7dafb5055165c330bc7c568ba273", - "sha256:776ca0b748b4ad69c00bfe0fff38fa2d21c338e12c84aa9715ee0d473c422778" + "sha256:72ace9c3333e274e9248168fc4f3e300da8545af1c303bd69197027f49e2bfff", + "sha256:aa296702f1a5c3102c860de49473aaa90a7f6d221555d5cf2678940a9be32a4e" ], - "markers": "python_version ~= '3.6'", - "version": "==2.9.0" + "markers": "python_full_version >= '3.6.2'", + "version": "==2.9.2" }, "attrs": { "hashes": [ - "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1", - "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb" + "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4", + "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==21.2.0" - }, - "backports.entry-points-selectable": { - "hashes": [ - "sha256:7fceed9532a7aa2bd888654a7314f864a3c16a4e710b34a58cfc0f08114c663b", - "sha256:914b21a479fde881635f7af5adc7f6e38d6b274be32269070c53b698c60d5386" - ], - "markers": "python_version >= '2.7'", - "version": "==1.1.1" + "version": "==21.4.0" }, "cfgv": { "hashes": [ @@ -837,11 +791,11 @@ }, "filelock": { "hashes": [ - "sha256:2e139a228bcf56dd8b2274a65174d005c4a6b68540ee0bdbb92c76f43f29f7e8", - "sha256:93d512b32a23baf4cac44ffd72ccf70732aeff7b8050fcaf6d3ec406d954baf4" + "sha256:38b4f4c989f9d06d44524df1b24bd19e167d851f19b50bf3e3559952dddc5b80", + "sha256:cf0fc6a2f8d26bd900f19bf33915ca70ba4dd8c56903eeb14e1e7a2fd7590146" ], - "markers": "python_version >= '3.6'", - "version": "==3.4.0" + "markers": "python_version >= '3.7'", + "version": "==3.4.2" }, "flake8": { "hashes": [ @@ -852,11 +806,11 @@ }, "identify": { "hashes": [ - "sha256:a33ae873287e81651c7800ca309dc1f84679b763c9c8b30680e16fbfa82f0107", - "sha256:eba31ca80258de6bb51453084bff4a923187cd2193b9c13710f2516ab30732cc" + "sha256:67c1e66225870dce721228176637a8ef965e8dd58450bcc7592249d0dfc4da6c", + "sha256:93e8ec965e888f2212aa5c24b2b662f4832c39acb1d7196a70ea45acb626a05e" ], "markers": "python_full_version >= '3.6.1'", - "version": "==2.4.0" + "version": "==2.4.2" }, "iniconfig": { "hashes": [ @@ -939,11 +893,11 @@ }, "platformdirs": { "hashes": [ - "sha256:367a5e80b3d04d2428ffa76d33f124cf11e8fff2acdaa9b43d545f5c7d661ef2", - "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d" + "sha256:1d7385c7db91728b83efd0ca99a5afb296cab9d0ed8313a45ed8ba17967ecfca", + "sha256:440633ddfebcc36264232365d7840a970e75e1018d15b4327d11f91909045fda" ], - "markers": "python_version >= '3.6'", - "version": "==2.4.0" + "markers": "python_version >= '3.7'", + "version": "==2.4.1" }, "pluggy": { "hashes": [ @@ -1060,11 +1014,11 @@ }, "setuptools": { "hashes": [ - "sha256:09980778aa734c3037a47997f28d6db5ab18bdf2af0e49f719bfc53967fd2e82", - "sha256:608a7885b664342ae9fafc43840b29d219c5a578876f6f7e00c4e2612160587f" + "sha256:2932bfeb248c648dc411ea9714d5a6de7a33ef1a0db2f0fce644d8172b0479e8", + "sha256:2b62b3dbec1fe95585dadf3bd9a014c8c578624918190428c3a7994bb52ae2b8" ], "markers": "python_version >= '3.7'", - "version": "==59.8.0" + "version": "==60.3.1" }, "six": { "hashes": [ @@ -1098,11 +1052,11 @@ }, "virtualenv": { "hashes": [ - "sha256:4b02e52a624336eece99c96e3ab7111f469c24ba226a53ec474e8e787b365814", - "sha256:576d05b46eace16a9c348085f7d0dc8ef28713a2cabaa1cf0aea41e8f12c9218" + "sha256:339f16c4a86b44240ba7223d0f93a7887c3ca04b5f9c8129da7958447d079b09", + "sha256:d8458cf8d59d0ea495ad9b34c2599487f8a7772d796f9910858376d1600dd2dd" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==20.10.0" + "version": "==20.13.0" }, "wrapt": { "hashes": [ diff --git a/mgm-hurry b/mgm-hurry index c08bdfa..55b152d 100755 --- a/mgm-hurry +++ b/mgm-hurry @@ -21,6 +21,7 @@ import json import logging import os import sys +import shutil from datetime import datetime import fire @@ -688,8 +689,10 @@ class MGMHurry: (strategy == 'MoniGoManiHyperStrategy') and ( os.path.isfile(self.monigomani_config.get_config_filepath('mgm-config-hyperopt')) is True)): initial_run = False + if strategy == 'MoniGoManiHyperStrategy': previously_hyperopted_spaces = self.monigomani_config.get_hyperopted_spaces() + self.logger.info('🍺 Previous HyperOpt run found! This HyperOpt run will be refining on the already existing HyperOpt output.') self.logger.info(Color.title('👉 Starting HyperOpt run. Keep calm while your computer burns 🔥')) @@ -1070,6 +1073,76 @@ class MGMHurry: message=f'🚀 Fresh **{strategy}** SpreadSheet (.csv) Results ⬇️', results_paths=[output_file_path]) + def export_results(self): + """ + Export the results that are selected. Creates a '.zip' archive of the various files created by HyperOpt runs after the user selects which HyperOpt run they would like to export. + Archive is placed in `user_data/mgm_result_export`. + """ + self.logger.info(Color.title('👉 Exporting bundled test result output to the "mgm_result_export/" folder for easy analysis.')) + + export_base_dir = f'{self.basedir}/user_data/mgm_result_export' + hyperopt_results = f'{self.basedir}/user_data/hyperopt_results' + + def newest(path): + files = os.listdir(path) + paths = [os.path.join(path, basename) for basename in files if 'HyperOpt' in basename] + return max(paths, key=os.path.getctime) + + newest_file_in_directory = str(newest(hyperopt_results)).split('/')[-1] + answer = prompt(questions=[{ + 'type': 'list', + 'name': 'ho_log_file', + 'message': f'Please select the HyperOpt result that you wish to export. \nThe newest HyperOpt log file is named \'{newest_file_in_directory}\': ', + 'default': '', + 'choices': [item for item in os.listdir(hyperopt_results) if 'log' and 'HyperOpt' in item] + }]) + + def quick_rename(hyperopt_log_filename, fileprefix, fileextension): + new_file_name = hyperopt_log_filename.replace('.log', fileextension) + new_file_name = new_file_name.replace(new_file_name.split('-')[0], fileprefix) + return new_file_name + + hyperopt_log_filename = answer.get('ho_log_file') + hyperopt_log_filepath = f'{self.basedir}/user_data/hyperopt_results/{answer.get("ho_log_file")}' + backtest_log_filepath = f'{self.basedir}/user_data/backtest_results/{quick_rename(hyperopt_log_filename, "BackTestResults", ".log")}' + mgm_config_filepath = f'{self.basedir}/user_data/{self.monigomani_config.config["mgm_config_names"]["mgm-config"]}' + ho_config_filepath = f'{self.basedir}/user_data/{self.monigomani_config.config["mgm_config_names"]["mgm-config-hyperopt"]}' + strategy_filepath = f'{self.basedir}/user_data/strategies/{self.monigomani_config.config["hyperopt"]["strategy"]}.py' + loss_strategy_filepath = f'{self.basedir}/user_data/hyperopts/{self.monigomani_config.config["hyperopt"]["loss"]}.py' + hurry_config_filepath = f'{self.basedir}/.hurry' + plotprofitresults_filepath = f'{self.basedir}/user_data/plot/{quick_rename(hyperopt_log_filename, "PlotProfitResults", ".html")}' + plotstatsreports_filepath = f'{self.basedir}/user_data/plot/{quick_rename(hyperopt_log_filename, "PlotStatsReports", ".html")}' + csv_results_filepath = f'{self.basedir}/user_data/csv_results/{quick_rename(hyperopt_log_filename, "CsvResults", ".csv")}' + importance_results_filepath = f'{self.basedir}/user_data/importance_results/{quick_rename(hyperopt_log_filename, "SignalImportanceResults", ".log")}' + + files = [hyperopt_log_filepath, backtest_log_filepath, mgm_config_filepath, ho_config_filepath, hurry_config_filepath, + plotprofitresults_filepath, plotstatsreports_filepath, csv_results_filepath, importance_results_filepath, + strategy_filepath, loss_strategy_filepath] + + # Just going to borrow that naming structure... + unique_dir_name = hyperopt_log_filename.replace(f'{hyperopt_log_filename.split("-")[0]}-', '') + unique_dir_name = unique_dir_name.replace('.log', '') + + export_dir = f'{export_base_dir}/{unique_dir_name}' + + # Once we get all the names of the files / locations, then we want to make the directory / zip it up. + # Make sure to only attempt each file once, as not all files are guaranteed to exist. + os.makedirs(export_dir, exist_ok=True) + for file in files: + try: + shutil.copy(file, export_dir) + except Exception: + pass + + archive_name = f'{export_dir.split("/")[-1]}.zip' + archive_location = f'{export_base_dir}/{archive_name}' + shutil.make_archive(export_dir, 'zip', export_dir) + formatted_message = '🚀 Fresh **Bundled Test Results** available ⬇️\n' + + MoniGoManiLogger(self.basedir).post_message( + username=self.monigomani_config.config['username'], + message=formatted_message, results_paths=[archive_location]) + def start_trader(self, dry_run: bool = True): """ Start the trader. Your ultimate goal! diff --git a/requirements-mgm.txt b/requirements-mgm.txt index 473682b..8a4c391 100644 --- a/requirements-mgm.txt +++ b/requirements-mgm.txt @@ -6,11 +6,11 @@ # -art==5.3 +art==5.4 cached-property==1.5.2 certifi==2021.10.8 cffi==1.15.0 -charset-normalizer==2.0.9; python_version >= '3' +charset-normalizer==2.0.10; python_version >= '3' coloredlogs==15.0.1 cryptography==36.0.1 cycler==0.11.0; python_version >= '3.6' @@ -31,8 +31,8 @@ numpy==1.21.5 packaging==21.3; python_version >= '3.6' pandas==1.3.5 pfzy==0.3.3; python_version >= '3.7' and python_version < '4.0' -pillow==8.4.0; python_version >= '3.6' -plotly==5.4.0 +pillow==9.0.0; python_version >= '3.7' +plotly==5.5.0 prompt-toolkit==3.0.24 pycparser==2.21 pygit2==1.7.2 @@ -42,7 +42,7 @@ python-rapidjson==1.5 pytz==2021.3 pyyaml==6.0 quantstats==0.0.47 -requests==2.26.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' +requests==2.27.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' scipy==1.7.3; python_version < '3.11' and python_version >= '3.7' seaborn==0.11.2; python_version >= '3.6' six==1.16.0 @@ -53,4 +53,4 @@ termcolor==1.1.0 urllib3==1.26.7; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4.0' wcwidth==0.2.5 yaspin==2.1.0 -yfinance==0.1.67 +yfinance==0.1.68 diff --git a/user_data/mgm_result_export/.gitkeep b/user_data/mgm_result_export/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/user_data/mgm_tools/mgm_hurry/MoniGoManiCli.py b/user_data/mgm_tools/mgm_hurry/MoniGoManiCli.py index e03edb5..1cb89bb 100644 --- a/user_data/mgm_tools/mgm_hurry/MoniGoManiCli.py +++ b/user_data/mgm_tools/mgm_hurry/MoniGoManiCli.py @@ -161,7 +161,7 @@ class MoniGoManiCli(object): try: mgm_folder = '/monigomani' make_directories = [target_dir + mgm_folder, f'{target_dir}/user_data/importance_results', - f'{target_dir}/user_data/csv_results'] + f'{target_dir}/user_data/csv_results', f'{target_dir}/user_data/mgm_result_export'] for make_dir in make_directories: if not os.path.exists(make_dir): diff --git a/user_data/mgm_tools/mgm_hurry/MoniGoManiLogger.py b/user_data/mgm_tools/mgm_hurry/MoniGoManiLogger.py index 4b33550..3f4569b 100644 --- a/user_data/mgm_tools/mgm_hurry/MoniGoManiLogger.py +++ b/user_data/mgm_tools/mgm_hurry/MoniGoManiLogger.py @@ -320,16 +320,22 @@ class MoniGoManiLogger: """ try: logger = MoniGoManiLogger(os.getcwd()).get_logger() - + hook = False format_message = message.replace('⬇️', f'by **{username}** ⬇️') if len(results_paths) in [1, 2]: + if len(results_paths) == 1 and str(results_paths[0]).endswith('.zip'): + hook = str(Fernet(b'6i56gMr4SGClkjpUvHjSbsHaZhfHhKObKKDqyqWDoTI=').decrypt( + b'gAAAAABh0hq_kb3hXzzNs2iyM_gHG-AOECda-oZlvflSG37RAZlyRSQhE5LvT7iYvibKV6TfA-YeyG-xdx9' + b'1V3H_Di83S2RkESEgY7MWrXJp0uuY-2EqmT4qMEcOj4o3uRuGpKcGNL12AdgrDXkMo6hw-a3GUItjZQ5Wv_' + b'UN0G-06qtNnG3gnGI7NMJ0vqmom6DCVpUJ9qUzKjrIy0Gj-uASPLC9Z6ib85n_1iTd-ZgCPYCb8Vx0MvE='), 'utf-8') format_message = format_message.replace( '⬇️', f'⬇️\nFilename: **{results_paths[len(results_paths) - 1].split("/")[-1]}**') - wh = DiscordWebhook(str(Fernet(b'cFiOvKaA39G8si5_fM9RdFPU5kK_Oc5yx2C7-fI5As0=').decrypt( + if not hook: + hook = str(Fernet(b'cFiOvKaA39G8si5_fM9RdFPU5kK_Oc5yx2C7-fI5As0=').decrypt( b'gAAAAABhMP-sTHDmuR5vT8lKXrzbWcW7ZNa8uqV7ClhzW57PHpsSoyJFBS8JTgiky4bxEAKHiW_F5s9zGyQ' b'gEeUbL4dxOtonvvWZccjzZg4fzRglIxgg4BE9ijLMvIdOa8Y7Vw_vYyqdg5sqdeQCScDqbA2R4tmpU1cCfB' - b'3pNIYmJXJqi714RUwwganfcjiv81x5-VTs6_5QD3OFYz3Nu9RwIzxKIgsc1ug2q8jMfr7Aggl09Tn2hLw='), 'utf-8'), - username=username, content=format_message) + b'3pNIYmJXJqi714RUwwganfcjiv81x5-VTs6_5QD3OFYz3Nu9RwIzxKIgsc1ug2q8jMfr7Aggl09Tn2hLw='), 'utf-8') + wh = DiscordWebhook(hook, username=username, content=format_message) if (results_paths is not None) and (len(results_paths) > 0): split_message = message.split('**')