How do I get Margin wallet balance from 'python-binance' library ?

I think I moved to next step. I’m getting used to spot orders. But now working on getting used to margin trading.

So I was using ‘python-binance’ library but there isn’t any specifically described about margin trading like spot trading. Can anyone guide me how could I use ‘python-binance’ for margin trading.
Here’s the link of documentation of 'python-binance’library :

From the document, this is the method to place an margin order:

And this endpoint should be triggered to place the order:

Hope this will be helpful.

That’s just a limit order, can’t I place OCO. And there isn’t any option to retrieve margin wallet balance of specific coin. And one more thing is, can’t I ‘borrow funds’ at the time of order execution or I’ve to do it separately ?

Margin OCO is not support from API yet.
it’s only allowed to get one symbol balance for isolated margin, for cross margin, it only returns all assets.
You can borrow during placing margin order, sideEffectType=MARGIN_BUY


To stream isolated_margin userData you can use:

ubwa_com_im = BinanceWebSocketApiManager(exchange="")

user_stream_id = ubwa_com_im.create_stream('arr', '!userData',  api_key=api_key, api_secret=api_secret, symbol="trxbtc")

Try it with the example file:

1 Like