Commit Graph

318 Commits

Author SHA1 Message Date
snugs 0d2d6e1e04 Remove coarse->coarse SetUniverse overload 2015-10-07 12:54:27 -04:00
snugs a642e734fd Rename Fundamental namespace to UniverseSelection 2015-10-07 12:54:26 -04:00
snugs 78dc208fc7 Make IBenchmark instead of using Func directly
This is in an effort to keep IAlgorithm usable across various languages
2015-10-07 12:46:56 -04:00
snugs 32d81af072 Change coarse selector to return symbol
This is less restrictive and the engine really doesn't need the
actual coarse data, just needs to know what symbols to request
data for
2015-10-01 13:44:27 -04:00
snugs fbc6c4e4f2 Moved History and warmup API methods into QCAlgorithm.History.cs 2015-09-23 19:11:49 -04:00
snugs bf4a6e731a Remove duplicate in History API implementations 2015-09-23 19:11:48 -04:00
snugs 950c2968bd Remove commented out old history API 2015-09-23 19:11:48 -04:00
snugs 96f20443f5 Fixes bug not adding benchmark security 2015-09-23 14:06:07 -04:00
snugs d4f8006443 Revert "Enforce a 100k bar limit on warmup requests"
This reverts commit 5d30dedb46.

*This check was removed from lean as it is a cloud only concern.
2015-09-22 21:15:08 -04:00
snugs 5d30dedb46 Enforce a 100k bar limit on warmup requests 2015-09-22 20:17:44 -04:00
snugs 19f2fbe0ec Fixes bug in timespan warmup
Better status messaging when finished warmup as well
2015-09-22 19:28:07 -04:00
snugs 089d12b190 Fixes bug running warmup over timespan in live mode 2015-09-22 19:07:15 -04:00
snugs 63ceefc4ed Initial implementation of algorithm warmup 2015-09-22 15:14:46 -04:00
snugs d2c431913f Make one second minimum in bar count calcs 2015-09-22 15:14:41 -04:00
snugs a6c4a8dd22 Doc fix, also moved func next to other similar funcs 2015-09-22 15:14:41 -04:00
snugs c67ff638f4 Renames Symbol.SID to Symbol.Permtick
Coming soon we'll have a full SID system, so renames to make backwards compatibility easier
2015-09-20 23:14:53 -04:00
snugs f30259a08c Properly set algorithm.UtcTime for usage in Initialize 2015-09-20 21:21:50 -04:00
Stefano Raggi fac6f46a9a New Statistics implementation
Added Trade and TradeBuilder classes
Added UtcTime and OrderFee property to OrderEvent class
Added AlgorithmPerformance class with a few metrics + tests
Added portfolio statistics + rolling statistics

Closes #30 via PR #164

Thanks @SteffanoRaggi!
2015-09-16 20:48:02 -04:00
snugs 4ae1f4f5b6 Finalizes History API
Fixes bug in backtest history provider

	Requests for bar counts were always incorrect because the history provider
	was emitting bars whose end time is equal to the start time.
	Implemented a FilterEnumerator<T> privately so he can filter those out
	when using non-tick data
2015-09-15 15:40:54 -04:00
snugs 5b29b8f230 Update IHistoryProvider to use request object 2015-09-15 15:40:52 -04:00
snugs 3ad5540a8a Remove dependency on Security from SubscriptionDataReader
Add dynamic data flag to config
Remove dynamic data flag from Security
Rename dynamically loaded flag to IsCustomData
Remove Security from SubscriptionDataReader ctor
2015-09-15 15:40:12 -04:00
snugs 65f75708bb Initial implementation of IHistoryProvider 2015-09-15 15:40:09 -04:00
snugs e1938baafe Clean up using directives 2015-09-01 22:17:35 -04:00
snugs df79ce30c2 Adds the Symbol type
This includes updating all usages of symbol as a security identifier to use the new type.
The type includes a unique field, SID, as well as the current ticker's value. This allows
for consistent addressability while also allowing the ticker to evolve over time with the
mapping changes.

Effort was made to maintain compile and runtime backwards compatibility.
2015-09-01 22:17:10 -04:00
snugs 4bc2092d8c Adds OnData(SymbolChangedEvents) handler 2015-08-25 21:22:43 -04:00
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