Algorithms can now use syntax like the following to define events:
Schedule.Event(name).{DateRuleMethod}.{TimeRuleMethod}.Run( lambda )
For example: Schedule.Event(tues).Every(DayOfWeek.Tuesday).AfterMarketOpen(SPY, 20).Run(MyTuesdayHandler);
Adds the ScheduleManager which allows an algorithm to add/remove scheduled events
Check out the ScheduledEventsAlgorithm for syntax
ScheduledEvents are at their core an IEnumerator<DateTime> that defines the event times coupled with a callback
IDateRule defines dates for events
ITimeRule defines time(s) on a given date for events
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
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.
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
Changed system to use Margin Models, removing leverage wherever possible allowing for dynamic margin models.
Created first portfolio fill model for FOREX which treats it as a currency swap through the cashbook instead of a tradable asset.
Updated the Securities/SecurityPortfolioManager to use cashbook value + holdings removing FOREX virtual positions.
Created a new benchmark system for comparing quantconnect builds.
Updates Securities.Update to take a slice of the 'newData' collection from AlgorithmManager to prevent an n^2 problem
This also has the affect that now all security prices are updated before ANY OnData events are fired (previously imported data could fire before these)
Adds the SubscriptionDataConfig to the Security object and requires it when adding new Securities in SecurityManager
Adds the SubscriptionIndex field to SubscriptionDataConfig, always handled by SubscriptionManager
Using the SetEndDate function would end up with the last day of data not being processed due to a period start/finish filter in the SubscriptionDataReader.MoveNext() function. Updating the SetEndDate to make the DateTime value to last moment in the day solves the issue. It also ends up fixing a lingering bug in the ConsoleResultHandler where we were computing the wrong number of days to process.
Includes new AddData<T> overload to accept fillforward and leverage parameters
Moved the clone implementation in BaseData to ObjectActivator
Added some test BaseData types that can be used as custom data but just patch through to default data locations
Removing the isQcData flags allowed better support for consistency between different data types. This has a knock-on effect of allowing custom data to be fillforward and loaded from a file system.