Commit Graph

10 Commits

Author SHA1 Message Date
AlexCatarino 720e0400fc Implements custom seed function to CustomSecurityInitializerAlgorithm 2018-09-17 18:28:59 +01:00
Stefano Raggi c6693cb237 Disable automatic security seeding
In this PR we are disabling the default security seeding (automatically getting the last price for a security when added to the algorithm) for a couple reasons, both when using large universes:
- In live trading, these history requests are sent to a history server, potentially causing timeouts
- In backtesting, depending on the algorithm this could also cause slowdowns up to 30%
2017-12-22 21:49:14 +01:00
AlexCatarino ebb8f499f3 Adds CustomSecurityInitializerAlgortihm for python
This algorithm serves as an example for the SetSecurityInilializer for python feature
The date range for the C# version is changed to match existing data
2017-10-11 10:38:18 +01:00
Jared Broad 61043d9d98 Tagged algorithms for QCU 2017-09-20 15:44:51 -04:00
Stefano Raggi a62fab742c Fix SetBrokerageModel when called after AddSecurity and friends
Currently, calling SetBrokerageModel after AddSecurity, AddForex, etc. has no effect, the security initializer has already been initialized and its models have been set to their default implementations.

For example, Forex backtests using OandaBrokerageModel will report fees calculated with the default fee model (Oanda fees are spread-based, so they should always be reported as zero).

In this PR, SetBrokerageModel now calls SecurityInitializer.Initialize on all securities added before SetBrokerageModel is called.

Fees will be calculated using the correct fee models and the order of the calls in algorithm Initialize is now irrelevant.
2017-04-07 15:40:24 +02:00
Stefano Raggi a0dac817ef Revert commit cb8f451 2017-01-06 15:41:52 +01:00
Stefano Raggi cb8f451ebb Disable margin calls by default in live mode 2017-01-05 15:09:32 +01:00
Andrew Hart d81b436b30 Added BrokerageModelSecurityInitializerTests
Renamed ISeedSecurity GetLastData to GetSeedData

Renamed QCAlgorithm.History.GetSingleBarHistory to GetLastKnowPrice

Minor Style refactor
2016-12-01 11:55:48 -05:00
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 0cde677551 Adds CustomSecurityInitializerAlgorithm example
An ISecurityInitializer implementation will be run after calls to AddSecurity.
A custom implementation can be specified by calling SetSecurityInitializer(...).
The default implementation sets the fill/fee/slippage/settlement models based off the BrokerageModel.
2016-01-19 15:35:41 -05:00