Hey everyone !,
I’ve been working on a Binance trading bot in Python, but I’ve hit a couple of persistent errors that I can’t seem to resolve. The bot is designed to trade BTC/USDT based on signals generated by some basic TA indicators. However, I’m running into the following issues:
-
“List Index Out of Range” Error: This error usually occurs when the bot tries to place an order after detecting a buy/sell signal. I suspect it might be related to how I’m handling the order response or processing positions, but I’m not entirely sure.
-
“Precision Maths Ain’t Happening” Error: This seems to be related to the precision when placing orders. I’ve tried using
round()
to manage precision, but it hasn’t resolved the issue.
Here’s a snippet of the main part of the code:
# Code snippet goes here (you can include the key parts where errors are happening)
Errors encountered:
Pamela, Found Sell signal for BTCUSDT
Pamela, Placing order for BTCUSDT
An unexpected error occurred: list index out of range
Error: Precision maths aint happening.
Waiting 60 seconds...
What I’ve Tried:
- Double-checking the precision calculation for quantities and prices.
- Using
round()
and other methods to handle precision. - Adding debug prints to trace where things go wrong.
Questions:
- Has anyone encountered these types of errors before when working with the Binance API?
- Could this be related to how I’m fetching and processing the exchange info for precision?
- Are there any better ways to structure the bot’s logic to avoid these issues?
Any help or insights would be greatly appreciated! I’m happy to provide more details if needed.
Thanks in advance!
Additional Context:
I’m using the ta
library for technical analysis, pandas
for data handling, and binance-python
for the API client. The bot is supposed to operate with leverage and place limit and OCO orders.
EDIT: Here’s the full code: [Pastebin link or GitHub Gist].
Feel free to post this on a relevant
subreddit like r/algorithmictrading or r/cryptoprogramming where developers familiar with trading bots and the Binance API might be able to offer assistance.