Closed Sekharonline4u closed 11 months ago
I have used the following link code: https://github.com/ccxt/ccxt/blob/master/examples/py/binance-futures-margin.py as reference
I'll take a look into this soon
what error did you get? please paste it.
also, please mention which market do you want to trade, spot>margin
or swap
("binance futures") ?
in case you want to trade futures, then you have to use ETH/USDT:USDT
(not ETH/USDT
) because CCXT uses https://docs.ccxt.com/#/README?id=contract-naming-conventions symbol names for derivtives.
so, you might have several issues: 1) you have used:
fapiPrivate_post_positionmargin
, but you should have used fapi_private_post_position_margin
2) you have passed symbol ETH/USDT
to raw non-unified method, which is not what exchange might expect. (as opposed to createOrder
which is unified method and expects unified symbol).
3) I advise you used native CCXT method for adding / removing margin with exchange.add_margin ('ETH/USDT:USDT', 1.2345);
. similarly, ccxt has .remove_margin
method.
4) in case you meant spot>margin
trading, then you should just use .transfer
method to transfer from spot
to isolated
account. you can look through a full example file named "margin-loan-borrow" in folder https://github.com/ccxt/ccxt/tree/master/examples
let us know if that does not solve your issue.
Thanks for your Update and quick response, just checked my code with fapiPrivate_post_positionmargin and fapi_private_post_position_margin for these two methods am getting the following error: ### response = exchange.fapi_private_post_position_margin( AttributeError: 'binance' object has no attribute 'fapi_private_post_position_margin' but the native CCXT method which you have referred exchange.add_margin ('ETH/USDT:USDT', 1.2345); or if i use this way too exchange.add_margin ('ETH/USDT', 1.2345);is working like charm Thanks a ton
Operating System
Mac OS
Programming Languages
Python
CCXT Version
CCXT Version: 4.0.65
Description
I was trying to create a Market Buy Order for Isolated Trade and Trying to Add the Margin Amount for handling the Liquidation , while executing the below code am getting the error response = exchange.fapiPrivate_post_positionmargin( AttributeError: 'binance' object has no attribute 'fapiPrivate_post_positionmargin' how to resolve this error. I know there is a API available at binance ""/fapi/v1/positionMargin" if i use the API directly with the support of requests it is working but when i use CCXT and the method fapiPrivate_post_positionmargin mentioned in documentation it is not working. Kindly advise
Code