A midnight bar was triggering what was intended for only daily data,
restructured ResolveDataEnumerator to allow being called both when there
is more data in the enumerator and when it's not and do the right thing
Adds concept of Subscription to contain everything a data feed needs in order to process single data feed item
Moves preparation of all data to data feed thread, algo thread receives data in format it needs
QCAlgorithm.SetUniverse( func ) allows selection based on market/symbol/dollar volume/price
Remove laziness from Slice as optimization, no order by in real time handler
Clean up offset provider
Fixes bug in GetBetterTypeName
Adds redelivered flag to log
Fixes bug in Slice.Time
Fire Slice only if data; Fire SecuritiesChanged after update
Add return to margin warning try/catch
Default implementation modifies order prices/quantities to maintain value
Tradier implementation cancels reverse splits and performs the default on forward splits
This change adds OnData(Delisting data) event handler to the algorithm and is fired when a security gets delisted.
Likewise, when a security is delisted, data will stop being sent into the algorithm and if the algorithm has any
holdings then a MarketOnClose order is submitted at midnight on the last day of trading. If you require that the
algorithm does not sell its shares, then you must cancel the MarketOnClose order before close of trading.
RealTimeSynchronizedTimer now triggers based on UTC time
LiveTradingDataFeed used UTC time to add to bridge
Renamed Security.Time to Security.LocalTime to be explicit
Renamed SecurityExchange.Time to SecurityExchange.LocalTime to be explicit
QCAlgorithm order functions now return an OrderTicket
OrderTicket can be used to directly update or cancel an order
Placing an order now submits an OrderRequest which is processed by the ITransactionHandler
Time sync:
* Data feeds are required to time sync in UTC time
* TimeSlice.Time is now in UTC
IAlgorithm
* Time is now exclusively the algorithm's local time zone
* Added UtcTime
* SetDateTime( DateTime ) accepts a UTC time and is internally converted
SubscriptionDataConfig
* Adds market and time zone as required ctor parameters
SecurityExchange
* Now passes most calls directly through to SecurityExchangeHours class
SecurityExchangeHours
* Holds market hours for each day of week (LocalMarketHours)
* Talks in terms of local times in the SecurityExchangeHours.TimeZone time zone
Data/market-hours/
* New data folder to hold market hour information
* Includes market-hours-database.csv to hold market hours per market/symbol/security (see doc in file)
* Includes holidays-usa.csv to hold holidays for 'usa' market
+ The holiday files follow the pattern 'holidays-*.csv' where * is the market
TimeKeeper
* Receives updates in UTC time
* Passes that to LocalTimeKeeper's who lazily evaluate the time in their respective time zones
* Eventually this can grow to be the sole source of time in the algorithm's scope
MISC:
* Fixes exception thrown when exiting LiveTradingDataFeed
* Fixes exception thrown when exiting FileSystemDataFeed
* Fixes exception thrown when exiting StatusPing
* Simplify FillForwardEnumerator logic with GetNextMarketOpen
* Adds many time zones, see TimeZones.cs
Also cleans up IAlgorithm interface of unused/old methods
Slice is a new type that contains all the data from a time slice to be sent into an algorithm
DataFeeds now expose a single bridge (BlockingCollection<TimeSlice>)
- IDataFeed now responsible for all time syncing, DataStream was removed
- BlockingCollection allows for easy throttling of data feed thread without sleeps (internally using semaphore slim)
- Slimmed down IDataFeed interface to not include members unused externally
DataFeeds now use raw IEnumerator<BaseData> instead of subscription data readers directly
- Simplifies fill forward logic (see FillForwardEnumerator.cs and FillForwardEnumeratorTest.cs)
- Allows for composition (raw reader -> fill forward, user/market filters)
- SubscriptionDataReader now handles refreshing source (continuous enumeration)
LiveTradingDataFeed cleaned up to work with time slice bridge
- RealTimeSynchronizedTimer handles pushing time slices into bridge every second, with or without data
- Subscriptions with tick resolution get their data pushed directly into the bridge immediately
Fill forward changes
- Implemented as an IEnumerator<BaseData>
- Fill forward lower res on higher res (daily gets filled forward on second/minute/hour bars)
- Second/minute/hour will not be filled forward on daily bars (at midnight) in line with current behavior
MISC:
- Performance boost in backtesting brokerage via not checking _pending.Count, instead use local bool to determine if there's pending orders
- Added a FakeDataQueue to aid in testing LiveTradingDataFeed
- FileSystemDataFeed now uses CancellationTokenSource to handle thread exits
- Added logging
Adds EndTime to BaseData
Adds Period to TradeBar
Now filling data forward on days missing files/data
Some performance enhancements
Removed sorted dictonary in DataStream/AlgorithmManager
We round down fill forward data in the data stream since if we were to perform this in the data feed we would continually produce data at the same time and it would all go into the algorithm at once.