Commit Graph

1000 Commits

Author SHA1 Message Date
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
roei 788b598b6d Parabolic SAR indicator
Added new PSAR indicator and associated helper method and test.
The PSAR implementation is based on the TA-Lib project implementation.
Included test use the provided spy_parabolic_SAR.txt data.

PR #165
2015-09-16 11:41:05 -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
lockyssmith b79431a8c9 Creates the Keltner Channel indicators with KCH short code 2015-09-14 16:44:24 -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
Michael f42f1f47d9 Merge pull request #155 from chutes/master
Creates log return indicator and tests

Closes #154 - thanks @chutes
2015-08-27 09:52:43 -04:00
snugs 4bc2092d8c Adds OnData(SymbolChangedEvents) handler 2015-08-25 21:22:43 -04:00
snugs ed957a74a7 Produce symbol changed events 2015-08-25 21:22:42 -04:00
Mitchell Suzuki f4a016d679 created log return indicator and tests 2015-08-25 16:23:03 -04:00
Michael b0287b529c Merge pull request #151 from adriantorrie/issue-150/asymmetric-donchian-channel
Add DonchianChannel constructor overload

Thanks @adriantorrie for the great contribution!
2015-08-19 17:30:48 -04:00
Adrian Torrie 121aa55664 Add overload helper method in QCAlgorithm for DonchianChannel indicator 2015-08-18 21:21:38 +10: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 9502138167 Simplify DynamicDataConsolidator constructors/impl 2015-08-12 14:36:20 -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
QuantConnect 06b493902c Merge branch 'master' of https://github.com/QuantConnect/Lean 2015-08-05 18:10:11 -04:00
QuantConnect 770d89e532 Tweak CalculateOrderQuantity to use same price variable for error detection and math 2015-08-05 18:09:43 -04:00
Ray Bohac 1b9c1b7921 Initial implementation of custom benchmarks 2015-08-05 15:30:34 -04:00
snugs 7dc00cb2f8 Add Identity overload for TimeSpan 2015-08-01 13:30:45 -04:00
snugs 9658bedc59 Overload RegisterIndicator to take TimeSpan 2015-08-01 13:06:45 -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 0a74f6fe24 Fixes bug in order time stamps
This also resolves an issue of filling daily orders on open of same bar
2015-07-27 18:52:32 -04:00
Michael 0a43624549 Adds check for data in CalculateOrderQuantity
Adds check to verify we have data for the security
2015-07-27 13:09:45 -04:00
QuantConnect 6064662514 Improves SetHolding implementation and provides tests 2015-07-21 11:14:19 -04:00
snugs 9bc0c8e450 Updates order field to properties with internal set
This is to compile break user algorithms trying to set order properties to perform order updates
2015-07-16 00:53:38 -04:00
QuantConnect fea7d4de25 Rework setholdings to allow multiple calls. Changed behavior to be VALUE not BUYING POWER 2015-07-14 15:58:44 -04:00
snugs 0d48732546 Misc fixes
Send isLiveMode directly into data readers instead of resolving from data feed endpoint
Added some expression extensions, AsEnumerable()  :)
Fixed Identity names, added optional name parameter for deconflicting
2015-07-09 22:44:12 -04:00
snugs 4cc5c1daf7 Use fill price for order value when filled 2015-07-09 18:24:03 -04:00
snugs d636b10dca Remove market price as parameter to SubmitOrderRequest 2015-07-09 11:12:18 -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
snugs 9c1b0f4616 Move order/order queue storage to transaction handler
Expose order and order processing ability via IOrderProvider/IOrderProcessor
2015-07-02 15:07:35 -04:00