Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Market On Open isn't accurate

Aperta
#9,503 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp
Ambito
backend

Direzione di ricerca

Inizia da EquityFillModel.cs, in particolare dai rami Tick e TradeBar citati nel report, e riproduci il comportamento con un backtest con dati al minuto contenente ordini market-on-open. Verifica come vengono selezionati il TradeBar memorizzato nella cache e il prezzo ufficiale di apertura, quindi aggiungi o aggiorna test mirati in modo che il fill utilizzi l’apertura giornaliera prevista e che la tempistica riportata venga corretta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Expected Behavior

Market on open should mimic the official open price for the day when subscribing to regular data feed (such as minute) as outlined here
https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-open-orders

Actual Behavior

this backtest isnt actually producing any results as described in the article.
as well i have noticed on other backtests that when subscribing to minute data the qc takes the 2nd bar after the open (the bar of 09:32 and not and not 09:31 as outlined in your article... )

Potential Solution

might be related to this:

For MOO, official opening price is only used in the Tick branch: EquityFillModel.cs (line 458) looks for OfficialOpen | OpeningPrints.
But our algo subscribes to minute TradeBars, so LEAN uses this branch instead: EquityFillModel.cs (line 503). That branch literally does:

_var tradeBar = asset.Cache.GetData<TradeBar>();
fill.FillPrice = tradeBar.Open;_

at line 505 (line 505) and line 518 (line 518).
So yes: with minute bars, QC MOO can fill from the cached minute bar Open, not the official daily open. If the cached bar is the 09:31-09:32 bar, the report shows 09:32 and price matches 09:31 open.

Reproducing the Problem

create a backtest with subscribing to minute data and do some MOO, see that trade prices are not the daily open prices.

System Information

QC CLoud

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Lingua principale
C#
Stelle
21.9k
Fork
5.3k
Merge medio
19h 31m
PR unite (30g)
44

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantConnect/Lean

Tutte le issue di QuantConnect/Lean

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.