Python 3.8.2 64-bit
from frameworks import performMonthly, get_test_details, perform
xxxxxxxxxx
test_details = get_test_details()
pm = performMonthly()
x
pm.set_altcoin_dfs()
1INCH-PERP AAVE-PERP ADA-PERP ALGO-PERP ALPHA-PERP ALT-PERP AMPL-PERP ATOM-PERP AVAX-PERP BAL-PERP BAND-PERP BAT-PERP BCH-PERP BNB-PERP BRZ-PERP BSV-PERP BTC-PERP BTMX-PERP BTT-PERP CHZ-PERP COMP-PERP CREAM-PERP CRV-PERP CUSDT-PERP DEFI-PERP DMG-PERP DOGE-PERP DOT-PERP DRGN-PERP EGLD-PERP EOS-PERP ETC-PERP ETH-PERP EXCH-PERP FIL-PERP FLM-PERP FTT-PERP GRT-PERP HNT-PERP HOLY-PERP HT-PERP KNC-PERP KSM-PERP LEO-PERP LINK-PERP LTC-PERP MATIC-PERP MID-PERP
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-5-9d515498fe5c> in <module> ----> 1 pm.set_altcoin_dfs() ~/Desktop/Projects/new_algo/altcoin/frameworks.py in set_altcoin_dfs(self, cache) 42 for symbol in perps['name']: 43 print(symbol) ---> 44 df = get_df(symbol, cache=cache) 45 row = {} 46 row['symbol'] = symbol ~/Desktop/Projects/new_algo/altcoin/backtest.py in get_df(symbol, cache) 71 df['startTime'] = pd.to_datetime(df['startTime']).dt.tz_localize(None) 72 df = df[['startTime', 'open', 'high', 'low', 'close', 'volume']] ---> 73 df.to_csv("data/{}.csv".format(symbol), index=None) 74 75 df = pd.read_csv("data/{}.csv".format(symbol)) ~/.local/lib/python3.8/site-packages/pandas/core/generic.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal, errors) 3165 decimal=decimal, 3166 ) -> 3167 formatter.save() 3168 3169 if path_or_buf is None: ~/.local/lib/python3.8/site-packages/pandas/io/formats/csvs.py in save(self) 204 ) 205 --> 206 self._save() 207 208 finally: ~/.local/lib/python3.8/site-packages/pandas/io/formats/csvs.py in _save(self) 326 break 327 --> 328 self._save_chunk(start_i, end_i) 329 330 def _save_chunk(self, start_i: int, end_i: int) -> None: ~/.local/lib/python3.8/site-packages/pandas/io/formats/csvs.py in _save_chunk(self, start_i, end_i) 339 for i in range(len(blocks)): 340 b = blocks[i] --> 341 d = b.to_native_types( 342 na_rep=self.na_rep, 343 float_format=self.float_format, ~/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py in to_native_types(self, na_rep, date_format, **kwargs) 2121 dta = self.array_values() 2122 -> 2123 result = dta._format_native_types( 2124 na_rep=na_rep, date_format=date_format, **kwargs 2125 ) ~/.local/lib/python3.8/site-packages/pandas/core/arrays/datetimes.py in _format_native_types(self, na_rep, date_format, **kwargs) 607 fmt = _get_format_datetime64_from_values(self, date_format) 608 --> 609 return tslib.format_array_from_datetime( 610 self.asi8.ravel(), tz=self.tz, format=fmt, na_rep=na_rep 611 ).reshape(self.shape) pandas/_libs/tslib.pyx in pandas._libs.tslib.format_array_from_datetime() pandas/_libs/tslibs/timestamps.pyx in pandas._libs.tslibs.timestamps.Timestamp.__new__() pandas/_libs/tslibs/conversion.pyx in pandas._libs.tslibs.conversion.convert_to_tsobject() KeyboardInterrupt:
xxxxxxxxxx
# curr = {}
# curr['train_end'] = pd.to_datetime(pd.to_datetime('now').date())
# curr['at_least'] = curr['train_end'] - pd.DateOffset(months=1)
x
pm.set_curr(curr, 'monthly')
selected = pm.get_first_results()
Exception in 1INCH-PERP: 'startTime' Exception in GRT-PERP: 'startTime'
x
selected_names = selected['name'].values
pm.set_all_combinations(selected_names)
selected = pm.perform_grid_search()
12 of 9120 24 of 9120 36 of 9120 48 of 9120 60 of 9120 72 of 9120 84 of 9120 96 of 9120 108 of 9120 120 of 9120 132 of 9120 144 of 9120 156 of 9120 168 of 9120 180 of 9120 192 of 9120 204 of 9120 216 of 9120 228 of 9120 240 of 9120 252 of 9120 264 of 9120 276 of 9120 288 of 9120 300 of 9120 312 of 9120 324 of 9120 336 of 9120 348 of 9120 360 of 9120 372 of 9120 384 of 9120 396 of 9120 408 of 9120 420 of 9120 432 of 9120 444 of 9120 456 of 9120 468 of 9120 480 of 9120 492 of 9120 504 of 9120 516 of 9120 528 of 9120 540 of 9120 552 of 9120 564 of 9120 576 of 9120 588 of 9120 600 of 9120 612 of 9120 624 of 9120 636 of 9120 648 of 9120 660 of 9120 672 of 9120 684 of 9120 696 of 9120 708 of 9120 720 of 9120 732 of 9120 744 of 9120 756 of 9120 768 of 9120 780 of 9120 792 of 9120 804 of 9120 816 of 9120 828 of 9120 840 of 9120 852 of 9120 864 of 9120 876 of 9120 888 of 9120 900 of 9120 912 of 9120 924 of 9120 936 of 9120 948 of 9120 960 of 9120 972 of 9120 984 of 9120 996 of 9120 1008 of 9120 1020 of 9120 1032 of 9120 1044 of 9120 1056 of 9120 1068 of 9120 1080 of 9120 1092 of 9120 1104 of 9120 1116 of 9120 1128 of 9120 1140 of 9120 1152 of 9120 1164 of 9120 1176 of 9120 1188 of 9120 1200 of 9120 1212 of 9120 1224 of 9120 1236 of 9120 1248 of 9120 1260 of 9120 1272 of 9120 1284 of 9120 1296 of 9120 1308 of 9120 1320 of 9120 1332 of 9120 1344 of 9120 1356 of 9120 1368 of 9120 1380 of 9120 1392 of 9120 1404 of 9120 1416 of 9120 1428 of 9120 1440 of 9120 1452 of 9120 1464 of 9120 1476 of 9120 1488 of 9120 1500 of 9120 1512 of 9120 1524 of 9120 1536 of 9120 1548 of 9120 1560 of 9120 1572 of 9120 1584 of 9120 1596 of 9120 1608 of 9120 1620 of 9120 1632 of 9120 1644 of 9120 1656 of 9120 1668 of 9120 1680 of 9120 1692 of 9120 1704 of 9120 1716 of 9120 1728 of 9120 1740 of 9120 1752 of 9120 1764 of 9120 array index out of range array index out of range array index out of range 1776 of 9120 1788 of 9120 1800 of 9120 1812 of 9120 1824 of 9120 1836 of 9120 array index out of range array index out of range 1848 of 9120 array index out of range 1860 of 9120 1872 of 9120 1884 of 9120 1896 of 9120 1908 of 9120 1920 of 9120 array index out of range array index out of range array index out of range 1932 of 9120 1944 of 9120 1956 of 9120 1968 of 9120 1980 of 9120 1992 of 9120 2004 of 9120 2016 of 9120 2028 of 9120 2040 of 9120 2052 of 9120 2064 of 9120 2076 of 9120 2088 of 9120 2100 of 9120 2112 of 9120 2124 of 9120 2136 of 9120 2148 of 9120 2160 of 9120 2172 of 9120 2184 of 9120 2196 of 9120 2208 of 9120 2220 of 9120 2232 of 9120 2244 of 9120 2256 of 9120 2268 of 9120 2280 of 9120 2292 of 9120 2304 of 9120 2316 of 9120 2328 of 9120 2340 of 9120 2352 of 9120 2364 of 9120 2376 of 9120 2388 of 9120 2400 of 9120 2412 of 9120 2424 of 9120 2436 of 9120 2448 of 9120 2460 of 9120 2472 of 9120 2484 of 9120 2496 of 9120 2508 of 9120 2520 of 9120 2532 of 9120 2544 of 9120 2556 of 9120 2568 of 9120 2580 of 9120 2592 of 9120 2604 of 9120 2616 of 9120 2628 of 9120 2640 of 9120 2652 of 9120 2664 of 9120 2676 of 9120 2688 of 9120 2700 of 9120 2712 of 9120 2724 of 9120 2736 of 9120 2748 of 9120 2760 of 9120 2772 of 9120 2784 of 9120 2796 of 9120 2808 of 9120 2820 of 9120 2832 of 9120 2844 of 9120 2856 of 9120 2868 of 9120 2880 of 9120 2892 of 9120 2904 of 9120 2916 of 9120 2928 of 9120 2940 of 9120 2952 of 9120 2964 of 9120 2976 of 9120 2988 of 9120 3000 of 9120 3012 of 9120 3024 of 9120 3036 of 9120 3048 of 9120 3060 of 9120 3072 of 9120 3084 of 9120 3096 of 9120 3108 of 9120 3120 of 9120 3132 of 9120 3144 of 9120 3156 of 9120 3168 of 9120 3180 of 9120 3192 of 9120 3204 of 9120 3216 of 9120 3228 of 9120 3240 of 9120 3252 of 9120 3264 of 9120 3276 of 9120 3288 of 9120 3300 of 9120 3312 of 9120 3324 of 9120 3336 of 9120 3348 of 9120 3360 of 9120 3372 of 9120 3384 of 9120 3396 of 9120 3408 of 9120 3420 of 9120 3432 of 9120 3444 of 9120 3456 of 9120 3468 of 9120 3480 of 9120 3492 of 9120 3504 of 9120 3516 of 9120 3528 of 9120 3540 of 9120 3552 of 9120 3564 of 9120 3576 of 9120 3588 of 9120 3600 of 9120 3612 of 9120 3624 of 9120 3636 of 9120 3648 of 9120 3660 of 9120 3672 of 9120 3684 of 9120 3696 of 9120 3708 of 9120 3720 of 9120 3732 of 9120 3744 of 9120 3756 of 9120 3768 of 9120 3780 of 9120 3792 of 9120 3804 of 9120 3816 of 9120 3828 of 9120 3840 of 9120 3852 of 9120 3864 of 9120 3876 of 9120 3888 of 9120 3900 of 9120 3912 of 9120 3924 of 9120 3936 of 9120 3948 of 9120 3960 of 9120 3972 of 9120 3984 of 9120 3996 of 9120 4008 of 9120 4020 of 9120 4032 of 9120 4044 of 9120 4056 of 9120 4068 of 9120 4080 of 9120 4092 of 9120 4104 of 9120 4116 of 9120 4128 of 9120 4140 of 9120 4152 of 9120 4164 of 9120 4176 of 9120 4188 of 9120 4200 of 9120 4212 of 9120 4224 of 9120 4236 of 9120 4248 of 9120 4260 of 9120 4272 of 9120 4284 of 9120 4296 of 9120 4308 of 9120 4320 of 9120 4332 of 9120 4344 of 9120 4356 of 9120 4368 of 9120 4380 of 9120 4392 of 9120 4404 of 9120 4416 of 9120 4428 of 9120 4440 of 9120 4452 of 9120 4464 of 9120 4476 of 9120 4488 of 9120 4500 of 9120 4512 of 9120 4524 of 9120 4536 of 9120 4548 of 9120 4560 of 9120 4572 of 9120 4584 of 9120 4596 of 9120 4608 of 9120 4620 of 9120 4632 of 9120 4644 of 9120 4656 of 9120 4668 of 9120 4680 of 9120 4692 of 9120 4704 of 9120 4716 of 9120 4728 of 9120 4740 of 9120 4752 of 9120 4764 of 9120 4776 of 9120 4788 of 9120 4800 of 9120 4812 of 9120 4824 of 9120 4836 of 9120 4848 of 9120 4860 of 9120 4872 of 9120 4884 of 9120 4896 of 9120 4908 of 9120 4920 of 9120 4932 of 9120 4944 of 9120 4956 of 9120 4968 of 9120 4980 of 9120 4992 of 9120 5004 of 9120 5016 of 9120 5028 of 9120 5040 of 9120 5052 of 9120 5064 of 9120 5076 of 9120 5088 of 9120 5100 of 9120 5112 of 9120 5124 of 9120 5136 of 9120 5148 of 9120 5160 of 9120 5172 of 9120 5184 of 9120 5196 of 9120 5208 of 9120 5220 of 9120 5232 of 9120 5244 of 9120 5256 of 9120 5268 of 9120 5280 of 9120 5292 of 9120 5304 of 9120 5316 of 9120 5328 of 9120 5340 of 9120 5352 of 9120 5364 of 9120 5376 of 9120 5388 of 9120 5400 of 9120 5412 of 9120 5424 of 9120 5436 of 9120 5448 of 9120 5460 of 9120 5472 of 9120 5484 of 9120 5496 of 9120 5508 of 9120 5520 of 9120 5532 of 9120 5544 of 9120 5556 of 9120 5568 of 9120 5580 of 9120 5592 of 9120 5604 of 9120 5616 of 9120 5628 of 9120 5640 of 9120 5652 of 9120 5664 of 9120 5676 of 9120 5688 of 9120 5700 of 9120 5712 of 9120 5724 of 9120 5736 of 9120 5748 of 9120 5760 of 9120 5772 of 9120 5784 of 9120 5796 of 9120 5808 of 9120 5820 of 9120 5832 of 9120 5844 of 9120 5856 of 9120 5868 of 9120 5880 of 9120 5892 of 9120 5904 of 9120 5916 of 9120 5928 of 9120 5940 of 9120 5952 of 9120 5964 of 9120 5976 of 9120 5988 of 9120 6000 of 9120 6012 of 9120 6024 of 9120 6036 of 9120 6048 of 9120 6060 of 9120 6072 of 9120 6084 of 9120 6096 of 9120 6108 of 9120 6120 of 9120 6132 of 9120 6144 of 9120 6156 of 9120 6168 of 9120 6180 of 9120 6192 of 9120 6204 of 9120 6216 of 9120 6228 of 9120 6240 of 9120 6252 of 9120 6264 of 9120 6276 of 9120 6288 of 9120 6300 of 9120 6312 of 9120 6324 of 9120 6336 of 9120 6348 of 9120 6360 of 9120 6372 of 9120 6384 of 9120 6396 of 9120 6408 of 9120 6420 of 9120 6432 of 9120 6444 of 9120 6456 of 9120 6468 of 9120 6480 of 9120 6492 of 9120 6504 of 9120 6516 of 9120 6528 of 9120 6540 of 9120 6552 of 9120 6564 of 9120 6576 of 9120 6588 of 9120 6600 of 9120 6612 of 9120 6624 of 9120 6636 of 9120 6648 of 9120 6660 of 9120 6672 of 9120 6684 of 9120 6696 of 9120 6708 of 9120 6720 of 9120 6732 of 9120 6744 of 9120 6756 of 9120 6768 of 9120 6780 of 9120 6792 of 9120 6804 of 9120 6816 of 9120 6828 of 9120 6840 of 9120 6852 of 9120 6864 of 9120 6876 of 9120 6888 of 9120 6900 of 9120 6912 of 9120 6924 of 9120 6936 of 9120 6948 of 9120 6960 of 9120 6972 of 9120 6984 of 9120 6996 of 9120 7008 of 9120 7020 of 9120 7032 of 9120 7044 of 9120 7056 of 9120 7068 of 9120 7080 of 9120 7092 of 9120 7104 of 9120 7116 of 9120 7128 of 9120 7140 of 9120 7152 of 9120 7164 of 9120 7176 of 9120 7188 of 9120 7200 of 9120 7212 of 9120 7224 of 9120 7236 of 9120 7248 of 9120 7260 of 9120 7272 of 9120 7284 of 9120 7296 of 9120 7308 of 9120 7320 of 9120 7332 of 9120 7344 of 9120 7356 of 9120 7368 of 9120 7380 of 9120 7392 of 9120 7404 of 9120 7416 of 9120 7428 of 9120 7440 of 9120
7452 of 9120 7464 of 9120 7476 of 9120 7488 of 9120 7500 of 9120 7512 of 9120 7524 of 9120 7536 of 9120 7548 of 9120 7560 of 9120 7572 of 9120 7584 of 9120 7596 of 9120 7608 of 9120 7620 of 9120 7632 of 9120 7644 of 9120 7656 of 9120 7668 of 9120 7680 of 9120 7692 of 9120 7704 of 9120 7716 of 9120 7728 of 9120 7740 of 9120 7752 of 9120 7764 of 9120 7776 of 9120 7788 of 9120 7800 of 9120 7812 of 9120 7824 of 9120 7836 of 9120 7848 of 9120 7860 of 9120 7872 of 9120 7884 of 9120 7896 of 9120 7908 of 9120 7920 of 9120 7932 of 9120 7944 of 9120 7956 of 9120 7968 of 9120 7980 of 9120 7992 of 9120 8004 of 9120 8016 of 9120 8028 of 9120 8040 of 9120 8052 of 9120 8064 of 9120 8076 of 9120 8088 of 9120 8100 of 9120 8112 of 9120 8124 of 9120 8136 of 9120 8148 of 9120 8160 of 9120 8172 of 9120 8184 of 9120 8196 of 9120 8208 of 9120 8220 of 9120 8232 of 9120 8244 of 9120 8256 of 9120 8268 of 9120 8280 of 9120 8292 of 9120 8304 of 9120 8316 of 9120 8328 of 9120 8340 of 9120 8352 of 9120 8364 of 9120 8376 of 9120 8388 of 9120 8400 of 9120 8412 of 9120 8424 of 9120 8436 of 9120 8448 of 9120 8460 of 9120 8472 of 9120 8484 of 9120 8496 of 9120 8508 of 9120 8520 of 9120 8532 of 9120 8544 of 9120 8556 of 9120 8568 of 9120 8580 of 9120 8592 of 9120 8604 of 9120 8616 of 9120 8628 of 9120 8640 of 9120
Process ForkPoolWorker-68: Process ForkPoolWorker-78: Process ForkPoolWorker-75: Process ForkPoolWorker-76: Process ForkPoolWorker-73: Process ForkPoolWorker-72: Process ForkPoolWorker-74: Process ForkPoolWorker-69: Process ForkPoolWorker-70: Process ForkPoolWorker-71: Process ForkPoolWorker-79: Process ForkPoolWorker-77: Traceback (most recent call last): Traceback (most recent call last): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1002, in __setitem__ self._set_with_engine(key, value) Traceback (most recent call last): Traceback (most recent call last): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1033, in _set_with_engine loc = self.index._engine.get_loc(key) Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) Traceback (most recent call last): File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1002, in __setitem__ self._set_with_engine(key, value) File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) KeyError: 'curr_group' File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1002, in __setitem__ self._set_with_engine(key, value) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7742, in append return concat( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1033, in _set_with_engine loc = self.index._engine.get_loc(key) File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py", line 274, in concat op = _Concatenator( File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc During handling of the above exception, another exception occurred: File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7721, in append other.reindex(combined_columns, copy=False) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1033, in _set_with_engine loc = self.index._engine.get_loc(key) Traceback (most recent call last): File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py", line 362, in __init__ obj._consolidate(inplace=True) File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7721, in append other.reindex(combined_columns, copy=False) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5229, in _consolidate self._consolidate_inplace() File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7714, in append index = Index([other.name], name=self.index.name)
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5759, in infer_objects self._mgr.convert( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5211, in _consolidate_inplace self._protect_consolidate(f) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7721, in append other.reindex(combined_columns, copy=False) File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 605, in convert return self.apply( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5200, in _protect_consolidate result = f() File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 4399, in reindex return super().reindex(index=index, **kwargs) File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 406, in apply applied = getattr(b, f)(**kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 4444, in reindex if all( File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) KeyError: 'curr_group' File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 293, in __new__ from pandas.core.indexes.range import RangeIndex File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2417, in convert blocks = self.split_and_operate(None, f, False) File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5209, in f self._mgr = self._mgr.consolidate() File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7714, in append index = Index([other.name], name=self.index.name) File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 112, in add_volatility row['curr_group'] = curr_group File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 4445, in <genexpr> self._get_axis(axis).identical(ax) During handling of the above exception, another exception occurred: File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) KeyboardInterrupt File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 100, in add_volatility three_vol = price_df.iloc[i-2]['30D_volatility'] KeyError: 'curr_group' File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 430, in __new__ return Index(subarr, dtype=dtype, copy=copy, name=name, **kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1010, in __setitem__ self.loc[key] = value File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4282, in identical self.equals(other) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7742, in append return concat( During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 879, in __getitem__ return self._getitem_axis(maybe_callable, axis=axis) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 974, in consolidate bm._consolidate_inplace() File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 670, in __setitem__ iloc._setitem_with_indexer(indexer, value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4261, in equals if isinstance(other, ABCMultiIndex): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 399, in __new__ return cls( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py", line 274, in concat op = _Concatenator( File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1498, in _getitem_axis return self.obj._ixs(key, axis=axis) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1010, in __setitem__ self.loc[key] = value File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1626, in _setitem_with_indexer self._setitem_with_indexer_missing(indexer, value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py", line 444, in __init__ self.axis = 1 - self.bm_axis if self._is_frame else 0 File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 112, in add_volatility row['curr_group'] = curr_group File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 457, in split_and_operate nv = f(m, v, i) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 317, in __new__ elif is_categorical_dtype(data_dtype) or is_categorical_dtype(dtype): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 2829, in _ixs new_values = self._mgr.fast_xs(i) Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2719, in make_block return klass(values, ndim=ndim, placement=placement) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5759, in infer_objects self._mgr.convert( File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2402, in f values = soft_convert_objects( KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 979, in _consolidate_inplace self.blocks = tuple(_consolidate(self.blocks)) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 948, in fast_xs result = np.empty(n, dtype=dtype) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 563, in is_categorical_dtype return CategoricalDtype.is_dtype(arr_or_dtype) File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 605, in convert return self.apply( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/generic.py", line 12, in _check return getattr(inst, attr, "_typ") in comp
File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/base.py", line 282, in is_dtype if isinstance(dtype, (ABCSeries, ABCIndexClass, ABCDataFrame, np.dtype)): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 1899, in _consolidate merged_blocks = _merge_blocks( KeyboardInterrupt File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 1928, in _merge_blocks return [make_block(new_values, placement=new_mgr_locs)] File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/generic.py", line 10, in _check @classmethod # type: ignore File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 112, in add_volatility row['curr_group'] = curr_group File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 406, in apply applied = getattr(b, f)(**kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1098, in soft_convert_objects if timedelta and is_object_dtype(values.dtype): File "<ipython-input-1-fadaa020da34>", line 106, in get_stats price_df = add_volatility(price_df, days=vol_day, gaussian=gaussian) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2046, in __init__ values = self._maybe_coerce_values(values) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 670, in __setitem__ iloc._setitem_with_indexer(indexer, value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2417, in convert blocks = self.split_and_operate(None, f, False) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1626, in _setitem_with_indexer self._setitem_with_indexer_missing(indexer, value) File "/home/warproxxx/Desktop/Projects/new_algo/altcoin/backtest.py", line 113, in add_volatility new_price_df = new_price_df.append(row, ignore_index=True) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 457, in split_and_operate nv = f(m, v, i) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 1010, in __setitem__ self.loc[key] = value File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 194, in is_object_dtype def is_object_dtype(arr_or_dtype) -> bool: File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2053, in _maybe_coerce_values def _maybe_coerce_values(self, values): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1824, in _setitem_with_indexer_missing new_indexer = index.get_indexer([new_index[-1]]) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2402, in f values = soft_convert_objects( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 7721, in append other.reindex(combined_columns, copy=False) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2965, in get_indexer if target.is_boolean() and self.is_numeric(): KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 4399, in reindex return super().reindex(index=index, **kwargs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1815, in _setitem_with_indexer_missing new_index = index.insert(len(index), indexer) KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 670, in __setitem__ iloc._setitem_with_indexer(indexer, value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 4458, in reindex return self._reindex_axes( KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1626, in _setitem_with_indexer self._setitem_with_indexer_missing(indexer, value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1068, in soft_convert_objects if not is_object_dtype(values.dtype): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 4478, in _reindex_axes obj = obj._reindex_with_indexers( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1834, in _setitem_with_indexer_missing self.obj._mgr = self.obj._constructor( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 221, in is_object_dtype return _is_dtype_type(arr_or_dtype, classes(np.object_)) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 4521, in _reindex_with_indexers new_data = new_data.reindex_indexer( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 1619, in _is_dtype_type return condition(arr_or_dtype.type) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/series.py", line 327, in __init__ data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 1282, in reindex_indexer new_blocks = self._slice_take_blocks_ax0(indexer, fill_value=fill_value) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 180, in <lambda> return lambda tipo: issubclass(tipo, klasses) KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 1349, in _slice_take_blocks_ax0 blk.take_nd( File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 5249, in insert item = self._coerce_scalar_to_index(item)._values KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 1267, in take_nd return self.make_block_same_class(new_values, new_mgr_locs) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/construction.py", line 513, in sanitize_array inferred = lib.infer_dtype(subarr, skipna=False) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 261, in make_block_same_class return type(self)(values, placement=placement, ndim=ndim) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3991, in _coerce_scalar_to_index return Index([item], dtype=dtype, **self._get_attributes_dict()) File "pandas/_libs/lib.pyx", line 1341, in pandas._libs.lib.infer_dtype File "pandas/_libs/lib.pyx", line 1199, in pandas._libs.lib._try_infer_map File "/home/warproxxx/.local/lib/python3.8/site-packages/numpy/core/_dtype.py", line 321, in _name_get def _name_get(dtype): KeyboardInterrupt File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/internals/blocks.py", line 2375, in __init__ super().__init__(values, ndim=ndim, placement=placement) File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 330, in __new__ elif is_datetime64_any_dtype(data_dtype) or is_datetime64_any_dtype(dtype): File "/home/warproxxx/.local/lib/python3.8/site-packages/pandas/core/dtypes/common.py", line 940, in is_datetime64_any_dtype return arr_or_dtype.kind == "M"
KeyboardInterrupt KeyboardInterrupt
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) /usr/lib/python3.8/multiprocessing/pool.py in next(self, timeout) 850 try: --> 851 item = self._items.popleft() 852 except IndexError: IndexError: pop from an empty deque During handling of the above exception, another exception occurred: KeyboardInterrupt Traceback (most recent call last) <ipython-input-9-f1d43ac2739f> in <module> ----> 1 pm.perform_grid_search() <ipython-input-1-fadaa020da34> in perform_grid_search(self) 138 selected = all_combinations[i-at_once: i] 139 --> 140 for ser in p.imap_unordered(partial(self.get_stats, threshold), selected): 141 results = results.append(pd.Series(ser), ignore_index=True) 142 /usr/lib/python3.8/multiprocessing/pool.py in next(self, timeout) 854 self._pool = None 855 raise StopIteration from None --> 856 self._cond.wait(timeout) 857 try: 858 item = self._items.popleft() /usr/lib/python3.8/threading.py in wait(self, timeout) 300 try: # restore state no matter what (e.g., KeyboardInterrupt) 301 if timeout is None: --> 302 waiter.acquire() 303 gotit = True 304 else: KeyboardInterrupt:
Process ForkPoolWorker-81: Process ForkPoolWorker-86: Process ForkPoolWorker-90: Process ForkPoolWorker-88: Process ForkPoolWorker-91: Process ForkPoolWorker-87: Process ForkPoolWorker-80: Process ForkPoolWorker-83: Process ForkPoolWorker-89: Process ForkPoolWorker-84: Process ForkPoolWorker-85: Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() Traceback (most recent call last): Process ForkPoolWorker-82: File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs)
xxxxxxxxxx
test_set = pm.get_test_portfolio()
x
mean_ret = (((test_set.iloc[-1] - test_set.iloc[0])/test_set.iloc[0]) * 100).mean()
print(mean_ret)