4553 Commits

Author SHA1 Message Date
Martin-Molinero affb275758 Revert "Market-hours aware intraday consolidation (#9516)" (#9528)
API Tests / 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
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
This reverts commit 9b89c166ff.
2026-06-12 09:27:54 -03:00
JosueNina 9b89c166ff Market-hours aware intraday consolidation (#9516)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Python Virtual Environments / 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
* Add market-hours aware intraday consolidation to MarketHourAwareConsolidator

* Minor fix

* Address review comments

* Assert consolidated bar size in regression algorithms

* Move MarketHourAwareConsolidator to Data.Consolidators namespace

* Remove accidentally committed log file

* Keep MarketHourAwareConsolidator in Data.Common namespace
2026-06-11 10:02:26 -03:00
Martin-Molinero 02d0dfac45 Minor MarketHourAwareConsolidator tweak (#9517)
API Tests / 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
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
2026-06-09 09:47:08 -03:00
Roman Yavnikov 02656df2ae feature: add bloomberg fix brokerage model (#9494)
API Tests / 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
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
* feature: add bloomberg fix brokerage model

- supports Equity, Option, Future
- Market, Limit, StopMarket, StopLimit order types
- margin-only account type

* feat: support MOO in  BloombergFix
2026-06-08 17:52:16 -03:00
Martin-Molinero f4131bb3fa Minor quotebar constructor tweak (#9515) 2026-06-08 13:57:16 -03:00
laur89 9b6203ceca task: remove extraneous defaults from Isolator/MonitorTask (#9514)
* task: remove extraneous defaults from Isolator/MonitorTask

- ExecuteWithTimeLimit -- the only user of private MonitorTask --
  already defines the defaults for memoryCap & sleepInterval

* fix: typos
2026-06-08 13:56:37 -03:00
JosueNina b27d79a081 Fix PandasColumn equality wrongly matching non-string values (#9509) 2026-06-04 17:45:42 -03:00
Roman Yavnikov 24afc50dbe feature: add webull brokerage core integration (#9362)
API Tests / 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
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
* feature: add webull brokerage core integration

- add BrokerageName.Webull enum value
- add WebullBrokerageModel supporting Equity, Option, IndexOption
- add WebullFeeModel with zero commission for equity/option, tiered index option fees (SPX, SPXW, VIX/VIXW, XSP, DJX, NDX/NDXP), 0.6% crypto fee
- register Webull in IBrokerageModel factory switch and GetBrokerageName
- add webull config keys and live-webull environment to Launcher/config.json
- add WebullBrokerageModelTests (CanSubmitOrder, GetFeeModel)
- add WebullFeeModelTests covering all index option tiers and crypto

* refactor: split webull supported order types per security type

- replace flat _supportSecurityTypes/_supportOrderTypes with _supportedOrderTypesBySecurityType dictionary
- options and index options: Limit, StopMarket, StopLimit only
- equity, future, crypto: Market, Limit, StopMarket, StopLimit, TrailingStop
- add WebullOrderProperties with OutsideRegularTradingHours flag
- add messages for unsupported order type validation

* fix: add market order type to option and index option supported orders

* chore: add webull crypto symbols to symbol-properties-database

* test: consolidate webull fee model and brokerage model tests

- merge per-tier and per-symbol [Test] methods into [TestCase]/[TestCaseSource] parameterized tests in WebullFeeModelTests
- replace CreateIndexOptionSecurity/CreateOptionSecurity/CreateCryptoSecurity with single CreateSecurity(SecurityType, decimal, string) helper
- rename test methods to PascalCase (drop underscores) in WebullBrokerageModelTests
- remove section-separator comments from WebullBrokerageModelTests
- update Launcher/config.json for local Webull UAT environment

* remove: restriction GTC for Option and Buy side only

* refactor: limit webull to equity and options

- remove crypto and future support from order types and tests
- remove crypto fee logic and crypto symbol-properties rows
- reject market orders with outsideRth on equity
- log info when market order uses non-day tif
2026-05-29 22:49:58 +03:00
Alexandre Catarino 96a670a90b Add EMSX locate properties to TerminalLinkOrderProperties (#9502)
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
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Add LocateBroker (string) and LocateId (string) so algorithms can attach
Reg SHO locate information to short equity sales routed through Bloomberg
EMSX. These map to the EMSX_LOCATE_BROKER and EMSX_LOCATE_ID fields on the
EMSX order ticket (LocBrkr / LocId). The TerminalLink brokerage emits
EMSX_LOCATE_REQ = "Y" automatically whenever either identifier is set on
a short equity sale, so no separate "required" flag is exposed here.

Without these properties the TerminalLink brokerage has no way to identify
the lender on a short sale, and prime brokers reject the order.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 09:52:16 -03:00
JosueNina e1488ca133 Fix PM-settled index options settlement time on 3rd Friday (#9504)
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
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
* Fix PM-settled index options settlement time on 3rd Friday

* Add unit tests

* Fix 0DTE PM-settled index options expiry at 4:00 PM ET
2026-05-28 14:07:39 -03:00
Derek Melchin 0f4cbbc8d4 Add optimization analysis (#9495)
* Add optimization analysis

* Address feedback

* Remove redundant CurveType

* Address feedback pt 2

* Address review pt 3

* Address review pt 4

* Removed redundant properties

* Add Interpretation member
2026-05-28 14:00:14 -03:00
Rudy Osuna 261366a7e2 Add VIX Mini Futures (VXM) Support (#9400)
API Tests / 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
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 VIX Mini Futures (VXM) support

Adds complete LEAN support for VIX Mini Futures (VXM) traded on CBOE:
- Add Futures.Indices.VIXMini = "VXM" constant
- Add expiry function: 30 days before third Friday of following month
- Add symbol properties: multiplier 100, tick 0.01 (USD)
- Add 15 test date pairs for 2023-2025 to FuturesExpiryFunctionsTestData.xml
- Add [TestCase(VIXMini, EightOClockChicagoTime)] to IndicesExpiryDateFunction test
- Add market hours configuration mirroring VX trading hours

Closes QuantConnect/Lean#6655

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Fix VXM expiry holiday validation and add margin file

- Replace single `if` holiday check with `while` loop using
  `IsCommonBusinessDay()` to ensure the computed expiry date
  is always a valid tradable day (not just one step back)
- Fix test data: 2025-03-19 -> 2025-03-18 (April 18 2025 is
  Good Friday, a CFE holiday, shifting the expiry back)
- Add Data/future/cfe/margins/VXM.csv margin file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-22 10:10:17 -03:00
JosueNina a2537513bd Fix ScheduledUniverse emitting triggers past end time (#9490)
Benchmarks / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
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
API Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Fix ScheduledUniverse emitting triggers past end time

* Minor fix
2026-05-19 13:12:35 -05:00
Jhonathan Abreu 65aecb4fb0 Support indexing memoizing enumerable (#9489)
Regression Tests / build (push) Has been cancelled
Report Generator Tests / 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
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Support indexing memoizing enumerable

Pass MemoizingEnumerable to universe selectors

* Add CastingEnumerable class

* Minor change
2026-05-18 18:12:45 -03:00
JosueNina 0c874dae3f Fix SessionConsolidator skipping bars when updated manually (#9478)
* Fix SessionConsolidator skipping daily bars on manual Update

* Fix SessionConsolidator bar timestamp when no data arrives for a trading day

* Address review comments

* Minor fix

* Move initialization logic to start of AggregateBar
2026-05-15 09:57:46 -03:00
JosueNina 0df0e67cd1 Add deterministic counter to universe symbol ticker for stable sort order (#9487)
API Tests / 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
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
2026-05-14 09:35:01 -03:00
Alexandre Catarino 521b3335fa Throw clear error when add_data first argument is not a custom data class (#9473)
* Throw clear error when AddData is called with a non-class first argument from Python

Calls like self.add_data("VIX", Resolution.DAILY) routed through CreateType, which
silently built a dynamic assembly named after the string and returned a fake type
whose activator factory tried to invoke the str like a function. The downstream
'str' object is not callable PythonException surfaced confusingly (and could
manifest as an apparent hang depending on where it was caught), making the actual
mistake hard to diagnose.

Validate the PyObject up front via TryCreateType in the AddData(PyObject, ...)
entry points and throw an ArgumentException pointing the user at AddEquity /
AddForex / etc. when the argument is not a custom data class.

* Improve the error message

Use only two alternative methods as examples, as we don't need an exhaustive list.
2026-05-12 11:44:40 -03:00
Alexandre Catarino 4717e320c3 Default to all market hours when no symbol is provided to time rules (#9470)
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
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* Default to all market hours when no symbol is provided

Add no-symbol overloads of `AfterMarketOpen`, `BeforeMarketOpen`,
`AfterMarketClose` and `BeforeMarketClose` so scheduled events can be
defined without referencing a specific security. Per-date, the helpers
pick the earliest open / latest close across the algorithm's
non-always-open exchanges, falling back to US equities (SPY) when no
eligible security is subscribed. US equities are skipped during the
walk since SPY's exchange hours already represent them.

Closes #9461.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Test that option contracts dedupe to one exchange hours entry

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 09:55:45 -03:00
Jhonathan Abreu 3806e81388 Add Count property to MemoizingEnumerable (#9468)
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
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
* Add Count property to MemoizingEnumerable

* Update Pythonnet version to 2.0.54
2026-05-08 16:10:58 -04:00
Martin-Molinero 3356c73d12 Set initial universe selected value (#9471)
API Tests / 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
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
2026-05-08 13:48:29 -03:00
JosueNina 63720f4504 Fix snake_case error messages for Python algorithms (#9345)
* Fix snake_case error messages for Python algorithms

* Minor fix

* improve FormatCode robustness and fix test state isolation

* migrate QCAlgorithm inline messages to Messages classes

* Solve review comments

* Minor fix

* Fix broken regression tests

* Minor fix

* Minor fix

* Add FormatCodeRoot helper for Python self-referenced properties

* Address review comments

* Minor fix
2026-05-08 11:41:25 -03:00
JosueNina 421d3c3448 Fix RollingWindow element order corruption on resize (#9449)
Benchmarks / 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
Build & Test Lean / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
* Fix RollingWindow resize

* Fix MarketImpactSlippageModel

* Reorder RollingWindow list in place
2026-05-07 10:41:05 -03:00
Alexandre Catarino e81cdf541d Allow SetAccountCurrency after SetCash without throwing (#9457)
* Allow SetAccountCurrency after SetCash without throwing

Previously, calling SetAccountCurrency after SetCash threw an
InvalidOperationException. The portfolio manager now switches the
base account currency in place: the previous Cash entry (and its
balance) is preserved in the CashBook, and a notice is logged. When
the new account currency matches the existing one, an optional
startingCash overrides the previously set amount and the override
is logged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Simplify SetAccountCurrency remarks and drop unused message

Tightens the XML remarks to two cases (different currency: keep previous
in its own entry; matching currency: override). Also removes the now
unused CannotChangeAccountCurrencyAfterSettingCash string since the
portfolio no longer throws.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Simplify in-line comment in SetAccountCurrency

Drops the "Undo that migration" wording (residue from a previous fix
attempt) and just describes what the branch does: keep the previous
balance in its own currency entry while the new account currency starts
at zero.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Differentiate implicit vs explicit SetCash on account currency switch

SetCash(decimal) is currency-agnostic: the amount is "this many units of
the (eventual) account currency". Switching the account currency now
re-labels the amount onto the new currency instead of preserving the
previous one. SetCash(symbol, ...) for the current account currency keeps
the old behaviour of preserving the balance in its own CashBook entry.

Splits the existing tests by overload and adds a starting-cash variant
for the explicit case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Mark base cash explicit on any SetCash(symbol, ...) call

Broaden _baseCashSymbolSetExplicitly so any call to the explicit-currency
overload signals the user is committing to named currencies, not just
calls whose symbol matches the current account currency. SetAccountCurrency
then preserves the previous base-currency balance in its own CashBook
entry whenever the user has touched the explicit overload at all.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 09:54:20 -03:00
Alexandre Catarino 6035c1cf09 Add DateRules.QuarterStart and DateRules.QuarterEnd (#9454)
Closes #9453

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 19:07:05 -03:00
Martin-Molinero afd62cda32 Minor initialization weak (#9460)
API Tests / 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
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
2026-05-06 15:57:09 -03:00
JosueNina 779a7c06c5 Fix PortfolioStatistics WinRate/LossRate documentation (#9431)
* Fix PortfolioStatistics win/loss inconsistency

* Update regression algorithms

* Revert changes

* Fix PortfolioStatistics win rate XML documentation
2026-05-04 10:27:41 -03:00
Roman Yavnikov 870f96dcaf fix: add AJY/ANE/ECD future-option expiry definitions (#9448)
Benchmarks / 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
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* fix: add AJY future-option expiry definition

- map AJY (AUD/JPY) FOP to SecondFridayBeforeThirdWednesdayOfContractMonth
- prior fallback to the AJY HMUZ-only future expiry collapsed serial-month FOPs (e.g. AJYN6) into their underlying quarterly Symbol

* fix: add ANE and ECD future-option expiry definitions

- map ANE (AUD/NZD) and ECD (EUR/CAD) FOPs to SecondFridayBeforeThirdWednesdayOfContractMonth
- prior fallback to the HMUZ-only future expiry collapsed serial-month FOPs into their underlying quarterly Symbol
2026-05-01 18:47:06 +03:00
Roman Yavnikov daf0939e6c fix: add EAD future-option expiry definition (#9446)
Benchmarks / build (push) Has been cancelled
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
API Tests / build (push) Has been cancelled
- map EAD (EUR/AUD) FOP to SecondFridayBeforeThirdWednesdayOfContractMonth
- prior fallback to the EAD HMUZ-only future expiry collapsed serial-month FOPs (e.g. EADN6) into their underlying quarterly Symbol
2026-04-30 20:52:07 +03:00
Roman Yavnikov ed8e454f49 feature: recognise equity tape letters S/V/H/U and add NASDAQ_SC (#9422)
API Tests / 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
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
* feature: add NASDAQ_SC and NASDAQ_INT equity exchanges

- map primary exchange codes S and T to new NASDAQ tier exchanges
- T was previously folded into NASDAQ, now returns NASDAQ_INT
- add V as alias for IEX in equity switch
- fix MEMX description (was copy of LTSE)

* feature: map equity exchange codes H and U to MIAX_PEARL and MEMX

* feature: consolidate NASDAQ_INT code T into NASDAQ_SC

Remove the separate NASDAQ_INT mapping in GetPrimaryExchange and map
exchange code "T" to NASDAQ_SC. Update ExchangeTest cases accordingly
and add coverage for IEX ("V") and MEMX ("U").

* feature: remove orphaned NASDAQ_INT exchange entry

Drop the NASDAQ_INT class entry from Exchange.cs. The "T" tape letter
already routes to Exchange.NASDAQ via GetPrimaryExchange, leaving the
class definition unreachable and inconsistent.
2026-04-21 23:27:16 +03:00
Alexandre Catarino 8205d005bf Configurable Map Zip Provider Lookup Date
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
API Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Adds config `map-file-provider-lookup-date` to allow using a particular date.
2026-04-16 19:02:13 +01:00
Martin-Molinero 8321062cfd Remove email regex timeout validation (#9399)
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
Syntax Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
2026-04-14 14:03:23 -03:00
Roman Yavnikov 9b2a793709 fix: support BNFCR alternative collateral in CryptoFutureMarginModel for Binance (#9373)
* fix: support BNFCR alternative collateral in CryptoFutureMarginModel for Binance (#9339)

* refactor: use classic switch in BinanceFuturesBrokerageModel.GetBuyingPowerModel

* fix: CryptoFutureMarginModel in BinanceCoinFuturesBrokerageModel

* refactor: simplify BinanceCryptoFutureMarginModel collateral conversion

* fix: restore IsCryptoCoinFuture guard in BinanceCryptoFutureMarginModel

* refactor: simplify BinanceCryptoFutureMarginModel to direct BNFCR lookup

Replace IsStableCoinWithoutPair foreach loop with a single TryGetValue
check for BNFCR. BNFCR is EU/EEA-only (MiCA Credits Trading Mode) so
the lookup is a no-op for all other users. Amount reflects availableBalance
from the Binance API — the total cross-margin pool already aggregated by
Binance — making the > 0 guard correct and avoiding CashBook iteration.

* feat: add regression algorithm for BNFCR as sole collateral on Binance USDⓈ-M futures

Asserts end-to-end that EU/MiCA accounts with zero USDT and BNFCR as
the only collateral can open ADAUSDT positions. Verifies buying power,
holdings AbsoluteHoldingsCost, TotalSaleVolume, TotalMarginUsed,
maintenance margin consistency and TotalUnrealizedProfit accuracy.

* refactor: BNFCR presence gate with CashBook iteration for supplementary collateral

Replace IsStableCoinWithoutPair and hardcoded asset list with CashBook
iteration gated by BNFCR presence. Binance controls which assets are in
the account — all with non-zero walletBalance are valid collateral.
Add tests for BNFCR zero balance and BTC collateral conversion.

* refactor: aggregate all collateral without reference equality check

* fix: shared collateral deduction across quote currencies for EU/MiCA BNFCR mode

- Extract virtual SharesCollateral in CryptoFutureMarginModel
- Override in BinanceCryptoFutureMarginModel: BNFCR present → all USDⓈ-M share pool
- Add BNFCRCurrency const
- Add SharedCollateralDeductsMaintenanceMarginAcrossQuoteCurrencies unit test
- Refactor regression algorithm to assert shared collateral across ADAUSDT/ETHUSDC

* refactor: remove dead IsCryptoCoinFuture guard from BinanceCryptoFutureMarginModel

- Remove IsCryptoCoinFuture() check (coin futures use BinanceCoinFuturesBrokerageModel, not this model)
- Call base.GetTotalCollateralAmount() instead of duplicating primaryCollateral.Amount
- Remove CoinFutureDoesNotIncludeBnfcrAsCollateral test (tested wrong margin model)

* refactor: make GetCollateralCash private in CryptoFutureMarginModel

- No longer accessed by subclasses after removing direct collateral checks from BinanceCryptoFutureMarginModel
2026-04-13 23:24:40 +03:00
Alexandre Catarino 1813a6008f Improves Null Key Handling in Python (#9368)
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / 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
* Improves Null Key Handling in Python

We aim to mimic the following behavior:

```python
>>> d = {1:2}
>>> None in d
False
>>> d.get(None) is None
True
>>> d.pop(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: None
>>> d.pop(None, None) is None
True
```

* Reverts dispose change
2026-04-10 15:17:03 -03:00
Mithilesh Kumar 340f7ca60e Add Python dict headers overload to SubscriptionDataSource (#9363)
API Tests / 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
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 PyObject headers overload for SubscriptionDataSource

* Fix ambiguous constructor chaining in SubscriptionDataSource

* Fix test using-scope for invalid python headers case

* Reuse ConvertToDictionary for PyObject headers

---------

Co-authored-by: stoicAI1776 <m.econyale@gmail.com>
2026-04-08 16:45:09 -03:00
JosueNina 9ccdbec8ee Add ContractMultiplier setter to Cfd via CfdSymbolProperties (#9328)
API Tests / 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
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 ContractMultiplier setter to Cfd via CfdSymbolProperties

* Fix regression tests

* Solve review comments

* Address new review comments

* Fix regression tests

* Use ContractSymbolProperties as base class

* Minor fix

* Address review comment
2026-04-08 10:47:47 -03:00
Jhonathan Abreu 64b0ef386f Add Analysis to Backtest packet (#9375)
Regression Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / 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
2026-04-07 18:13:15 -04:00
Jhonathan Abreu 8f2a23e97f Results analyzer (#9336)
* Initial backtest analyzer commit

* Changes for cleanup

* Minor fix

* Add class for analysis result context

* Fix more models

* More fixes

* More fixes

* More fixes

* More fixes

* Cleanup

* Cleanup

* Add documentation

* Cleanup and remove some classes

* Write backtest analysis to results file

* Cleanup

* Minor fixes

* Minor fix

* Minor cleanup

* Implement json deserialization for backtest analysis result

* Rename analyzer classes to generalize

Remove "backtest" references from names

* Add weight to analyses

* Run analyses in order by weight

* Cleanup

* Cleanup

* Update Issue text

* Set sub-test weights to 0

* Update test weights

* Add xml docs

* Disable result analysis on regression tests

* Refactor analysis naming

* Renaming cleanup

* Simplify analysis results context

* Log when analyzer reaches max tests or time limit

* Sample down equity curve to match daily benchmark

* Minor changes

* Minor fixes

---------

Co-authored-by: Derek Melchin <melchin.derek@gmail.com>
2026-04-07 17:41:12 -04:00
Jhonathan Abreu 09cd4408fa Add new "Idle" AlgorithmStatus (#9374) 2026-04-07 14:05:31 -03:00
JosueNina c8934d1188 Add GetSafeTheta to handle decimal overflow (#9348) 2026-04-07 13:09:42 -03:00
Alexandre Catarino 3b1352fba0 Fix OSI option ticker parsing for symbols containing dots (e.g. BRK.B) (#9343)
* Add failing test for BRK.B OSI option ticker parsing

Adds test case to ParseOptionTickerOSI to reproduce issue #9341 where
Symbol.ParseOptionTickerOSI throws on tickers containing a dot (e.g. BRK.B).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix OSI option ticker regex to support dots in underlying symbol

Extends _optionTickerRegex from [A-Z0-9]+ to [A-Z0-9\.]+ so that
symbols like BRK.B are accepted by ParseOptionTickerOSI.

Fixes #9341

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 13:04:55 -03:00
Jhonathan Abreu 6ee468784d Add PendingInput algorithm status (#9367) 2026-04-07 12:09:07 -03:00
Jhonathan Abreu f00d02be83 Fix references not found in AlgorithmImports (#9352)
API Tests / 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
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
2026-03-25 13:51:00 -04:00
Jhonathan Abreu 4926a4f2cd Initialize and set realtime handler in QuantBook (#9338)
API Tests / 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
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
2026-03-24 11:18:31 -04:00
JosueNina d412fbbfc7 Fix InteractiveBrokersFixModel to reject FOP+Future combo orders (#9323)
* Only reject FOP+Future combos in InteractiveBrokersFixModel

* Address review comments
2026-03-09 17:01:43 -05:00
Jhonathan Abreu 04993e2e2a Add securities when trading non added securities (#9312)
API Tests / 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
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 securities when trading non added securities

* Minor tests fixes

* Minor test fix

* Minor test fixes

* Minor fixes

* Minor test fix

* Minor fix
2026-03-03 17:09:21 -04:00
Jhonathan Abreu 9573eea52e Use universe settings when adding derivatives (#9309)
* Use universe settings when adding derivatives

Use resolution, fill forward and extended market hours settings from universe settings when adding derivative securities (options, index options, futures and future options)

* Minor python syntax check fix

* Minor change

* Default resolution from universe settings for common lean types securities

* Minor test fix

* Cleanup
2026-03-03 12:18:10 -04:00
Jhonathan Abreu 61b57dc4f3 Set OptionStrategy legs symbols on creation (#9304)
* Set OptionStrategy legs symbols on creation

* Address peer review

* Address peer review
2026-02-24 12:59:08 -04:00
JosueNina 4627168302 Fix invalid time on Session working bar (#9300)
* Use consolidated bar as reference for new working bar initialization

* Update ValidateAndScan method and unit tests

* Fix issues with syntax check

* Solve review comments

* Minor fix

* Minor fix
2026-02-24 11:57:35 -05:00
Ahmed Ali 36453d89f6 fix(InteractiveBrokers): Reject unsupported 4-leg ComboLegLimit orders (#9287) (#9301)
API 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
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Fix: Reject unsupported 4-leg ComboLegLimit orders in InteractiveBrokersBrokerageModel (#9287)

* Minor tweaks

---------

Co-authored-by: Ahmed Ali <ahmedalli79x@gmail.com>
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
2026-02-24 11:02:49 -03:00
Jhonathan Abreu 150dac5086 Update Pythonnet version to 2.0.53 (#9303)
API Tests / 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
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
* Update Pythonnet version to 2.0.53

* Minor python syntax fix
2026-02-23 11:24:04 -04:00