I have the Following Problem:
- I dont know the Pairs being Traded by the User
- I want to let him know when a Trade has been executed
- The Trades are done directly from Binance App
So the Problem is the lack of knowledge of the pairs traded.
I have read something about the outboundAccountPosition which should return the account balance when something changed.
And I have read about the executionReport which needs a symbol to be specified or a pair for the socket to return the data.
So I have coded a litle bit and came out with this solution which would theoreticaly work.
The Problen here is, I have made an example code with 3 currencies. And i would need to extend this to the over 300 remaining currencies.
Is there a bether way to do that?
I leave my code here:
I dont think its going to display it correctly so i put a start and end.
Its a python code.
BTC = "BTC" BNB = "BNB" LTC = "LTC" BTC_before = 1 BNB_before = 1 LTC_before = 3 BTC_after = 1.3 BNB_after = 1 LTC_after = 0 BTC_change = bool(False) BNB_change = bool(False) LTC_change = bool(False) ticker =  if BTC_before==BTC_after: BTC_change = bool(False) else: BTC_change = bool(True) if BNB_before==BNB_after: BNB_change = bool(False) else: BNB_change = bool(True) if LTC_before==LTC_after: LTC_change = bool(False) else: LTC_change = bool(True) ticker.clear() if BTC_change: ticker.append(BTC) if BNB_change: ticker.append(BNB) if LTC_change: ticker.append(LTC) option_a = ticker + "/" + ticker option_b = ticker + "/" + ticker print("Ticker Symbols:") print(ticker) print("--------------") print("Options:") print(option_a) print(option_b)
As I understand the outboundAccountPosition would send the Account Balances once they change. So if for example i make a trade ltc/btc and i sell my litecoins for bitcoins, this should give me a new balance data back. If i then compare this with the old balance i should get onlz 2 coins that changed. Thanks to that, i can write these 2 options into a variable (in this case option_a and option_b) and then would oly have 2 sockets to check for data. I think this could save a lot of time.
I dont know 2 things:
- if this would work eith giving a variable to the socket instead of a string
- if my code can be improved (because adding this first part of code, for all the 300 coins and then we would also need to manage this like if binance delists a coin we need to remove it from the code and if binance lists a new one we need to add it to the code thats a lot of work and not really managable.
I hope someone can help me with this.
I want to thank you already in advance