443 Commits

Author SHA1 Message Date
snugs 12c432735f Allow setting of custom data TimeZone 2015-08-12 16:04:36 -04:00
snugs 5de2d80424 Add generic type constraints to AddData<T> 2015-08-12 15:47:32 -04:00
snugs 1a8feaeb60 Remove IsTradeBar/HasVolume from API methods 2015-08-12 14:54:17 -04:00
snugs 8380da11cf Adds fluent interface for scheduled events
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);
2015-08-11 10:51:58 -04:00
snugs b68a8be848 Move Date and Time rules to ScheduleManager 2015-08-10 11:38:48 -04:00
snugs 730430b1bb Adds scheduling feature
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
2015-08-10 10:56:14 -04:00
snugs 844a040be5 Initial impl of coarse universe selection
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
2015-08-06 17:52:23 -04:00
snugs e16c82a856 Adds IAlgorithm.PostInitialize
Resolve benchmark in PostInitialize method
2015-08-06 13:05:05 -04:00
Ray Bohac 1b9c1b7921 Initial implementation of custom benchmarks 2015-08-05 15:30:34 -04:00
snugs 2c1a00fa23 Implements Delisting events in the algorithm
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.
2015-07-29 13:21:25 -04:00
snugs 704bfc2298 Adds new order ticket system
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
2015-07-08 23:40:28 -04:00
snugs 6bd38ece77 Adds international/timezone support
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
2015-07-08 18:45:34 -04:00
snugs 27cd4fbbe5 Fixes bug infinite loop in QCAlgorithm.OnData(Slice) 2015-07-03 17:17:45 -04:00
snugs 87554ecf0d Implements OnData(Slice) and remove v1.0 event handlers
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
2015-07-03 15:15:15 -04:00
QuantConnect fde0cbed3a Strip out block quote section header comments 2015-06-13 16:04:27 -04:00
snugs 4a404b968c Implements BrokerageModel 2015-05-26 10:40:25 -04:00
snugs 225eaf81c9 Initial impl of brokerage model 2015-05-23 15:44:00 -04:00
snugs 89b6e98af8 Fixes warnings mostly relating to xml comments
Also cleans up some block comments

Via PR#72 - thanks @ammachado!
2015-05-13 10:56:47 -04:00
snugs e1827fae31 Implements OnMarginCall and OnMarginCallWarning events
Also fixes bug in ConsoleResultHandler to process log/debug/error messages synchronously
2015-05-12 18:16:25 -04:00
QuantConnect b652895ede Updates to QC Algorithm to allow all messages in live mode 2015-04-30 14:33:25 -04:00
snugs bcbaa6f1da Prevent algo.Time backtracking 2015-04-29 16:57:56 -04:00
snugs 5e419ada8f Some bug fixes/cleanup for IB live trading 2015-04-29 12:54:13 -04:00
snugs 72aba5e5fa Adds dividend data type
Also renamed config.Security to something more sane
2015-04-23 10:31:18 -04:00
snugs 1f15eb2c04 Initial implementation of Margin and Portfolio models
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.
2015-04-13 20:51:43 -04:00
snugs 9924b0a872 Shares SubscriptionDataConfig in Security
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
2015-04-09 10:36:49 -04:00
snugs 4512d5805f Response to some review comments 2015-04-08 18:06:43 -04:00
snugs 3930dff56a Add entries to cash book for each currency on forex 2015-04-08 14:53:29 -04:00
snugs 8f39ff0be9 Adds subscriptions for currency conversions after algo.Initialize()
These subscriptions are needed in order to have accurate conversion rates for computing portfolio value
2015-04-08 14:47:11 -04:00
snugs b9798d7754 Initial impl of CashBook 2015-04-08 14:47:08 -04:00
snugs ad16946615 Bugfix set end date was a day early 2015-04-08 14:14:20 -04:00
QuantConnect ec2671cef8 Merge remote-tracking branch 'origin/master'
Conflicts:
	Engine/Engine.cs
2015-04-06 17:32:24 -04:00
QuantConnect 5af5fec380 Bug fix SetEndDate, SetStartDate to behave like Set dates with numbers 2015-04-06 17:11:36 -04:00
snugs 8a8f40f5ce Moved AlgorithmManager.RunTimeError to IAlgorithm 2015-04-06 15:31:12 -04:00
snugs c4d4a39416 Removed QCAlgorithm.Console override
Replaced with setting System.Console.Out and Error to redirect to QCAlgorithm.Debug/Error
2015-03-31 16:29:36 -04:00
snugs ef04c41f59 Adds DynamicDataConsolidator and uses in ResolveConsolidator
Also renamed example algorithm filenames to match the type name
2015-03-14 15:43:24 -04:00
Adriano Marcondes Machado b2229e8968 Fixed a few compilation warnings 2015-03-09 16:28:17 -03:00
QuantConnect 8c51bfeb24 Restricted date range to avoid 2000 year backtests (common user error 0201 year) 2015-02-25 15:26:06 -03:00
Jared Broad 59be9527a4 Notification manager class intialization and API implementation 2015-02-07 18:02:04 -03:00
Jared Broad 9df45356d5 Added setlimits API to algorithm to limit number of symbols differently for live and backtesting modes 2015-02-04 20:04:58 -03:00
snugs 6a76e63aab Update SetStart/EndDate functions to be full days
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.
2015-01-30 20:31:22 -03:00
snugs 4078d805fb Allows fill forward custom data-testing
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
2015-01-30 13:11:33 -03:00
snugs 733cf998c6 Remove is qc data
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.
2015-01-25 22:47:38 -03:00
Jared Broad b3de520915 Initial commit 2015-01-12 12:03:33 -03:00