Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
- add saleCondition/exchange overload to UpdateQuote
- normalize exchange via GetPrimaryExchange in UpdateQuote/UpdateLastTrade
- cover exchange mapping with combined test
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
* feat: add CreateOAuthTokenHandler factory to Brokerage base class
Introduce AuthenticationFailed event on TokenHandler raised when all
retry attempts are exhausted. Add CreateOAuthTokenHandler<TRequest,TResponse>
protected factory method on Brokerage that wires the event to OnMessage
(BrokerageMessageType.Error), triggering graceful Lean shutdown on
OAuth token refresh failure without requiring per-brokerage error logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: token retry logic: move to OAuthTokenHandler
* refactor: replace generic OAuthTokenHandler with non-generic, require explicit token lifetime
- Remove generic type parameters <TRequest, TResponse> from OAuthTokenHandler and
CreateOAuthTokenHandler; use LeanAccessTokenMetaDataRequest and
AccessTokenMetaDataResponse directly
- Delete abstract AccessTokenMetaDataRequest; logic moved to LeanAccessTokenMetaDataRequest
- Make tokenLifetime a required constructor parameter — each brokerage must explicitly
declare its OAuth token lifetime to prevent silent 1-hour fallback bugs
- Move expiry tracking into the handler via _tokenExpiresAt (written under lock before the
volatile write of _tokenCredentials, ensuring correct visibility on the fast path)
- Simplify AccessTokenMetaDataResponse to a concrete class with { get; set; } properties
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add unit tests for OAuthTokenHandler and AccessTokenMetaDataResponse
- Make ApiConnection.TryRequest<T>(HttpRequestMessage) virtual to allow
test subclasses to intercept without real HTTP calls
- Add AccessTokenMetaDataResponseTests: two parameterized cases verify that
TokenType defaults to Bearer when absent from JSON (CharlesSchwab pattern)
and deserializes correctly when present (Tastytrade pattern)
- Add OAuthTokenHandlerTests with FakeApiConnection stub:
CharlesSchwab-style response (no tokenType, 30-min lifetime) and
Tastytrade-style response (explicit tokenType + expiresIn/tokenId, 15-min lifetime)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: backward-compatible OAuth auth with new LeanOAuthTokenHandler hierarchy
- Restore master API: OAuthTokenHandler<TReq,TRes>, AccessTokenMetaDataRequest,
AccessTokenMetaDataResponse, and TokenHandler stay source-compatible for old consumers
- Extend TokenHandler with AuthenticationFailed event; simplify Send() (auth header only)
- Add LeanOAuthTokenHandler: non-generic, thread-safe double-checked locking, explicit
tokenLifetime, retry logic in GetAccessToken, fires AuthenticationFailed on exhaustion
- Add OAuthTokenRequest / OAuthTokenResponse: concrete Lean platform request/response
- Brokerage.CreateOAuthTokenHandler wires AuthenticationFailed to graceful shutdown
- Update tests: OAuthTokenResponseTests, LeanOAuthTokenHandlerTests, TokenHandlerTests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Some tweaks
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
* Add Api helper methods for POST requests
* Support json serializer setting for json requests
* Minor changes and cleanup
* Make ApiConnection disposable
* Refactor user define universe handling
- Normalize user define universe additions and removals to behave like
other subscriptions without requiting special handling
* Minor fixes
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
* Enable concurrency for paper brokerage.
Implement PaperBrokerageTransactionHandler to handle concurrency for live paper trading transaction handler
* Remove PaperTradingBrokerageTransaction handler
Favor existing BacktestingTransactionHandler
* Minor fixes and cleanup
* Minor unit tests fix
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add 'asynchronous' parameter to trading api
* Add regression algorithms
* More fixes for asynchronous orders
* Fix failing unit tests
* Fix failing unit tests
* Add multiple orders requests in transaction handler
Make each transaction thread handle requests corresponding to the same order
* Refactor order state machine in BrokerageTransactionHandler
Now using a single dictionary to hold orders and their state, either pending for submission, open or closed.
* Revert: remove complete orders from new state machine in BTH
* Add order ticket to new BTH open orders state machine
* Run syn in Backtesting transaction handler for new orders submission
* Remove OpenOrderState.SubmissionPending property
* Add Security to OpenOrderState
* Minor fix
* Cleanup
* Some cleanup in BTH
* Cleanup
* Minor fix
* Minor unit test fix
* Minor fix
* Make Brokerage.ConcurrencyEnable property virtual
* Minor change
* Cleanup
* Add 'asynchronous' parameter to SetHoldings api
* Improve regression algorithms
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* feat: Get AccessToken from Lean API
* feat: create TokenCredentials DTO instead of Tuple
* remove: extra unrequired null reference exceptions on argument check
* remove: SendAsync override in TokenHandler
* feat: override SendAsync in TokenHandler to prevent future bugs
* test:feat: SyncAsync in TokenHandler
* refactor: name property of AccessTokenExpires to Expiration in AccessTokenMetaDataResponse
* feat: add retry logic to getAccessToken in TokenHandler
test:feat: TokenHandler with retry logic
* feat: make retry timeout configurable in ctor
Build & Test Lean / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Allow multiple concurrent transaction handlers
Also support multiple producers in BrokerageConcurrentMessageHandler
* Minor change
* Minor change
* Add new maximum-transaction-threads config to json file
* Minor naming changes
* Address peer review and add unit tests
* Minor fix
* Minor fix and unit tests
* Address peer review
Build & Test Lean / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* feat: new Level One service
feat: new ctor in Tick
fix: missed SetValue in Tick ctor
* refactor: LevelOneService
feat: Tick Event Args
* feat: use aggregator in LevelOneService explicitly
remove: extra TickEventArgs
* feat: ThreadSafeDataAggregatorWrapper
refactor: use ThreadSafeDataAggregatorWrapper in LevelOneService
* feat: generic LevelOne Market Data Manager
refactor: LevelOneMarketData
remove: ThreadSafeDataAggregatorWrapper
* feat: support OpenInterest in LevelOneMarketData
feat: add EventBasedDataQueueHandlerSubscriptionManager in LevelOneServiceManager
feat: handle OpenInterest
* feat: add missed license in BaseDataEventArgs
* feat: create un-subscribe wrapper in LevelOneServiceManager
refactor: TryGetLevelOneMarketData
feat: validate the same Quote data in LevelOneMarketData
* feat: handle nullable value in levelOneMarketData
* feat: handle nullable value in LevelOneServiceManager
* refactor: change location of LevelOneMarketData Service
test:feat: test of LevelOneMarketData
* feat: add SetIgnoreZeroSizeUpdates
* refactor: use ignoreZeroSizeUpdates internally in TryResolvePriceSize
* refactor: position add symbols in collection in LevelOneServiceManager
* fix: validation of IgnoreZeroSizeUpdates setting in LevelOneMarketData
* test:feat: validate UpdateLastTrade with IgnoreZeroSizeUpdates setting
test:refactor: use global DateTime in testCases
* fix:test: missed calculation value in QuoteBar
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* empty
* refactor: orderType for SecondCrossZeroOrder
* refactor: handle some specfic orderStatus in CrossZeroOrder process
* refactor: Handle specific OrderStatus in SecondPartCrossZeroOrder
* refactor: handle order status
revert: convertOrderType of CrossZeroSecondPart
* fix: use right collection when removing cross zero order class
* feat: TryCrossPositionOrder
feat: helper methods to CrossPosition
* refactor: get rid CrossOrder +UTests
* feat: test simulator of cross zero orders request
* remove: callback from TryCrossPositionOrder
rename: TryCrossPositionOrder -> TryCrossZeroPositionOrder
feat: handle event of CrossZeroOrder
feat: new prop in CrossZeroOrderRequest
test:feat: write working test imitate of CrossZeroOrdering and assert different params
* feat: temp collection to keep CrossZeroOrder with Lean
* refactor: flag which indicate should we place crossZero order with LeanEvent or not
* refactor: change access modifier
* fix: CrossZero tests
* refactor: property collection instead of variable
* feat: lock context of CrossZeroOrder
feat: helper method for CrossZeroCollection
* refactor: test of cross brokerage ordering
* refactor: CrossZero Brokerage
* fix: lock area
* feat: Update CrossZero Ordering
refactor: CrossZeroOrders tests
* feat: additional test case for CrossZeroOrdering
* feat: Invalid OrderStatus when FirstPart of CrossZero ordering try to place
feat: message property in CrossZeroOrderResponse
refactor: CrossBrokerageTest a little bit
* feat: PossibleUpdateCrossZeroOrder
* refactor: UpdateCrossZeroOrder
* refactor: TimeOut for resetEvent
* refactor: crossZeroOrder change DateTime UtcNow on specific time
refactor: change action scenario for Filled FirstPart of CrossZeroOrder
* refactor: change firstPartQuantityproperty to link of FirstPartOfCrossZero order completely
fix: crossZeroOrder test put orderStatus internally
* feat: additional orderType in CrossZeroOrder tests
* test:remove: not use GetOrderCrossesZero()
* refactor: extra paddings
* rename: TryGetUpdateCrossZeroOrderQuantity instead of IsPossibleUpdateCrossZeroOrder
* refactor: CrossZeroOrder process and models
* remove: interface ICrossZeroOrderRequest
* feat: TradeStation NotSupportUpdate of CrossZeroOrder quantity
* feat: add license
remove: extra validation of variable
* refactor: add validation of quantity update in TradeStationBrokerageModel
* test:feat: canUpdate of TradeStationOrder
* refactor: reuse OrderEvent when we handle FirstPartCrossZeroOrder
* remove: assignment of filled quantity of FirstPartCrossZeroOrder
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
- Once a security has been delisted or no longer selected by any
universe it will be remove from the main algorithm securities
collection but kept in the new Complete collection, this improves
performance in long running backtests where security collection can
get enumerated in different cases
- Minor refactor for security exchange local time to avoid having to set
it explicitly
Build & Test Lean / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* Draft of unit test to reproduce error
* Fix bug and regression tests
* Remove draft unit test
* Check fees in ComboMarketOrderAlgorithm.cs
* Fix bug in fees for combo orders
- Update regression tests
- Solve bug in fees when combo orders had legs with different quantity
- Solve bug in fees when combo orders had legs with different security
types
- Update IB comission rate for options where the price is higher than 0.1 USD
* Add explaining comments
* Use leg security fee model
* Add trailing stop orders base implementation
* Handle trailing stop order prices rounding
* Implement trailing stop orders fill logic
* Minor fill model changes
* Add ApplySplit to fill model interface for models that might need to be aware of splits.
Filling trailing stop orders require keeping track of min/max prices, which need to be split adjusted.
* Add brokerage order updated event for communicating certain order types prices changes
* Add order update event args class for brokerage side order updates
* Revert IFillModel.ApplySplit
* Add trailing stop orders regression algorithm
* Updated order ticket demo algorithm to include trailing stop orders
* Some cleanup
* Support trailing stop orders in IB brokerage model
* Some cleanup
* Fix failing tests
* Fix failing regression algorithm
* Address peer review
* Add trailing stop price calculation unit tests
* Minor changes
* Minor change
* Add support for Null SecurityPositionGroupModel
- Add support for algorithms to set the null security position group
model which will not group securities together but rather return the
single group buying power model. Adding regression algorithms
* Add Null Margin python regression & cleanup
- Add python regression algorithm & minor regression algorithms clean up
* Add support for brokerage side new orders
- Add support for brokerage side new order events for liquidation cases
* Minor cash delta fix
* Improve account cash logging
* Fix null reference exception for open orders
* Feature combo orders
- Add support for combo orders
* Make fill model wait for all grouped orders to emit fills
* Add ComboFill to model multiple fills for combo orders
* Fill combo limit orders
Add some regression algorithms
* Add fill implementation for combo leg limit orders
* Add IFill as common interface for Fill and ComboFill
* Refactor combo orders removing IGroupOrder interface
Move the group order manager to the base Order class
* Update algorithms
* Handle combo order events atomically
* Refactor brokerage transaction event handler
* Refactor combo fill models
* Process fills in batch
* Combo orders fill model tests
* Combo leg limit orders algorithm
* Regression algorithms cleanup
* Fill and combo fill classes cleanup
* Housekeeping
* Refactor equity fill model to derive from base fill model
* Address review changes request
* Handling the new types of orders in the OrderJsonConverter
* Add regression algorithm to test combo orders update/cancel
* Add regression algorithm to test combo orders update/cancel
* Housekeeping
* Address review changes request
* Minor changes
* Security transaction handler method for setting order request id
* Extend public interface for placing combo orders
* Combo order tickets demo algorithm python version
* Tweaks and updates
* Minor fixes
* Minor changes
* Minor fixes
* Address reviews minor fixes
* Minor fixes
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
Python Virtual Environments / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
* WIP
* Add base currency cash
* Symbol properties and data processing
* Add basic template algorithm
* Add hourly crypto future algorithm
* Minor fixes after live trading testing
* CoinApiDataQueueHandler CryptoFuture support
* Address reviews
* Fix regression algorithms after update