Closed slavakurilyak closed 6 years ago
Dear CTP Maintainers,
Before I tell you about my issue, let me describe my environment:
$ uname -a
Darwin Slavs-MacBook-Pro.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
$ python --version
Python 2.7.14
$ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
64
pip
conda
other (please explain)
$ pip freeze
$ conda list
alembic==0.9.6 backports.functools-lru-cache==1.4 bcolz==0.12.1 boto3==1.5.13 botocore==1.8.27 Bottleneck==1.2.1 ccxt==1.10.671 certifi==2017.11.5 chardet==3.0.4 click==6.7 contextlib2==0.5.5 -e git+https://github.com/produvia/cryptocurrency-trading-platform.git@d75340c6d96d411fb03d99ba4337143ab185bd73#egg=crypto_trading_platform cycler==0.10.0 cyordereddict==1.0.0 Cython==0.27.3 decorator==4.1.2 docutils==0.14 empyrical==0.2.2 enigma-catalyst==0.4.4 futures==3.2.0 idna==2.6 intervaltree==2.1.0 jmespath==0.9.3 Logbook==1.1.0 lru-dict==1.1.6 Mako==1.0.7 MarkupSafe==1.0 matplotlib==2.1.1 multipledispatch==0.4.9 networkx==2.0 numexpr==2.6.4 numpy==1.14.0 pandas==0.18.1 pandas-datareader==0.5.0 patsy==0.5.0 pyparsing==2.2.0 python-dateutil==2.6.1 python-editor==1.0.3 pytz==2017.3 redo==1.6 requests==2.18.4 requests-file==1.4.3 requests-ftp==0.3.1 s3transfer==0.1.12 scipy==1.0.0 six==1.11.0 sortedcontainers==1.5.9 SQLAlchemy==1.2.0 statsmodels==0.8.0 subprocess32==3.2.7 TA-Lib==0.4.15 tables==3.4.2 toolz==0.9.0 urllib3==1.22 zipline==1.1.1
Now that you know a little about me, let me tell you about the issue I am having:
What did you expect to happen? When I ran $ python run_strategies.py, I expected to see performance_results folder with all strategies in comparison.
$ python run_strategies.py
What happened instead? I received the following error:
[2018-01-17 19:02:03.300358] INFO: Load: Grabbing algos from /Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/algos/single_asset [2018-01-17 19:02:03.300646] INFO: Load: Attempting to import talib_simple.py /Users/skurilyak/.pyenv/versions/cryptocurrency-trading-platform-2.7.14/lib/python2.7/site-packages/matplotlib/cbook/deprecation.py:106: MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead. warnings.warn(message, mplDeprecation, stacklevel=1) [2018-01-17 19:02:06.983558] INFO: Load: Loaded talib_sample [2018-01-17 19:02:06.983702] INFO: Strategy Runner: Running talib_sample [2018-01-17 19:02:06.985337] WARNING: run_algo: Catalyst is currently in ALPHA. It is going through rapid development and it is subject to errors. Please use carefully. We encourage you to report any issue on GitHub: https://github.com/enigmampc/catalyst/issues [2018-01-17 19:02:09.988472] INFO: run_algo: running algo in backtest mode [2018-01-17 19:02:14.853728] INFO: exchange_algorithm: initialized trading algorithm in backtest mode [2018-01-17 19:02:19.277536] INFO: talib_sample: Starting TALib Simple Example [2018-01-17 19:02:19.280065] INFO: talib_sample: handling bar 2017-10-01 23:59:00+00:00 [2018-01-17 19:02:19.357400] INFO: talib_sample: [ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 676.1484 678.7464 681.49 684.1104 686.5808 689.1178 691.339 693.427 695.7262 697.9698 699.9124 702.267 705.0244 707.4736 710.0396 712.1684 714.5198 717.0464 719.7112 722.472 725.1954 727.2998 729.679 732.086 734.3854 736.36 738.27 740.2204 741.7344 743.4952 745.4346 747.3294 749.4964 754.026 757.7784 761.5606 765.4096 770.0272 775.4214 780.4254 785.3132 790.3204 796.2288 802.542 809.1434 817.692 822.8564 826.013 829.0936 832.3536 835.8202 839.1556 839.7494 841.001 842.8112 844.31 846.101 848.205 851.6544 854.7826 858.0084 860.816 863.7988 866.964 869.7644 872.474 875.1938 878.196 881.2298 884.2084 887.0014 889.9442 893.7082 897.8828 902.533 907.2984 912.237 916.5492 921.197 926.4272 931.4434 934.556 937.212 938.8342 940.8496 942.8196 944.9576 946.507 947.643 949.2722 951.281 953.0734 954.9176 957.1236 958.8836 959.8876 963.5316 968.6216 974.0276 979.6196 985.3416 991.8904 1001.4596 1011.152 1019.9456 1029.2076 1038.3768 1046.4228 1051.343 1057.4018 1061.704 1067.2372 1073.2448 1079.5404 1086.27 1093.672 1099.177 1102.2826 1103.3788 1105.3202 1107.8792 1111.8502 1113.3084 1114.2878 1112.9904 1112.1198 1110.8758 1111.5978 1112.0398 1111.8338 1111.6818 1113.6124 1115.6424 1117.7904 1120.8722 1123.8582 1126.4002 1129.9522 1133.1142 1135.7522 1138.8762 1142.1582 1145.0462 1147.0022 1148.2302 1148.5702 1148.7282 1149.9082 1151.1422 1152.5402 1153.9682 1155.4742 1156.8542 1157.9982 1159.7462 1161.0782 1162.9162 1166.2682 1172.0742 1176.5782 1182.7422 1187.9942 1194.1662 1200.5662 1208.0462 1215.0642 1222.5942 1233.1262 1246.094 1259.834 1274.224 1287.844 1304.14 1318.186 1335.7334 1352.836 1368.898 1383.768 1400.274 1418.268 1436.774 1456.33 1474.992 1494.588 1516.578 1541.572 1564.126 1582.814 1598.486 1615.862 1635.692 1654.22 1673.344 1695.036 1719.416 1744.5 1770.398 1798.896 1830.988 1858.56 1888.98 1918.99 1948.57 1980.478 2004.766 2031.408 2051.872 2071.422 2091.366 2115.256 2136.612 2159.552 2183.182 2204.5 2225.576 2246.932 2266.082 2283.808 2299.282 2315.636 2330.8 2344.31 2355.644 2367.868 2380.38 2394.314 2410.472 2426.72 2441.184 2451.94 2463.45 2471.822 2477.656 2481.586 2484.106 2482.798 2481.566 2478.62 2477.516 2480.778 2482.686 2484.82 2498.286 2505.226 2514.002 2519.784 2525.414 2523.894 2517.5567624 2517.9687624 2518.0347624 2516.1167624 2514.9607624 2513.2107624 2516.4447624 2516.9427624 2524.8627624 2534.5127624 2550.8087624 2563.2487624 2581.3407624 2598.0007624 2610.5187624 2626.1307624 2645.5427624 2669.3687624 2700.5487624 2737.2987624 2772.4627624 2809.7667624 2844.6627624 2877.0167624 2911.5047624 2945.8427624 2976.9047624 3008.0627624 3039.0687624 3073.5387624 3108.7047624 3145.9267624 3181.7427624 3219.8867624 3265.2627624 3310.9467624 3357.8007624 3409.3527624 3455.8687624 3508.2667624 3553.8667624 3596.9667624 3642.8267624 3690.0327624 3718.8107624 3751.9487624 3779.7327624 3808.7047624 3836.2987624 3862.0747624 3876.226 3896.876 3914.81 3933.88 3960.604 3981.362 4004.184 4022.078 4038.318 4056.71 4064.758 4078.718 4088.428 4104.322 4121.314 4136.574 4151.048 4161.81 ] [2018-01-17 19:02:19.372525] INFO: talib_sample: Bought 10 @ 4404.3 [2018-01-17 19:02:19.372740] INFO: talib_sample: - sma_f: 4161.81 [2018-01-17 19:02:19.372917] INFO: talib_sample: - sma_s: 3415.59 [2018-01-17 19:02:19.373080] INFO: talib_sample: - rsi: 59.46 [2018-01-17 19:02:19.373233] INFO: talib_sample: - sma_r: 49.47 [2018-01-17 19:02:19.373382] INFO: talib_sample: - macd: 53.08 [2018-01-17 19:02:19.373530] INFO: talib_sample: - macdSignal: -22.56 [2018-01-17 19:02:19.373677] INFO: talib_sample: - macdHist: 75.64 [2018-01-17 19:02:19.373842] INFO: talib_sample: - stoch_k: 70.16 [2018-01-17 19:02:19.373988] INFO: talib_sample: - stoch_d: 67.28 [2018-01-17 19:02:19.374089] INFO: talib_sample: - sma_test: 1 [2018-01-17 19:02:19.374184] INFO: talib_sample: - macd_test: 1 [2018-01-17 19:02:19.374326] INFO: talib_sample: - stoch_over_bought: 0 [2018-01-17 19:02:19.374469] INFO: talib_sample: - stoch_over_sold: 0 [2018-01-17 19:02:19.374641] INFO: talib_sample: - rsi_over_bought: 0 [2018-01-17 19:02:19.374791] INFO: talib_sample: - rsi_over_sold: 0 [2018-01-17 19:02:19.374864] INFO: talib_sample: completed bar 2017-10-01 23:59:00+00:00, total execution errors 0 [2018-01-17 19:02:19.383081] INFO: talib_sample: handling bar 2017-10-02 23:59:00+00:00 [2018-01-17 19:02:19.394826] INFO: talib_sample: [ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 678.7464 681.49 684.1104 686.5808 689.1178 691.339 693.427 695.7262 697.9698 699.9124 702.267 705.0244 707.4736 710.0396 712.1684 714.5198 717.0464 719.7112 722.472 725.1954 727.2998 729.679 732.086 734.3854 736.36 738.27 740.2204 741.7344 743.4952 745.4346 747.3294 749.4964 754.026 757.7784 761.5606 765.4096 770.0272 775.4214 780.4254 785.3132 790.3204 796.2288 802.542 809.1434 817.692 822.8564 826.013 829.0936 832.3536 835.8202 839.1556 839.7494 841.001 842.8112 844.31 846.101 848.205 851.6544 854.7826 858.0084 860.816 863.7988 866.964 869.7644 872.474 875.1938 878.196 881.2298 884.2084 887.0014 889.9442 893.7082 897.8828 902.533 907.2984 912.237 916.5492 921.197 926.4272 931.4434 934.556 937.212 938.8342 940.8496 942.8196 944.9576 946.507 947.643 949.2722 951.281 953.0734 954.9176 957.1236 958.8836 959.8876 963.5316 968.6216 974.0276 979.6196 985.3416 991.8904 1001.4596 1011.152 1019.9456 1029.2076 1038.3768 1046.4228 1051.343 1057.4018 1061.704 1067.2372 1073.2448 1079.5404 1086.27 1093.672 1099.177 1102.2826 1103.3788 1105.3202 1107.8792 1111.8502 1113.3084 1114.2878 1112.9904 1112.1198 1110.8758 1111.5978 1112.0398 1111.8338 1111.6818 1113.6124 1115.6424 1117.7904 1120.8722 1123.8582 1126.4002 1129.9522 1133.1142 1135.7522 1138.8762 1142.1582 1145.0462 1147.0022 1148.2302 1148.5702 1148.7282 1149.9082 1151.1422 1152.5402 1153.9682 1155.4742 1156.8542 1157.9982 1159.7462 1161.0782 1162.9162 1166.2682 1172.0742 1176.5782 1182.7422 1187.9942 1194.1662 1200.5662 1208.0462 1215.0642 1222.5942 1233.1262 1246.094 1259.834 1274.224 1287.844 1304.14 1318.186 1335.7334 1352.836 1368.898 1383.768 1400.274 1418.268 1436.774 1456.33 1474.992 1494.588 1516.578 1541.572 1564.126 1582.814 1598.486 1615.862 1635.692 1654.22 1673.344 1695.036 1719.416 1744.5 1770.398 1798.896 1830.988 1858.56 1888.98 1918.99 1948.57 1980.478 2004.766 2031.408 2051.872 2071.422 2091.366 2115.256 2136.612 2159.552 2183.182 2204.5 2225.576 2246.932 2266.082 2283.808 2299.282 2315.636 2330.8 2344.31 2355.644 2367.868 2380.38 2394.314 2410.472 2426.72 2441.184 2451.94 2463.45 2471.822 2477.656 2481.586 2484.106 2482.798 2481.566 2478.62 2477.516 2480.778 2482.686 2484.82 2498.286 2505.226 2514.002 2519.784 2525.414 2523.894 2517.5567624 2517.9687624 2518.0347624 2516.1167624 2514.9607624 2513.2107624 2516.4447624 2516.9427624 2524.8627624 2534.5127624 2550.8087624 2563.2487624 2581.3407624 2598.0007624 2610.5187624 2626.1307624 2645.5427624 2669.3687624 2700.5487624 2737.2987624 2772.4627624 2809.7667624 2844.6627624 2877.0167624 2911.5047624 2945.8427624 2976.9047624 3008.0627624 3039.0687624 3073.5387624 3108.7047624 3145.9267624 3181.7427624 3219.8867624 3265.2627624 3310.9467624 3357.8007624 3409.3527624 3455.8687624 3508.2667624 3553.8667624 3596.9667624 3642.8267624 3690.0327624 3718.8107624 3751.9487624 3779.7327624 3808.7047624 3836.2987624 3862.0747624 3876.226 3896.876 3914.81 3933.88 3960.604 3981.362 4004.184 4022.078 4038.318 4056.71 4064.758 4078.718 4088.428 4104.322 4121.314 4136.574 4151.048 4161.81 4168.582 ] [2018-01-17 19:02:19.408122] INFO: talib_sample: Holdings: 10 @ 4409.44130046 [2018-01-17 19:02:19.408381] INFO: talib_sample: no buy or sell opportunity found [2018-01-17 19:02:19.408583] INFO: talib_sample: - sma_f: 4168.58 [2018-01-17 19:02:19.408775] INFO: talib_sample: - sma_s: 3434.57 [2018-01-17 19:02:19.408970] INFO: talib_sample: - rsi: 59.34 [2018-01-17 19:02:19.409157] INFO: talib_sample: - sma_r: 50.67 [2018-01-17 19:02:19.409343] INFO: talib_sample: - macd: 73.88 [2018-01-17 19:02:19.409531] INFO: talib_sample: - macdSignal: -3.27 [2018-01-17 19:02:19.409721] INFO: talib_sample: - macdHist: 77.15 [2018-01-17 19:02:19.409887] INFO: talib_sample: - stoch_k: 69.10 [2018-01-17 19:02:19.410052] INFO: talib_sample: - stoch_d: 68.90 [2018-01-17 19:02:19.410162] INFO: talib_sample: - sma_test: 1 [2018-01-17 19:02:19.410335] INFO: talib_sample: - macd_test: 1 [2018-01-17 19:02:19.410544] INFO: talib_sample: - stoch_over_bought: 0 [2018-01-17 19:02:19.410728] INFO: talib_sample: - stoch_over_sold: 0 [2018-01-17 19:02:19.410895] INFO: talib_sample: - rsi_over_bought: 0 [2018-01-17 19:02:19.411057] INFO: talib_sample: - rsi_over_sold: 0 [2018-01-17 19:02:19.411133] INFO: talib_sample: completed bar 2017-10-02 23:59:00+00:00, total execution errors 0 [2018-01-17 19:02:19.424456] INFO: Performance: Simulated 2 trading days out of 2. [2018-01-17 19:02:19.424667] INFO: Performance: first open: 2017-10-01 00:00:00+00:00 [2018-01-17 19:02:19.424793] INFO: Performance: last close: 2017-10-02 23:59:00+00:00 [2018-01-17 19:02:19.433655] INFO: Strategy Runner: Dumping result csv to /Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/performance_results/talib_sample/btc_usd_bitfinex_daily.csv [2018-01-17 19:02:19.439944] INFO: Strategy Runner: Run completed for talib_sample [2018-01-17 19:02:19.440050] INFO: Load: Attempting to import buy_low_sell_high.py [2018-01-17 19:02:19.454994] INFO: Load: Loaded buy_the_dip_live [2018-01-17 19:02:19.455182] INFO: Strategy Runner: Running buy_the_dip_live [2018-01-17 19:02:19.456001] WARNING: run_algo: Catalyst is currently in ALPHA. It is going through rapid development and it is subject to errors. Please use carefully. We encourage you to report any issue on GitHub: https://github.com/enigmampc/catalyst/issues [2018-01-17 19:02:22.457779] INFO: run_algo: running algo in backtest mode [2018-01-17 19:02:22.538729] INFO: exchange_algorithm: initialized trading algorithm in backtest mode [2018-01-17 19:02:22.539852] INFO: buy_the_dip_live: initializing algo [2018-01-17 19:02:22.541709] INFO: buy_the_dip_live: handling bar 2017-10-01 23:59:00+00:00 [2018-01-17 19:02:22.543875] INFO: buy_the_dip_live: got price 4404.3 [2018-01-17 19:02:22.545938] INFO: buy_the_dip_live: got rsi: 54.8635961151 [2018-01-17 19:02:22.546096] INFO: buy_the_dip_live: base currency available: 1000.0 [2018-01-17 19:02:22.546262] INFO: buy_the_dip_live: buying position cheaper than cost basis 4404.3 < None [2018-01-17 19:02:22.546461] INFO: buy_the_dip_live: completed bar 2017-10-01 23:59:00+00:00, total execution errors 0 [2018-01-17 19:02:22.554097] INFO: buy_the_dip_live: handling bar 2017-10-02 23:59:00+00:00 [2018-01-17 19:02:22.554503] INFO: buy_the_dip_live: got price 4400.2 [2018-01-17 19:02:22.556670] INFO: buy_the_dip_live: got rsi: 59.1172562545 [2018-01-17 19:02:22.557090] INFO: buy_the_dip_live: base currency available: 118.111739908 [2018-01-17 19:02:22.557192] INFO: buy_the_dip_live: found 0.2 positions with cost basis 4409.44130046 [2018-01-17 19:02:22.557258] INFO: buy_the_dip_live: not enough base currency to consider buying [2018-01-17 19:02:22.557332] INFO: buy_the_dip_live: completed bar 2017-10-02 23:59:00+00:00, total execution errors 0 [2018-01-17 19:02:22.564673] INFO: Performance: Simulated 2 trading days out of 2. [2018-01-17 19:02:22.564781] INFO: Performance: first open: 2017-10-01 00:00:00+00:00 [2018-01-17 19:02:22.564856] INFO: Performance: last close: 2017-10-02 23:59:00+00:00 [2018-01-17 19:02:22.570146] INFO: Strategy Runner: Dumping result csv to /Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/performance_results/buy_the_dip_live/btc_usd_bitfinex_daily.csv [2018-01-17 19:02:22.579482] INFO: Strategy Runner: Run completed for buy_the_dip_live [2018-01-17 19:02:22.579712] INFO: Load: Attempting to import rsi_profit_target.pyc Traceback (most recent call last): File "run_strategies.py", line 62, in <module> run() File "run_strategies.py", line 37, in run for algo in load.single_asset_algos(): File "/Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/utils/load.py", line 53, in load_algos algo = get_algo(f) File "/Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/utils/load.py", line 42, in get_algo module_name, os.path.join(SINGLE_ALGOS, filename)) File "/Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/utils/load.py", line 28, in import_with_2 return imp.load_source(module_name, path) File "/Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/algos/single_asset/rsi_profit_target.pyc", line 1 SyntaxError: Non-ASCII character '\xf3' in file /Users/skurilyak/dev/produvia/cryptocurrency-trading-platform/crypto_platform/algos/single_asset/rsi_profit_target.pyc on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Here is how you can reproduce this issue on your machine:
cd scripts
python run_strategies.py
I modified scripts/run_strategies.py to
def get_output_file(algo): perf_dir = CONFIG.PERF_DIR algo_dir = os.path.join(perf_dir, algo.NAMESPACE) # Before # os.makedirs(algo_dir) # After try: os.makedirs(algo_dir) except OSError: if not os.path.isdir(algo_dir): raise
Sincerely, skurilyak
Reinstalling the dependencies and the library resolved this issue
Dear CTP Maintainers,
Before I tell you about my issue, let me describe my environment:
Environment
$ uname -a
)$ python --version
$ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
pip
,conda
, orother (please explain)
)$ pip freeze
or$ conda list
Now that you know a little about me, let me tell you about the issue I am having:
Description of Issue
What did you expect to happen? When I ran
$ python run_strategies.py
, I expected to see performance_results folder with all strategies in comparison.What happened instead? I received the following error:
Here is how you can reproduce this issue on your machine:
Reproduction Steps
cd scripts
python run_strategies.py
What steps have you taken to resolve this already?
I modified scripts/run_strategies.py to
Sincerely, skurilyak