-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting Phemex python CCXT script from USD to USDT #22478
Comments
@BingBong1234567898765321 I think you can use this symbol instead |
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 |
@BingBong1234567898765321 have you tried set_margin_mode to 'cross' or 'isolated' to see if that has any effect? or set_position_mode with |
@ttodua when I run:exchange.set_margin_mode("cross", symbol = symbol) When I run:exchange.set_position_mode(False, symbol = symbol) Is the contract size (amount) calculated differently for USDT contracts vs. USD? With the code I have above: #Note, I have tried multiplying by 1000, 10000, and 100000 and they all get the same error. Thank you for your support. |
@ttodua any update on this topic? Thank you. |
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) |
Operating System
Windows 11 - PythonAnywhere.com
Programming Languages
Python
CCXT Version
4.3.21
Description
Hello, Phemex has recently announced they are delisting the perpetual contracts trading pair BTCUSD. I am trying to convert my script to BTCUSDT to adapt to this change. However, it appears the commands that have always worked for BTCUSD do not work for BTCUSDT and I do not know why. For example, when running this code:
exchange.set_leverage(leverage = leverage,symbol = symbol)
I get this error:
{"code":20004,"msg":"TE_ERR_INCONSISTENT_POS_MODE","data":null}
I've tried using exchange.set_position_mode to set to merged, and hedged, and this does not work. I also get similar errors when running:
exchange.create_limit_order(**new_contract_params)
Am I missing required params? Are the commands different for USDT vs. USD?
Code
The text was updated successfully, but these errors were encountered: