Commit Graph

256 Commits

Author SHA1 Message Date
Stefano Raggi ec5d4c0621 Filter consolidator inputs on data resolution
This update reverts PR #664 and includes an improved filtering solution.

It prevents consolidators and indicators from receiving inputs at a resolution higher than the data subscription resolution, typically fill-forward bars.
Volume-based indicators and consolidators will now be calculated correctly with fill-forward data.

It also fixes the RegressionAlgorithm failing test.
2017-01-12 00:56:58 +01:00
quant1729 145ba7bd83 Updated code as per PR 2017-01-02 19:47:23 +01:00
quant1729 3819561a82 Merge branch 'futures' into master-futures-merged
Conflicts:
	Common/QuantConnect.csproj
	Tests/RegressionTests.cs
2016-12-01 17:32:40 +01:00
quant1729 92a3be5ea5 Merge branch 'futures-quotebar-easy' into futures
Conflicts:
	Common/Securities/SecurityManager.cs
2016-11-28 14:46:46 +01:00
quant1729 55299e60fb Added new constructors to IBMapper class
Added support for history requirements, exposed by vol models. AM processes requirements.
Added new volatility model - standard deviation of returns - default vol model. Compared its results with publicly available.
Refactored option pricing engine to support optimal approximation calculations.
Added basic greeks approximation in case they are not available in QL. Tests.
Updated BasicTemplateOptionHistoryAlgorithm to print greeks.
2016-11-25 15:11:01 +01:00
Andrew Hart 835fca41ca Live FX trading can use quotebar data 2016-11-22 11:11:26 -05:00
Andrew Hart 6cd52a0b60 FX quotebars are now passed to algo as tradebars 2016-11-22 08:31:09 -05:00
Andrew Hart 20c11e8e9d If QuoteBar data is present, OnData(TradeBar) will still work 2016-11-21 15:21:31 -05:00
Michael Handschuh 5809527a95 Scan consolidators to emit based on time
Currently, most consolidators rely on receiving a piece of data after
the consolidation period before firing the consolidated event. This
introduces a lag in the results. We've mostly gotten around this  for
the most common case through usage of the IdentityConsolidator.

The issue arises when considering fill forward behavior and subscriptions
with different resolutions.

Consider a Minute subscription a Daily subscription. Default behavior will
fill forward that daily bar on every minute. If your indicator is based on
the IdentityConsolidator, then it will receive the same price update for
each minute the security trades that day.

By scanning the consolidators based on time, the consolidator is able to
determine that it is indeed time for it to emit a new consolidated bar.
This removes the need for the IdentityConsolidator while also fixing the
aforementioned bug.
2016-11-15 23:36:26 -05:00
quant1729 1141cd21e6 Merge branch 'futures' into master
Conflicts:
	Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
	Algorithm/QCAlgorithm.cs
	Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
	Common/QuantConnect.csproj
	Common/Securities/Option/Option.cs
	Data/equity/usa/factor_files/aapl.csv
	Data/symbol-properties/symbol-properties-database.csv
	Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactory.cs
	Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactory.cs
	Engine/DataFeeds/SubscriptionDataReader.cs
	ToolBox/QuantConnect.ToolBox.csproj
2016-11-07 16:18:11 +01:00
AlexCatarino e3c6e46da2 Adds divide by zero check before computing sample performance 2016-10-03 17:30:15 -03:00
quant1729 2dce74e26d - Extended Option security and Option holding classes
- Updated IB fee model to support option exercise
- Added support for splits for options. Not tested on real data yet.
- Added option exercise functionality for long positions. Unit Tests. Not tested on real data yet.
- Added option assignment functionality for short positions. Assignment event. Unit Tests.
- Added basic option assignment simulator for backtesting brokerage. Simulates assignments for deep ITM short positions close to expiration. Unit Tests.
2016-08-31 18:00:00 +02:00
AlexCatarino 9d32d4fd06 Reverts commit f4abe9c
Modifies logic in AlgorithmManager to account transations in the delisting day
2016-08-30 13:05:41 -03:00
Stefano Raggi 350fd6afe2 Fixed missing delisting events 2016-08-30 12:58:21 -03:00
AlexCatarino ede02d1b9b Fixes Delisting bug
Reverts commit f4abe9ce

Now delisted securities are removed using IAlgorithm.RemoveSecurity that properly removes a security from a SecurityManager: keeps it at the Portfolio, but remove it from the user universe, unsubscribing to the datafeed in the process.
2016-08-30 12:57:56 -03:00
AlexCatarino f4abe9ce51 Prevents security removal from portfolio when delisted
Removing delisted securities from portfolio causes loss of information that is necessary to compute the algorithm statistics.
2016-08-19 12:58:35 -03:00
Michael Handschuh 04db12106a Merge remote-tracking branch 'origin/multi-subscriptions' into options-new
Conflicts:
	Engine/DataFeeds/UniverseSelection.cs
	Tests/QuantConnect.Tests.csproj
2016-04-13 12:45:05 -04:00
Michael Handschuh 2057858cfb Adds UpdataData<T> to clean up key value pairs in TimeSlice 2016-04-12 19:06:56 -04:00
Michael Handschuh 14776c6c21 Adds subscription configuration to DataFeedPacket ctor 2016-04-12 19:06:55 -04:00
Michael Handschuh 42465ffd52 Clean up IsInternalFeed usages 2016-04-12 19:06:49 -04:00
Michael Handschuh 73a4595d48 Adds Security.DataNormalizationMode
A security must have a single normalization mode, any added subscriptions will need to be forced to the current mode and when updating the mode it must be done to all... this should probably be a 'locked' property as well since changing it mid execution can lead to unexpected behavior
2016-04-12 19:06:35 -04:00
Michael Handschuh e7c37a84ff Adds support for OnData(QuoteBars/OptionChains) 2016-04-07 13:39:30 -04:00
Michael Handschuh 83d6fc6560 Allow multiple security data updates per time slice 2016-03-31 20:00:39 -04:00
Michael Handschuh 3a39647851 Log algorithm time on splits and dividends 2016-03-31 16:05:01 -04:00
Michael Handschuh aa7d6be125 Simplify custom data check in algo manager 2016-03-22 09:57:37 -04:00
Michael Handschuh a3d7d66554 Converts cache list kvp to list DataFeedPacket 2016-03-02 20:36:20 -05:00
snugs f1968d1217 Remove algo id from IResultHandler.SendStatusUpdate
IResultHandler has an Initialize method which accepts a job, so all instances should know
they job (algo id, proj id, user id) and so these methods shouldn't be requiring the field
2016-01-11 15:11:08 -05:00
snugs 5b19d7d925 Dont submit zero qty orders on delistings 2015-12-30 00:01:41 -05:00
snugs abb7923f37 Set default fill forward res to Second for hist reqs 2015-12-23 16:08:43 -05:00
snugs fc7d507faa Fixes benchmark symbol when not manually added 2015-12-21 16:41:32 -05:00
Stefano Raggi 13014c80ec Fixed bug in warmup history requests 2015-12-20 13:31:02 +01:00
snugs db2b0a8fe4 Replace DateTime.Now with DateTime.UtcNow
TimeSlice.Time is in utc, so we should always compare against ther UTC times
2015-12-18 12:12:40 -05:00
snugs ffd9d138cc Move try/catch to algo manager 2015-12-17 18:04:49 -05:00
snugs 4f73c7ecea Make Slice DataDictionary lazy eval 2015-12-07 12:02:16 -05:00
snugs 8674941770 Make IDataFeed : IEnumerable, remove IDataFeed.Bridge 2015-12-07 12:02:02 -05:00
QuantConnect baa64dec47 Bug fix custom data algorithms 2015-12-02 18:28:01 -05:00
snugs be950e756a Log full errors/stack traces
Many places in the code used Log.Error(err.Message) or equivalent which
strips out all the really useful information, such as the stack trace
and inner exceptions. Using Log.Error(exception) is the correct way to
log an error as it will correctly write all the message details, also,
by passing the full Exception object we can improve the logging in this
one place and all call sites will automatically benefit from the improvements
2015-12-02 12:35:33 -05:00
snugs 601c6b54cf Send CommandResultPacket to IResultHandler for dispatch 2015-11-23 20:11:51 -05:00
snugs 9e660ffcbe Remove usages of Symbol implicits from non-algorithm projects 2015-11-18 18:15:31 -05:00
snugs 7b6c82841f Initial implementation of SecurityIdentifier 2015-11-12 13:55:42 -05:00
Stefano Raggi 01afc560f4 Added Settlement models
- New ISettlementModel interface with implementations:  ImmediateSettlementModel + DelayedSettlementModel
- SecurityPortfolioManager: UnsettledCashBook + ScanForCashSettlement
- Added tests for settlement models
- Added GetSettlementModel to IBrokerageModel
- Added AccountType argument to SetBrokerageModel()
- Added SetBrokerageModel(IBrokerageModel) overload
- Made BrokerageModel setter private
2015-11-11 22:18:34 -05:00
snugs d696f09b28 Adds IAlgorithm.Status
AlgorithmManager._algorithmState was removed and replaced with
pass through to IAlgorithm.Status
2015-11-09 11:18:41 -05:00
snugs 7630eaf357 Remove AlgorithmStatus.Quit, merged into Stopped 2015-11-06 20:31:40 -05:00
QuantConnect 513859f18e Added LEAN version to the server statistics, added quit state to acceptable exit conditions 2015-11-06 14:31:11 -05:00
snugs 3285198cfe Implements ICommandQueueHandler
The command queue provides external messaging into the algorithm.
It yields ICommand instances which are runnable against the algorithm.
This allows a user to exercise some control/change over the algorithm's
behavior while it's still running.

To show the pattern, I've implemented the Order, Liquidate, and Quit commands
2015-11-04 21:26:14 -05:00
snugs a634f6d8b8 Add type check before method invoker call 2015-11-03 19:32:05 -05:00
snugs b56b8bde38 Check data, not just timeslice.time in handover
The first emit from the live bridge can have more data than usual since
the first emit is dependent on when the Run method is actually called.
Inspect all data and make sure it's after the handover time
2015-11-03 19:20:32 -05:00
snugs cbc323dd43 Add padding to warmup handoff
Cases can arise such that the data feed's first iteration includes data
for about 50ms before the feed time sync loop is actually started, so give
a 100ms buffer on the handoff time check
2015-11-03 15:49:04 -05:00
snugs 6f15f4139b Move all subscriptions into a universe 2015-10-21 13:05:11 -04:00
snugs 4eb29a23f5 Generalize IUniverse selection method 2015-10-07 12:54:30 -04:00