chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5k stars 1.09k forks source link

Stuck on Failed to load account information, Margin accountType #568

Open jorisvansoest opened 1 year ago

jorisvansoest commented 1 year ago

Version

v0.0.95+, and latest

Description

The bot is stuck on Failed to load you account information, since this change #544. After looking at the code I think this has to do with my accountType which is MARGIN instead of SPOT.

To Reproduce

  1. Start bot
  2. See error

Expected Behaviours

Although my accountype is MARGIN, I expect to be able to use the bot as before.

Screenshots

.

Additional context

accountInfo
​
accountType: "MARGIN"
​balances: Array(6) [ {…}, {…}, {…}, … ]
​brokered: false
​buyerCommission: 0
​canDeposit: true
​canTrade: true
​canWithdraw: true
​commissionRates: Object { maker: "0.00100000", taker: "0.00100000", buyer: "0.00000000", … }
​makerCommission: 10
​permissions: Array [ "SPOT" ]
​requireSelfTradePrevention: false
​sellerCommission: 0
​takerCommission: 10
​updateTime: 1667700005975

Maybe check for permission instead of accountType?

I've also tried to find an option at Binance to change my accounttype, but haven't found it.

uhliksk commented 1 year ago

@chrisleekr I think it would be nice to use the bot on margin trading.

jorisvansoest commented 1 year ago

I got this working for myself by changing https://github.com/chrisleekr/binance-trading-bot/blob/45914a53c5e0d2507ee2158da5c8b4a16539d9b7/public/js/App.js#L276 into: return isLoaded === true && _.get(accountInfo, 'permissions').includes('SPOT');

To be clear on the issue, I'm not interested in margin trading. It happens to be that my account type is margin. I think it is better to check for permissions in this case - as that is the check that we want to do (right?).

chrisleekr commented 1 year ago

Interesting. So even if your account type is "MARGIN", you still can trade "SPOT"?

I will update the code to check permission, not accountType.

Or @jorisvansoest, you can open a new PR as I will be very slow. :)

@uhliksk I won't support the margin trading as I don't know much about it.

jorisvansoest commented 1 year ago

Interesting. So even if your account type is "MARGIN", you still can trade "SPOT"?

Correct. I've never traded margin though, and not planning to do so.

I will update the code to check permission, not accountType.

Or @jorisvansoest, you can open a new PR as I will be very slow. :)

I've never created a pull request before, so I'll wait :) I got my local changes so I can continue working with the bot.

eppenga commented 1 year ago

I can confirm I was also locked out after Binance changed their policy to have whitelisted IP addresses. I then added my IP address to Binance as a whitelisted IP address. The bot then also locked me out, I used @jorisvansoest fix and it works again now.