Skip to content

Add Inverse Futures Brokerage Support#40

Open
Romazes wants to merge 7 commits into
QuantConnect:masterfrom
Romazes:add-inverse-support
Open

Add Inverse Futures Brokerage Support#40
Romazes wants to merge 7 commits into
QuantConnect:masterfrom
Romazes:add-inverse-support

Conversation

@Romazes
Copy link
Copy Markdown
Contributor

@Romazes Romazes commented Mar 4, 2026

Description

Adds support for Bybit inverse futures contracts by introducing a dedicated BybitInverseFuturesBrokerage and its factory. Inverse derivatives use a separate account from the Unified Trading Account, so a standalone brokerage class was chosen over extending the existing one.

Related PRs

Continues work from #6.

Related Issue

N/a

Motivation and Context

Finishing the current implementation of support for inverse futures.

Requires Documentation Change

N/a

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

@Romazes Romazes self-assigned this Mar 4, 2026
- Move Bybit Inverse Futures brokerage and tests to QuantConnect.Brokerages.Bybit namespace for consistency.
- Simplify GetWalletBalances to always use "UNIFIED" account type.
- Remove unused SwitchPositionMode method from BybitPositionApiEndpoint.
- Refactor MarketName and WalletAccountType handling in BybitBrokerage.
- Restrict BybitInverseFuturesBrokerage to CryptoFuture/Inverse only.
- Override GetBrokerageModel in BybitInverseFuturesBrokerageFactory.
- Move PositionMode enum to new namespace.
- Update test assertions and using directives.
- Remove redundant and unused code for clarity.
Romazes added 2 commits March 5, 2026 00:07
test:fix: correct ETHUSD symbol
Removed BybitInverseFuturesBrokerage and its factory, merging all Bybit product support into the main BybitBrokerage class. Updated supported product categories and security types to include inverse futures. Refactored tests and removed redundant test fixtures. Simplifies codebase and centralizes Bybit brokerage logic.

fix: add [TestCase] with defaults to ReturnsNullOnInvalidHistoryRequest

refactor: bybitBrokerage instantiation and IsSupported method

Changed IsSupported to private static in BybitBrokerage. Removed the CreateBrokerage method from BybitBrokerageFactory and replaced its usage with direct instantiation, simplifying the factory logic.

revert: bybit factory
Replaced SupportedBybitProductCategories with GetWorkingProductCategories to select product categories based on brokerage name. Updated GetOpenOrders, GetAccountHoldings, and GetCashBalance to use this logic. GetCashBalance now returns a single USD balance for Inverse category. Added GetWorkingProductCategories method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants