Coder Social home page Coder Social logo

Comments (6)

sc0Vu avatar sc0Vu commented on June 17, 2024

@BingBong1234567898765321 I think you can use this symbol instead BTC/USDT:USDT.

from ccxt.

BingBong1234567898765321 avatar BingBong1234567898765321 commented on June 17, 2024

@BingBong1234567898765321 I think you can use this symbol instead BTC/USDT:USDT.

Hi @sc0Vu, BTC/USDT:USDT is the symbol I am using, I just mentioned BTCUSDT in the question for simplicity. I am attempting to switch from BTC/USD:USD to BTC/USDT:USDT

from ccxt.

ttodua avatar ttodua commented on June 17, 2024

@BingBong1234567898765321 have you tried set_margin_mode to 'cross' or 'isolated' to see if that has any effect? or set_position_mode with true (means hedged) or false (means one-way)

from ccxt.

BingBong1234567898765321 avatar BingBong1234567898765321 commented on June 17, 2024

@ttodua when I run:

exchange.set_margin_mode("cross", symbol = symbol)
#Note, "symbol" is predefined as "BTC/USDT:USDT"
I get this error:
Error: phemex setMarginMode() supports swap(non USDT based) contracts only

When I run:

exchange.set_position_mode(False, symbol = symbol)
It progresses further than I've been so far, so thank you! But when it gets to the section to create the limit order (code outlined above), I get this error:
Error: phemex {"code":11058,"msg":"TE_QTY_TOO_SMALL","data":null}

Is the contract size (amount) calculated differently for USDT contracts vs. USD? With the code I have above:
new_order_contract_size = round(((((usd_balance * percent_of_holdings_to_enter) * leverage) / new_order_price)*1000),1)
this code works properly for USD but seems to be giving the QTY_TOO_SMALL error with USDT. For example, my available balance being multiplied by .95 (because 100% does not allow enough room for fees) and then multiplied by leverage (ex. 20), divided by the price to place limit order at, times 1000 (I think because USD contracts are in Ep), and then rounded to the first decimal.

#Note, I have tried multiplying by 1000, 10000, and 100000 and they all get the same error.

Thank you for your support.

from ccxt.

BingBong1234567898765321 avatar BingBong1234567898765321 commented on June 17, 2024

@ttodua any update on this topic?

Thank you.

from ccxt.

BingBong1234567898765321 avatar BingBong1234567898765321 commented on June 17, 2024

Update: I discovered the solution. Since BTCUSD is settled in USD and BTCUSDT is settled in BTC and the notation is different, the below contract size formula has fixed the issue:

new_order_contract_size = round((((((usd_balance * percent_of_holdings_to_enter)/new_order_price) * leverage))),5)

from ccxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.