DaScient / SuperTrendTradingBot

A DaScient Capital proprietary project & fully autonomous application of robust technical indicators against publicly traded market data & cryptocurrency blockchain exchange platforms - using python.
https://www.kaggle.com/code/dascient/daily-crypto-buy-sell-decision-maker
MIT License
21 stars 12 forks source link

[ Help ]The BinanceBot Exception : ValueError: 0 is not in range #3

Closed honsaun closed 1 year ago

honsaun commented 1 year ago

python3 binance_bot.py Input a name: OPTIMUS Insert ticker: OPTIMUS Enter denomination (examples: USD, USDT, BUSD, BTC): USDT Candlestick intervals (1m,5m,15m,30m,1h,2h,6h,1d): 1m Order size in OPTIMUS: 300 Already in desired holding position? - True/False: False Min gain: %3 Loading... Please allow for 1m until initial results are printed.

~## ┌( ಠ_ಠ)┘ ##~

2023-04-15T00:35:10.810584+08:00 Generating market indications for OPTIMUS.

Calculating OPTIMUS/USDT data... timestamp volume in_uptrend 146 2023-04-14 16:32:00-07:00 80.00 False 147 2023-04-14 16:33:00-07:00 0.00 False 148 2023-04-14 16:34:00-07:00 18.01 False

Open: 0.5176 Max low: 0.5331279999999999 High: 0.5176 Minimum sell price: 0.5176 Low: 0.5162 Timeframe: 1m Close: 0.5162 Safe sell: False Mini-timeframe uptrend identified - buying signal: True

Mini-timeframe downtrend identified - selling signal: False Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/range.py", line 345, in get_loc return self._range.index(new_key) ValueError: 0 is not in range

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/lighthouse/mexcSuperTrend/binance_bot.py", line 401, in schedule.run_pending() File "/usr/local/lib/python3.10/dist-packages/schedule/init.py", line 822, in run_pending default_scheduler.run_pending() File "/usr/local/lib/python3.10/dist-packages/schedule/init.py", line 100, in run_pending self._run_job(job) File "/usr/local/lib/python3.10/dist-packages/schedule/init.py", line 172, in _run_job ret = job.run() File "/usr/local/lib/python3.10/dist-packages/schedule/init.py", line 693, in run ret = self.job_func() File "/home/lighthouse/mexcSuperTrend/binance_bot.py", line 387, in run_bot bal = bal[bal['asset']==ticker[:4].replace('/','')].reset_index(drop = True).free[0] File "/usr/local/lib/python3.10/dist-packages/pandas/core/series.py", line 1012, in getitem return self._get_value(key) File "/usr/local/lib/python3.10/dist-packages/pandas/core/series.py", line 1121, in _get_value loc = self.index.get_loc(label) File "/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/range.py", line 347, in get_loc raise KeyError(key) from err KeyError: 0

How can i fix it ? sir

DaScient commented 1 year ago

Binance recently updated three endpoints on the Binance.US API Documentation portal that allow API traders to convert small balances and crypto dust.Binance.US previously supported conversions of small balances and crypto dust with a value under $20 into BTC. This update expands this feature to include Bitcoin (BTC), Ethereum (ETH), and USD. The updated endpoints include:

updated three endpoints on the Binance.US API Documentation portal that allow API traders to convert small balances and crypto dust.

Binance.US previously supported conversions of small balances and crypto dust with a value under $20 into BTC. This update expands this feature to include Bitcoin (BTC), Ethereum (ETH), and USD. The updated endpoints include: Convert Dust: Use this endpoint to convert dust to one of the four available assets. Get Convert Dust History: Use this endpoint to get dust conversion history. Get Assets That Can Be Converted: Use this endpoint to get your dust assets that can be converted to any of the four available assets. See the full changelog here.

Also, see our note regarding their API updates. Due to Binance US having made some important API changes. Certain consequences may impact this notebook's ability to query historical transaction data for USD trading pairs, including trades and orders, that were executed before our system upgrade on February 5, 2023 at 9 p.m. PST / midnight EST.

To query transaction information for historical trades and orders, involving USD trading pairs, executed before the planned system upgrade, we will need to begin using the USD4 symbol. For example: "BTCUSD4". To query transaction information for trades and orders, involving USD trading pairs, executed after the planned system upgrade, we would need to continue using the USD symbol. For example: “BTCUSD”.

Kaggle Notebook

Thank you for raising this concern. Will update soon enough.

DaScient commented 1 year ago

Please raise again if this does not provide your solution.