Skip to content
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

Can't use OKX sub-accounts due to available balance check #7028

Closed
fengtality opened this issue May 15, 2024 · 2 comments
Closed

Can't use OKX sub-accounts due to available balance check #7028

fengtality opened this issue May 15, 2024 · 2 comments

Comments

@fengtality
Copy link
Sponsor Contributor

Describe the bug

When using a sub-account API key on OKX, orders cannot be placed because they are quantized down to amount 0, likely because the check for available balance reduces amount down to 0. However, this does not occur when using the API key for a primary account

Steps to reproduce

1 - Create sub-account keys for an OKX account

2 - Run Simple PMM with OKX sub-account API key
Config

script_file_name: simple_pmm.py
exchange: okx
trading_pair: ETH-USDT
order_amount: 0.01
bid_spread: 0.005
ask_spread: 0.005
order_refresh_time: 15
price_type: mid

Logs

2024-05-15 10:35:28,002 - 76243 - hummingbot.strategy.script_strategy_base - INFO - Creating ETH-USDT buy order: price: 2967.552675 amount: 0E-29.
2024-05-15 10:35:28,003 - 76243 - hummingbot.strategy.script_strategy_base - INFO - Creating ETH-USDT sell order: price: 2997.377325 amount: 0E-11.
2024-05-15 10:35:28,004 - 76243 - hummingbot.connector.exchange.okx.okx_exchange.OkxExchange - WARNING - Buy order amount 0E-29 is lower than the minimum order size 0.0001. The order will not be created, increase the amount to be higher than the minimum order size.
2024-05-15 10:35:28,005 - 76243 - hummingbot.connector.exchange.okx.okx_exchange.OkxExchange - WARNING - Sell order amount 0E-11 is lower than the minimum order size 0.0001. The order will not be created, increase the amount to be higher than the minimum order size.
  1. Run Simple PMM or Simple VWAP with OKX main account API key

Config

script_file_name: simple_pmm.py
exchange: okx
trading_pair: BTC-USDT
order_amount: 0.001
bid_spread: 0.005
ask_spread: 0.005
order_refresh_time: 15
price_type: mid

Logs

2024-05-15 11:01:24,001 - 83479 - hummingbot.strategy.script_strategy_base - INFO - Creating BTC-USDT buy order: price: 64727.28725 amount: 0.001.
2024-05-15 11:01:24,001 - 83479 - hummingbot.strategy.script_strategy_base - INFO - Creating BTC-USDT sell order: price: 65377.81275 amount: 0.001.
2024-05-15 11:01:24,206 - 83479 - hummingbot.connector.client_order_tracker - INFO - Created LIMIT BUY order 93027a12dac34fBCBBCUT5cb76a726eb for 0.00100000 BTC-USDT.
2024-05-15 11:01:24,206 - 83479 - hummingbot.core.event.event_reporter - EVENT_LOG - {"timestamp": 1715796084.0, "type": "OrderType.LIMIT", "trading_pair": "BTC-USDT", "amount": "0.00100000", "price": "64727.2", "order_id": "93027a12dac34fBCBBCUT5cb76a726eb", "creation_timestamp": 1715796084.0, "exchange_order_id": "1452694980166041600", "leverage": 1, "position": "NIL", "event_name": "BuyOrderCreatedEvent", "event_source": "okx"}
2024-05-15 11:01:24,219 - 83479 - hummingbot.connector.client_order_tracker - INFO - Created LIMIT SELL order 93027a12dac34fBCSBCUT09b948bdf00 for 0.00100000 BTC-USDT.
2024-05-15 11:01:24,219 - 83479 - hummingbot.core.event.event_reporter - EVENT_LOG - {"timestamp": 1715796084.0, "type": "OrderType.LIMIT", "trading_pair": "BTC-USDT", "amount": "0.00100000", "price": "65377.8", "order_id": "93027a12dac34fBCSBCUT09b948bdf00", "creation_timestamp": 1715796084.0, "exchange_order_id": "1452694980166041601", "leverage": 1, "position": "NIL", "event_name": "SellOrderCreatedEvent", "event_source": "okx"}

Release version

dev-1.28

Type of installation

Source

Attach required files

logs_conf_simple_pmm_1.log

@nikspz
Copy link
Contributor

nikspz commented May 15, 2024

@tomasgaudino Could you please review?

@cardosofede
Copy link
Contributor

@fengtality @nikspz I already talked with Mike in private since is there is an issue with the connector, should be affecting the main account and the subaccount (there is no specific code for it).
The problem was that the config provided has an order amount of 0.01 ETH (around 300 USDT) and the total balance of the subaccount was 200 USDT.
image

The Simple PMM script uses the budget checker to adjust the order to the budget, and if you don't have enough balance to send the order will reduce the amount to 0, so the behavior was expected.

I reduced the order amount to 0.001 (around 30 USDT) and I was able to place orders with the subaccount.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants