CoinAlpha / hummingbot

Hummingbot is open source software that helps you build trading bots that run on any exchange or blockchain
https://www.hummingbot.org
Apache License 2.0
168 stars 81 forks source link

Failed Test PR# 342 - Error when placing an order #343

Closed rxlxrxsx closed 1 year ago

rxlxrxsx commented 1 year ago

Summary and Screenshots

Getting this error every time the bot tries to place an order.

Screen Shot 2023-04-12 at 3 38 42 PM
2023-04-13 05:27:17,102 - 3219179 - hummingbot.connector.derivative.phemex_perpetual.phemex_perpetual_derivative.PhemexPerpetualDerivative - NETWORK - Error submitting sell LIMIT order to Phemex_perpetual for 0.001 BTC-USDT 30232.3.
Traceback (most recent call last):
  File "/home/ubuntu/phemex/hummingbot/connector/exchange_py_base.py", line 484, in _create_order
    exchange_order_id = await self._place_order_and_process_update(order=order, **kwargs,)
  File "/home/ubuntu/phemex/hummingbot/connector/exchange_py_base.py", line 502, in _place_order_and_process_update
    exchange_order_id, update_timestamp = await self._place_order(
  File "/home/ubuntu/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 316, in _place_order
    o_id = str(order_result["data"]["orderID"])
TypeError: 'NoneType' object is not subscriptable

Steps To Reproduce

  1. Clone and install branch
  2. Run the client
  3. Connect Phemex API key
  4. Create a perpetual market making strategy using Phemex
  5. Start the strategy

Expected Results

Bot should be able to place orders given it has enough asset to place an order

Test Result Comparison

N/A, new connector

Attachments

Logs and config: phemex_order.zip

vic-en commented 1 year ago

@rxlxrxsx It says insufficient balance. However, I'll try to suppress that error.

vic-en commented 1 year ago

@rxlxrxsx I raised a clearer error in this case.

rxlxrxsx commented 1 year ago

Thank you @vic-en, we found out the issue and it was due to the position management (one-way, hedge) being different from the exchange and confirm orders are now being placed. Posting the error message here for reference:

2023-04-15 11:03:06,089 - 3313062 - hummingbot.connector.derivative.phemex_perpetual.phemex_perpetual_derivative.PhemexPerpetualDerivative - NETWORK - Error submitting buy LIMIT order to Phemex_perpetual for 500.0 DOGE-USDT 0.08748.
Traceback (most recent call last):
  File "/home/ubuntu/phemex/hummingbot/connector/exchange_py_base.py", line 484, in _create_order
    exchange_order_id = await self._place_order_and_process_update(order=order, **kwargs,)
  File "/home/ubuntu/phemex/hummingbot/connector/exchange_py_base.py", line 502, in _place_order_and_process_update
    exchange_order_id, update_timestamp = await self._place_order(
  File "/home/ubuntu/phemex/hummingbot/connector/derivative/phemex_perpetual/phemex_perpetual_derivative.py", line 323, in _place_order
    raise IOError(f"{code} - {order_result.get('msg')}")
OSError: 20004 - TE_ERR_INCONSISTENT_POS_MODE