question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set leverage in Binance future??

See original GitHub issue

MUST READ THIS BEFORE SUBMITTING ISSUES (read the links, then delete this message before submitting):

Make sure your local version of CCXT is up to date. Check by comparing the output of ccxt.version to https://github.com/ccxt/ccxt/blob/master/package.json#L3

  • OS: Window10
  • Programming Language version: python 3.9.7
  • CCXT version: 1.55.28

I tried to set leverage of binance future trade using the code below

self.lever = self.binance.set_leverage(leverage=2, symbol='DOGE/USDT')

but what i got is…

ccxt.base.errors.NotSupported: binance setLeverage() supports linear and inverse contracts only

So i found that when i load markets and check values corresponding to ‘DOGE/USDT’, and I saw that linear and inverse attribute are false. How can turn value of linear into true?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AxelGUILLAUMETcommented, Sep 12, 2021

@AxelGUILLAUMET

ccxt.base.errors.ExchangeError: binanceusdm {“code”:-4046,“msg”:“No need to change margin type.”}

That error means that the margin mode for ADA/USDT is already set to ISOLATED.

OK, but when the code follows and place the order, unfortunately the leverage I choosed before is not respected, the order appears in binance with another leverage value. When I change the leverage manually, appears this popup to confirm the change of leverage:

image

Is with the API this popup should appear?

Now look at the previous code, the leverage I should have is x2.

image

And I have x5.

Aparently the leverage type selection worked because I changed it to CROSSED and it applied.

UPDATE:

When I close the tab of the actual pair, and I RE-OPEN it, the changes I sended with the API are APPLIED.

It looks like to work just 50/50, but the changes NOT take effect immediatly, like a “refresh” instruction is missing, and obviously when I do the createOrder, it applies with the wrong leverage.

image

0reactions
kroitorcommented, Sep 12, 2021

@AxelGUILLAUMET

ccxt.base.errors.ExchangeError: binanceusdm {“code”:-4046,“msg”:“No need to change margin type.”}

That error means that the margin mode for ADA/USDT is already set to ISOLATED.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Adjust Contract Leverage - Binance
1. To adjust your leverage, click on the [20x] icon on your futures trading interface. · 2. Next, you will see the Adjust...
Read more >
Leverage & Margin of Futures Contracts - Binance
Leverage levels and margin ratios of futures contracts on Binance: position sizes allowed at different leverage levels, initial margin and maintenance ...
Read more >
Leverage and Margin of USDS-M Futures - Binance
Effective July 27, 2021, Binance Futures set leverage limits for users who registered their futures accounts in less than 60 days. The following ......
Read more >
What Is Leverage in Crypto Trading? - Binance Academy
1. Go to [Trade] - [Margin] from the top navigation bar. · 2. Click on [BTC/USDT] to search for the pair you want...
Read more >
Your Guide to Position Limit Adjustment | Binance Support
You can adjust it in [Preference] - [Position Limit Enlarge]. Alternatively, you can access it via [Leverage] - [Adjust Margin] - [Position ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found