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

Fix/bybit connector upgrade v5 #6902

Open
wants to merge 75 commits into
base: development
Choose a base branch
from

Conversation

klpanagi
Copy link
Contributor

@klpanagi klpanagi commented Mar 9, 2024

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:

This PR is relevant to the bounty for upgrading Bybit API to V5

Bybit Spot / Perpetual - Upgrade API to V5

Currently supports the Spot API.

Tests performed by the developer:

Tips for QA testing:

@nikspz nikspz changed the base branch from master to development March 11, 2024 06:40
@nikspz
Copy link
Contributor

nikspz commented Mar 11, 2024

hi @klpanagi, thank you for submitting PR, fyi, it should be aimed to development, changed https://hummingbot.org/developers/contributions/#checklist

@klpanagi klpanagi force-pushed the fix/bybit_connector_upgrade_v5 branch from 46ce123 to 30bcc31 Compare March 13, 2024 20:37
Copy link

1 similar comment
Copy link

@nikspz
Copy link
Contributor

nikspz commented Apr 30, 2024

@klpanagi

  • commit 562c686
    • cloned and installed PR6902
    • connected bybit spot, checked balance successfully
    • created/started pureMM strategy successfully
    • orders placed with correct price for DOGE-USDT, XRP-USDT
    • ETH-USDT Failed to place order with order amount 0.01 eth using Client
      • tested manually
        • able to place order with 0.01 ETH and 0.005 ETH amount, lower than minimum order size (1)
    • Same thing for BTC-USDT Failed to place order with order amount 0.0005 BTC using Client - lower than minimum order size (1)
    • Same for SOL-USDT Failed to place order with order amount 0.2 SOL

image
image

image

Manually able to place:
image

DOGE-USDT Fixed
DOGE-USDT bybit 562

@nikspz
Copy link
Contributor

nikspz commented May 1, 2024

Steps:

  1. Clone PR6902, commit f37f115
  2. connect bybit
  3. Create/start pureMM using bybit spot
  4. get multiple orders filled

Actual:
Review the Error: 'qty'

logs_conf_pure_mm_2.log
comf37f115.zip

WARNING - Failed to fetch trade updates for order BYBIT-BXPUT61764f19e743fa3459773. Error: 'qty'
Traceback (most recent call last):
  File "/home/nikita/bybitv5/hummingbot/connector/exchange_py_base.py", line 956, in _update_orders_fills
    trade_updates = await self._all_trade_updates_for_order(order=order)
  File "/home/nikita/bybitv5/hummingbot/connector/exchange/bybit/bybit_exchange.py", line 426, in _all_trade_updates_for_order
    fill_base_amount=Decimal(trade["qty"]),
KeyError: 'qty'

@nikspz
Copy link
Contributor

nikspz commented May 6, 2024

  • Test performed:

    • Connect an Bybit API key successfully
    • balance Displays the current available balance and match the balance in Bybit spot.
    • Markets availabe during the strategy creation
    • Created /started pureMM using Bybit spot
    • Order submission and cancellation is okay
    • status or status --live is okay
    • order_book --live is okay
    • Able to run fast/slow refresh rate config successfully
    • Hanging orders behave as expected

    Pending:
    Longrun test
    Perpetual connector fix

Steps:

  1. Clone and install PR6902
  2. connect fresh bybit_perpetual API keys

Actual:
Failed to check bybit_perpetual balance

image
image

@nikspz nikspz marked this pull request as ready for review May 15, 2024 13:16
klpanagi added a commit to klpanagi/hummingbot that referenced this pull request May 19, 2024
@klpanagi
Copy link
Contributor Author

klpanagi commented May 19, 2024

Steps:

1. Clone and install PR6902

2. connect fresh bybit_perpetual API keys

Actual: Failed to check bybit_perpetual balance

image image

@nikspz I cannot reproduce this error. I have tested with both Classic and Unified accounts and i get the balance as expected

image

I will split the PR into separate for Spot and Perp connectors, so maybe we shall continue the discussion there. I will post here as soon as I have the PRs ready.

@Silur
Copy link

Silur commented May 23, 2024

also tested for over 16 hours now and balances are reflected correctly (spot)

@dogewithit
Copy link

I tried perpetual market making v1
I can collect balances, but during strategy execution, I am getting

2024-05-26 14:09:12,919 - 15 - hummingbot.connector.derivative.bybit_perpetual.bybit_perpetual_derivative.BybitPerpetualDerivative - WARNING - Could not fetch account updates from Bybit_perpetual. Check API key and network connection.
2024-05-26 14:09:13,449 - 15 - hummingbot.connector.derivative.bybit_perpetual.bybit_perpetual_derivative.BybitPerpetualDerivative - NETWORK - Unexpected error while fetching account updates.
Traceback (most recent call last):
  File "/home/hummingbot/hummingbot/connector/exchange_py_base.py", line 780, in _status_polling_loop
    await self._status_polling_loop_fetch_updates()
  File "/home/hummingbot/hummingbot/connector/derivative/bybit_perpetual/bybit_perpetual_derivative.py", line 308, in _status_polling_loop_fetch_updates
    await safe_gather(
  File "/home/hummingbot/hummingbot/core/utils/async_utils.py", line 22, in safe_gather
    return await asyncio.gather(*args, **kwargs)
  File "/home/hummingbot/hummingbot/connector/derivative/bybit_perpetual/bybit_perpetual_derivative.py", line 475, in _update_positions
    entry_price = Decimal(str(data["avgPrice"]))
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
2024-05-26 14:09:13,450 - 15 - hummingbot.connector.derivative.bybit_perpetual.bybit_perpetual_derivative.BybitPerpetualDerivative - WARNING - Could not fetch account updates from Bybit_perpetual. Check API key and network connection.
2024-05-26 14:09:14,011 - 15 - hummingbot.connector.derivative.bybit_perpetual.bybit_perpetual_derivative.BybitPerpetualDerivative - NETWORK - Unexpected error while fetching account updates.
Traceback (most recent call last):
  File "/home/hummingbot/hummingbot/connector/exchange_py_base.py", line 780, in _status_polling_loop
    await self._status_polling_loop_fetch_updates()
  File "/home/hummingbot/hummingbot/connector/derivative/bybit_perpetual/bybit_perpetual_derivative.py", line 308, in _status_polling_loop_fetch_updates
    await safe_gather(
  File "/home/hummingbot/hummingbot/core/utils/async_utils.py", line 22, in safe_gather
    return await asyncio.gather(*args, **kwargs)
  File "/home/hummingbot/hummingbot/connector/derivative/bybit_perpetual/bybit_perpetual_derivative.py", line 475, in _update_positions
    entry_price = Decimal(str(data["avgPrice"]))

@dogewithit
Copy link

image I tweaked it a bit. The only problem is that the status of Hummingbot, even if I am in a cross-margin mode, will only recognize the USDT balance as a margin balance instead of the global one. I will check on this

@2infinity-gh
Copy link

Steps:

1. Clone and install PR6902

2. connect fresh bybit_perpetual API keys

Actual: Failed to check bybit_perpetual balance
image image

@nikspz I cannot reproduce this error. I have tested with both Classic and Unified accounts and i get the balance as expected

image

I will split the PR into separate for Spot and Perp connectors, so maybe we shall continue the discussion there. I will post here as soon as I have the PRs ready.

Any update on this? Need spot connector like yesterday ;)

@nikspz
Copy link
Contributor

nikspz commented May 29, 2024

@2infinity-gh Bybit Spot should work on #6902 PR, clone and install, use this branch ( fix/bybit_connector_upgrade_v5 )

This was referenced May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Dev Work
Development

Successfully merging this pull request may close these issues.

None yet

6 participants