Commit Graph

149 Commits

Author SHA1 Message Date
Andrew Hart 54df455813 Added ISecuritySeeder to seed security prices when securities are created
FuncSecuritySeeder implements this new interface and is used in BrokerageModelSecurityInitializer to seed new securities with a price when they are created. FuncSecuritySeeder uses a new method,  GetSingleBarHistory, in QCAlgorithm.History to get the last price from the history provider.
2016-12-01 08:37:04 -05:00
Michael Handschuh 591f6b2127 Use IBaseData in type constraints
Refactors existing consolidators, indicators, and helper methods to depend on
IBaseData instead of BaseData. These updates also defines an IBaseDataBar to
act as an abstraction point between TradeBar and QuoteBar.
2016-11-09 09:20:16 -05:00
Stefano Raggi b6a96c38c1 Fix benchmark subscription when same symbol added later
This change handles subscriptions when adding/removing the benchmark symbol from OnData or in universe selection.
2016-10-17 23:41:12 +02:00
AlexCatarino 183cb917fe Makes IAlgorithm Debug/Error/LogMessages a ConcurrentQueue
IAlgorithm DebugMessage, ErrorMessage and LogMessage are now ConcurrentQueue<string> instead of List<string> because List.Add is not thread safe.
Copying a list (using ToList()) at LiveTradingResultHandler while adding an element to it at QCAlgorithm caused a runtime error.
2016-09-27 14:02:28 -03:00
Andrew Hart a8621ba99c Default security markets are specified in BrokerageModel.DefaultMarkets
The default value for the market parameter in AddForex, AddOption, AddEquity and AddCfd is null.  This allows unspecified markets to be set from the BrokerageModel.DefaultMarkets in the AddSecurity method for new securities added with these methods.  SetBrokerageModel updates BrokerageModel.DefaultMarkets and therefore the market used for all new securities.
2016-09-22 14:50:48 -04:00
AlexCatarino 82d81108ad Implements price variation models
Implements IPriceVariationModel interface which takes the security object and returns a decimal variation
Implemets SecurityVariationModel class: default implementation of IPriceVariationModel that returns a fixed value (read from symbol-properties-database) for decimal variation
Implemets EquityVariationModel class: implementaion of IPriceVariationModel that returns a decimal variation as a function of equity price
Implemets AdjustedPriceVariationModel class: implementaion of IPriceVariationModel that returns zero
Adds unit test
2016-09-20 15:36:04 -03:00
jaredbroad 1642aed05a Refactor PreOrderChecksImpl() and add lot size check for 0-quantity orders 2016-07-13 16:00:37 -04:00
Michael Handschuh 5fe577f331 Adds Option.Underlying, set via PostInitialize
Individual option securities will have this value set by the Universe on security creation
2016-04-07 14:33:55 -04:00
Michael Handschuh 7b183eded3 Add equity security for options in PostInitialize 2016-04-07 14:18:25 -04:00
Michael Handschuh e392183bb4 Adds QCAlgorithm.AddOption 2016-04-07 14:12:47 -04:00
Michael Handschuh e7c37a84ff Adds support for OnData(QuoteBars/OptionChains) 2016-04-07 13:39:30 -04:00
Michael Handschuh 12d8df887a Remove duplicate universe storage in QCAlgorithm 2016-03-16 19:39:35 -04:00
Michael Handschuh 262900a5dd Fixes bug in forex symbol properties quote currency 2016-03-02 23:27:12 -05:00
Michael Handschuh ba22908dc5 Adds AddEquity/Forex/Cfd methods 2016-03-01 14:06:36 -05:00
Stefano Raggi 4d9ddc7f72 Moved QCAlgorithm pattern helpers to CandlestickPatterns class 2016-02-24 00:56:54 +01:00
Michael Handschuh 1d07e5d31a Move IBrokerageFactory.DefaultMarkets to IBrokerageModel 2016-02-04 13:27:53 -05:00
Stefano Raggi f7f4e961e4 Update SecurityManager.CreateSecurity overload to take a SymbolProperties argument 2016-02-01 23:33:55 +01:00
Stefano Raggi 6a381a990e Adds SymbolPropertiesDatabase argument to SecurityManager.CreateSecurity 2016-01-23 00:03:50 +01:00
Stefano Raggi f5d2eb0b8a Adds symbol properties database loading in QCAlgorithm 2016-01-22 23:49:41 +01:00
Michael Handschuh 4783a1ace9 Calls to SetBrokerageModel create new SecurityInitializer
... unless SetSecurityInitializer has been called (explcitily set by user),
in which case we'll respect what the user passed in.
2016-01-19 15:33:29 -05:00
Michael Handschuh 473a3a6dc5 Extact IBrokerageModel factory method from enum 2016-01-19 15:24:28 -05:00
Michael Handschuh d4131317cc Adds SetSecurityInitializer helpers in QCAlgorithm 2016-01-19 15:18:08 -05:00
Michael Handschuh fc0bc11909 Move IAlgorithm.AccountType->IBrokerageModel.AccountType 2016-01-19 15:12:15 -05:00
Michael Handschuh 7fb2073fab Invoke ISecurityInitializer in Security.CreateSecurity
This removes the SetupHandler.UpdateModels(...) method which used the brokerage
model to set fill/fee/slippage/settlement models. This will also allow the
removal of flags indicating that the user has set certain Security properties
2016-01-19 13:13:00 -05:00
Michael Handschuh 55586ef819 Adds SecurityInitializer to IAlgorithm 2016-01-19 12:42:36 -05:00
snugs 589a84224d Fixes bug market benchmark as internal feed
Updated the AddToUserDefinedUniverse method to handle adding to the Securities
collection to prevent this from happening again.
2015-12-28 11:05:26 -05:00
snugs fc7d507faa Fixes benchmark symbol when not manually added 2015-12-21 16:41:32 -05:00
snugs f33cffe77f Moves asset count limit logic out of Algorithm namespace
Since we now support universe selection and by convention never remove a security
object, we can't rely on the counts of the security manager to perform limits on
data subscriptions, this logic was moved deeper into the engine, where we perform
UniverseSelection, which is the path taken to add new data subscriptions
2015-12-21 16:13:23 -05:00
snugs 2b0fd189ed Renames IAlgorithm.Universes->UniverseManager 2015-12-17 17:32:13 -05:00
snugs 380149fe9a Change benchmark resolution if universes are present 2015-12-17 17:22:51 -05:00
snugs a77950ce56 Adds UniverseDefinitions, DollarVolumeUniverseDefinitions 2015-12-17 17:17:56 -05:00
snugs ba710ae7b1 Change default min time in universe to 1 day 2015-12-17 14:56:24 -05:00
snugs 0f599f5697 Reverts preventing set cash in live mode
We were leaning on BrokerageData having project equity in there, but
this breaks home consumers who would expect the SetCash function to
just work
2015-12-15 14:39:38 -05:00
snugs 0fbab8a550 Check SymbolCache when adding securities, enables delisted 2015-12-15 08:58:15 -05:00
snugs ada41f7e8f Adds MinimumTimeInUniverse to UniverseSettings 2015-12-14 19:13:24 -05:00
snugs a29ebf0595 Rename SubscriptionSettings to UniverseSettings 2015-12-14 16:58:18 -05:00
snugs 957fba1ea5 Disable SetCash in live mode
If required, use Portfolio.SetCash, this is what the setup handler now uses
2015-12-11 16:41:30 -05:00
snugs 53a64ea3ba Use default market map in AddSecurity 2015-12-10 15:19:23 -05:00
snugs 8dad5f4c0a Adds IAlgorithm.SetDefaultMarkets 2015-12-10 15:19:21 -05:00
snugs bc6ffbce0c Set algorithm parameters from job packet 2015-12-10 13:45:40 -05:00
snugs b167b7725d Adds GetParameter and SetParameters to IAlgorithm 2015-12-10 13:45:39 -05:00
snugs f3834df1a0 Return Security instance from IAlgorithm.AddSecurity 2015-12-09 13:32:37 -05:00
snugs 565c3bc6f7 Adds AddRemoveSecurityRegressionAlgorithm 2015-12-09 13:32:34 -05:00
snugs fa12434f98 Remove locked check from AddSecurity
This now allows algorithms to add securities during a running algorithm
2015-12-09 13:32:31 -05:00
snugs 3a322e0877 Change IAlgorithm.Universes to use UniverseManager type 2015-12-09 13:32:29 -05:00
snugs 7e37804c7e Use Symbol.Create instead of SID.Generate* methods 2015-12-07 12:31:46 -05:00
snugs 796b9666db Adds QCAlgorithm.Universe for universe functions 2015-12-07 12:02:07 -05:00
snugs 242f479fb3 Remove SetUniverse, now only AddUniverse 2015-12-07 12:02:07 -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 c6d0fc673b Force custom securities through CreateSecurity
AddData<T> was never properly converted to go through the SecurityManager.CreateSecurity
method which led to custom symbols not being loaded into the symbol cache.
2015-12-02 10:58:26 -05:00