Open apovall opened 5 years ago
For Bitfinex you can realize that with if(pair['info']['expiration'] != 'NA') -> kick pair out of the universe
When you rebalance in short intervals.
But when I remember right, binance does not have a field like this.
Hi there,
Currently running latest 0.5.21 version of catalyst and libraries that come with that install (via pip).
aiodns 1.1.1 aiohttp 3.4.4 alabaster 0.7.12 alembic 0.9.7 appnope 0.1.0 asn1crypto 0.24.0 async-timeout 3.0.1 attrdict 2.0.0 attrs 18.2.0 autobahn 18.11.1 Automat 0.7.0 Babel 2.6.0 backcall 0.1.0 bcolz 1.2.1 boto3 1.5.27 botocore 1.8.50 Bottleneck 1.2.1 cchardet 2.1.1 ccxt 1.17.94 certifi 2018.1.18 cffi 1.11.5 chardet 3.0.4 click 6.7 ConfigSpace 0.4.7 constantly 15.1.0 contextlib2 0.5.5 cryptography 2.4.1 cycler 0.10.0 cyordereddict 1.0.0 Cython 0.27.3 cytoolz 0.9.0.1 dateparser 0.7.0 decorator 4.3.0 docutils 0.14 empyrical 0.2.1 enigma-catalyst 0.5.21 eth-abi 1.2.2 eth-account 0.2.3 eth-hash 0.2.0 eth-keyfile 0.5.1 eth-keys 0.2.0b3 eth-rlp 0.1.2 eth-typing 1.3.0 eth-utils 1.2.2 hexbytes 0.1.0 hyperlink 18.0.0 idna 2.7 idna-ssl 1.1.0 imagesize 1.1.0 incremental 17.5.0 intervaltree 2.1.0 ipykernel 5.1.0 ipython 7.1.1 ipython-genutils 0.2.0 jedi 0.13.1 Jinja2 2.10 jmespath 0.9.3 joblib 0.13.0 jupyter-client 5.2.3 jupyter-core 4.4.0 kiwisolver 1.0.1 Logbook 0.12.5 lru-dict 1.1.6 lxml 4.2.5 Mako 1.0.7 MarkupSafe 1.0 matplotlib 3.0.2 multidict 4.4.2 multipledispatch 0.4.9 networkx 2.1 numexpr 2.6.4 numpy 1.14.0 packaging 18.0 pandas 0.19.2 pandas-datareader 0.6.0 parsimonious 0.8.1 parso 0.3.1 patsy 0.5.0 pexpect 4.6.0 pickleshare 0.7.5 pip 10.0.1 prompt-toolkit 2.0.7 psutil 5.4.8 ptyprocess 0.6.0 pyasn1 0.4.4 pyasn1-modules 0.2.2 pycares 2.3.0 pycparser 2.19 pycryptodome 3.7.0 Pygments 2.2.0 PyHamcrest 1.9.0 pynisher 0.5.0 pyOpenSSL 18.0.0 pyparsing 2.3.0 pyrfr 0.8.0 python-binance 0.7.0 python-dateutil 2.7.3 python-editor 1.0.3 pytz 2016.4 pyzmq 17.1.2 redo 2.0.1 regex 2018.11.7 requests 2.20.1 requests-file 1.4.3 requests-ftp 0.3.1 requests-toolbelt 0.8.0 rlp 1.0.3 s3transfer 0.1.13 scikit-learn 0.20.0 scipy 1.0.0 service-identity 17.0.0 setuptools 38.5.1 six 1.11.0 smac 0.8.0 snowballstemmer 1.2.1 sortedcontainers 1.5.9 Sphinx 1.8.2 sphinx-rtd-theme 0.4.2 sphinxcontrib-websupport 1.1.0 SQLAlchemy 1.2.2 statsmodels 0.8.0 TA-Lib 0.4.17 tables 3.4.2 toolz 0.9.0 tornado 5.1.1 traitlets 4.3.2 Twisted 18.9.0 txaio 18.8.1 typing 3.6.6 tzlocal 1.5.1 urllib3 1.24.1 wcwidth 0.1.7 web3 4.4.1 websockets 5.0.1 wrapt 1.10.11 yarl 1.1.0 zope.interface 4.6.0
Description of Issue
Currently running a simple momentum backtest (6 day lookback, 3 day refresh interval), on a universe of assets on Binance. Am testing with all available quote currencies (ETH, BTC, BNB, USDT), running each as a separate instance / separate namespace (I am NOT combining all quote pairs (e.g. ada_eth, ada_btc etc) into a single universe).
Everything works fine, but found that holding any assets over the period during which they are delisted from the exchange causes the Portofolio Value to become 'nan'. (E.g. buy an asset on say 2018-10-19 (like icn, chat, trig), it becomes delisted while you're holding, then you can't sell it and PV breaks).
I'm guessing it's best that these assets which become delisted are included (and back tested with) to avoid survivorship bias, but how is it best to actually deal with them in the context of a trading / backtesting algorithm? Having PV going to 'nan' (which it seems is further related to 'returns' going to nan as well) breaks all the back testing metrics.
Here's the full error message I get:
RuntimeWarning Traceback (most recent call last)