[HIP] Bitget Perpetual Exchange Connector

Linked HGP : HGP-19 [DG] Get Hummingbot connector forks into the codebase!

Description : Proposal to submit a connector for Bitget Perpetual exchange into the Hummingbot Foundation’s open source codebase. The connector is built following CoinAlpha’s standard of quality and performance, similar to the Binance spot connector implementation.

HBOT Allocation : 500,000 HBOT

The development work is divided into four parts:

  1. Implement the BitgetPerpetualAPIOrderBookDataSource class with the logic to maintain an OrderBook and FundingInfo associated with a specified market.
  • Maintaining OrderBook and FundingInfo should be done using either REST or WS API (preferred).
  • Maintain WS connection i.e. adhering to Exchange’s Ping-Pong mechanism
  • The new class should extend PerpetualAPIOrderBookDataSource
  1. Implement the BitgetPerpetualUserStreamDataSource class with the logic to receive Private Account event updates. This includes order, trades, positions and funding payment events.
  • Subscribe and maintain websocket connection to the relevant private channels.
  • The new class should extend UserStreamTrackerDataSource
  1. Implement the BitgetPerpetualDerivative class with the logic for the following:
  • Interact with the Exchange’s Trade interface via their REST API i.e. Placing Order, Canceling Order, Query Order Details, Querying Open Positions, Changing Leverage Settings
  • Tracking and processing private event updates
  • Event messages from UserStreamDataSource should be processed accordingly i.e. Order Updates, Trade Updates, Balance Updates, Funding Payment updates
  • The new class should extend PerpetualDerivativePyBase
  1. Implement support for USDC and USD pairs
  • Add support in the Bitget connector class to populate the trading pair map and the trading rules requesting information not only for USDT pairs, but also for the two new product types.
  • Check the implementation of get_buy_collateral_token and get_sell_collateral_token is taking the collateral token correctly from the trading rule and removing default values.
  • Check subscriptions in the order book data source and user stream data source that are currently using the product type as a parameter. Add new subscriptions for the two new product types.
  • Double check that all requests calls using the product type as a parameter will correctly use the product type from each trading pair.
  • Validate that both perpetual market making and spot perpetual arbitrage are correctly determining the collateral token to validate balance limits for the candidate orders (they should be using the budget checker and the PerpetualOrderCandidate class).