I set to receive daily forex price data during live trading. However, on May 1 at 8 PM ET, live trading returns raw price data closing at April 30 and assigned it to the timestamp *2025-04-30 20:00:00*. As a result, *2025-04-30 20:00:00* appears twice in the records. The system then duplicated the raw data, assigning it to *2025-05-01 20:00:00*. I want to receive raw price closing at May 1 instead. Anyone knows why this happened and how to solve this. Also, does this mean QuantConnect delay on receiving daily forex data from brokerage. How long is the delay or how long does it take to get the latest daily data.

Mia Alissi
Here are the notable bugs and issues found in Zoe's 'main.py' (excluding naming, allocation, imports), especially as they affect live daily forex bars and correct QuantConnect usage:
Incorrect Indicator Method Signatures:
self.STO(...)
andself.BB(...)
does not match the QuantConnect API. Correct method signatures areself.sto(symbol, period, resolution)
andself.BB()
does not exist; instead, useself.BB()
orself.BollingerBands()
. Mismatches will cause indicators to not instantiate and runtime errors.Empty or Invalid
elif
/else
Clauses Causing Syntax Errors:Multiple places contain lines such as:
and
These
elif
clauses are empty and will throw a syntax error—Python requires at least apass
or actual code body.Another example:
An
if
statement cannot be empty and must have an indented block; so must itselse
.Redundant/Multiple Schedule Calls within Event Handlers:
ExecuteStrategy
, scheduling: If run daily, this call stacks up, scheduling multiple overlapping events per day, leading to unpredictable behavior.Incorrect Order Direction Logic in
OnOrderEvent
:Possible Use of Uninitialized or Mismatched Data Structures:
self.vix
,self.order_ids[symbol]
, andself.indicators[symbol]
are used without guaranteed initialization for each symbol. For robust code, existence checks are needed before usage.Event Handler Naming and Signature Issue:
on_margin_call_warning
handler should be namedOnMarginCallWarning
for QuantConnect to recognize it. Python is case-sensitive and QC expects exact names.Regarding Zoe's live daily forex bar problem/duplication:
2025-05-01 20:00:00
. If the system duplicates bars at2025-04-30 20:00:00
and then also at2025-05-01 20:00:00
, the underlying issue is likely timestamp alignment or data retrieval/recording logic, not the above bugs in trading logic.How to address:
Resolution.Daily
data.Summary: Fix the actual bugs above to ensure trading logic executes correctly, and re-examine your data fetching/processing code to realign timestamps and prevent duplicate bar issues. This will not only prevent syntax/runtime issues but may also clarify and resolve the live trading daily bar duplication Zoe is experiencing.
Sources: Debugging - QuantConnect.com, Opening Range Breakout for Stocks in Play
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Zoe Ho
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!