-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example scripts error #68
Comments
Interesting, I will look into this. This is a dependency problem inside the metrics library that we use. We haven't tested the code on an Anaconda distribution so if I were to guess it might be an issue building the extension modules that tuliply requires. I will test it out and respond asap. I believe that the Binance library we use might also have issues with Anaconda. Thanks for opening an issue! |
Thanks for the reply. Unfortunately, the standalone virtual environment on python 3.9 (pip install blankly) throws the same errors |
Interesting, are there any errors with the install or does it run smoothly (besides version conflicts)? |
The pip log looks clean both in venv and anaconda |
Ah so I figured it out. The Binance sandbox deletes their historical data at the beginning of the month. There is only 15 hours of data inside the sandbox exchange which won't work with price events at a day resolution. We use data keys inside our tests to get around this issue (read only no trade on the live exchange). You're just getting really unlucky - I would recommend creating low permission live keys for binance data. |
Thank you. The mentioned errors in rsi.py and mlp_model.py are gone when I use a standard Binance account. But bot.py error is still present. Also when I use rsi.py and mlp_model.py the metrics returns a lot of nan's and zeros (associated output and error/warning below) No cached data found for BTC-USDT from: 1635897059 to 1635897125 at a resolution of 60 seconds.
Initializing...
Backtesting...
Progress: [##########] 98.81% /home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/metrics/portfolio.py:31: RuntimeWarning: divide by zero encountered in double_scalars
return (end_value / start_value) ** (1 / years) - 1
/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/metrics/portfolio.py:68: RuntimeWarning: Degrees of freedom <= 0 for slice.
return np.nanvar(returns) * np.sqrt(n) if n else np.nanvar(returns)
Historical Dataframes:
Account History:
USDT BTC time Account Value (USDT)
0 100.00000 0.0000 1.635835e+09 100.000000
1 0.56640 0.0016 1.635835e+09 99.382400
2 0.56640 0.0016 1.635835e+09 99.316912
3 0.56640 0.0016 1.635835e+09 99.385776
4 0.56640 0.0016 1.635835e+09 99.282112
... ... ... ... ...
1032 612.02581 0.0000 1.635897e+09 612.025810
1033 612.02581 0.0000 1.635897e+09 612.025810
1034 612.02581 0.0000 1.635897e+09 612.025810
1035 612.02581 0.0000 1.635897e+09 612.025810
1036 612.02581 0.0000 1.635897e+09 612.025810
[1037 rows x 4 columns]
Account Returns:
time value
0 1.635835e+09 NaN
Resampled Account Value:
time value
0 1.635835e+09 100.0
Blankly Metrics:
Compound Annual Growth Rate (%): 0.0%
Cumulative Returns (%): 0.0%
Max Drawdown (%): nan%
Variance (%): nan%
Sortino Ratio: nan
Sharpe Ratio: nan
Calmar Ratio: nan
Volatility: nan
Value-at-Risk: nan
Conditional Value-at-Risk: nan |
Yes these should both be easy fixes! We cache the prices to avoid slow downloads, the empty sandbox data is inside the cache right now, so try deleting the For the metrics, did you switch the I'm going to improve the |
Cleaning cache folders helped - all errors are gone. Thank you very much for your advice. The library looks great and I hope I'll use it in near future to test my models. Regarding Traceback (most recent call last):
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py", line 306, in get_account
return trade_local.get_account(symbol)
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/exchanges/interfaces/paper_trade/local_account/trade_local.py", line 125, in get_account
return copy.deepcopy(utils.AttributeDict(local_account.account[asset_id]))
KeyError: 'USD'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jakub/PycharmProjects/bot/blankly/rsi.py", line 39, in <module>
results = strategy.backtest(to='1y', initial_values={'USDT': 10000})
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/frameworks/strategy/strategy_base.py", line 495, in backtest
results = self.backtesting_controller.run()
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/exchanges/interfaces/paper_trade/backtest_controller.py", line 637, in run
available_dict, no_trade_dict = self.format_account_data(self.initial_time)
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/exchanges/interfaces/paper_trade/backtest_controller.py", line 448, in format_account_data
true_account[i] = self.interface.get_account(i)
File "/home/jakub/PycharmProjects/bot/venv/lib/python3.8/site-packages/blankly/exchanges/interfaces/paper_trade/paper_trade_interface.py", line 309, in get_account
raise KeyError("Symbol not found. This can be caused by an invalid quote currency "
KeyError: 'Symbol not found. This can be caused by an invalid quote currency in backtest.json.' |
Description
As in the title. Provided examples throw errors during execution
Tested files: bot.py (generated by 'blankly init' command), examples/rsi.py, examples/mlp_model.py
settings.json
backtest.json
Error
rsi.py
mlp_model.py
bot.py
Platform Info
Additional context
Library installed as proposed in https://github.com/Blankly-Finance/Blankly#quickstart
All example scripts and json files were modified to use sandbox account and API for Binance, also USD was changed to USDT in symbols and portfolio.
The text was updated successfully, but these errors were encountered: