Commit Graph

102 Commits

Author SHA1 Message Date
Martin Molinero 8d5745319e Obsoleting Securities configurations properties
> This PR is a mechanical refactor, no behaviour changed

- Obsoleting `DataNormalizationMode`. Replacing the usaged by requesting
the `SubscriptionDataConfigs` to the new `SubscriptionDataConfigService`
> Note we still need to refresh the Security.DataNormalizationMode
property.
2018-12-05 10:41:21 -03:00
Martin Molinero 7d7ad17883 Obsoleting Securities configurations properties
> This PR is a mechanical refactor, no behaviour changed

- Obsoleting `IsFillDataForward`, `Resolution`, `IsExtendedMarketHours`
`Security` configuration properties. Replacing there usages by
requesting the `SubscriptionDataConfigs` to the new
`SubscriptionDataConfigService`
2018-12-05 10:05:53 -03:00
Martin Molinero 95af5f8877 SecurityHolding has a ref to an ICurrencyConverter
- `SecurityHolding` will now have a reference to a `ICurrencyConverter`
instance, provided as a constructor argument, called by the owning `Security`.
2018-12-04 17:06:56 -03:00
Martin Molinero 251071ee73 Remove Security from Subscription
- Removing unneeded `CashBook` instance to create a new `TimeSlice`
- Adding new `TimeSliceFactory`, an instance base class that will
provide methods to create a new `TimeSlice`. Will own the `DateTimeZone`
property.
- Adding new `ISecurityPrice` and `IOptionPrice` that will provide a
reduced interface for accessing price properties and methods used when
creating a new `TimeSlice`
2018-11-14 18:28:18 -03:00
Martin Molinero ac7a2601f2 Remove obsolete ISecurityTransactionModel
This commit will allow an easier `FillModel` refactor:
- Removing `ISecurityTransactionModel` and its implementations
- Merging identicall tests from `EquityTransactionModelTests`,
`ForexTransactionModelTests` and `SecurityTransactionModelTests` under
`ImmediateFillModelTests`. This was possible because the mentioned
`TransactionModels` implementations used `ImmediateFillModel`
2018-11-09 15:22:37 -03:00
Michael Handschuh 20133d40d1 Add ICurrencyConverter to Security constructors
Security instances will require private access to this value in order to
compute close profit.

NOTE: The extent of these changes for simply adding a constructor argument
insinuates that we're missing an abstraction to manage the construction of
these objects, such as a factor object for Security. This will need some
careful TLC in the near future.
2018-10-10 11:17:12 -04:00
AlexCatarino f1a1dd0091 Enables custom buying power model setting in python
- Adds `BuyingPowerModelPythonWrapper` to wrap a python class that represents a custom buying power model.
- Adds `SetBuyingPowerModel` and `SetMarginModel` to enable the seeting of custom buying power model.
2018-08-21 12:04:49 +01:00
Martin Molinero 78742e5df6 Adding cash buffer for IB Cash Accounts 2018-08-10 17:21:50 -03:00
Michael Handschuh 5879e477b7 Mark delisted securities as not tradable
Add regression test for delisted/tradable flags.
Add Security.IsDelisted to flag.
2018-05-07 11:41:24 -04:00
Michael Handschuh 351ac55f7f Rework implementation of maintaining tradable flag
The previous implementation had some issues and introduced undue
complexity. This implementation follows established patterns of
having the algorithm manager apply changes to the algorithm that
result from universe selection.
2018-05-02 20:00:37 -04:00
Michael Handschuh f4690ef6f2 Add UniverseManager.ActiveSecurities
Fetches the unique set of securities that are currently members of at least one
universe. This is the set of active/tradable securities that are currently receiving
data. It does not guarantee that we've received pricing data, but does guarantee that
the security is a member of the universe and we've minimally added a subscription for
data and have not yet removed that subscription (although it is possible for the sub
to end before the security is removed -- very rare/unlikely scenario though).
2018-05-02 13:27:15 -04:00
Michael Handschuh 2f3b50ffe7 Return coarse data if fine not used
The Security.Fundamentals property returns a merged view of the coarse
and fine data for a security. If a fine universe is not used, this data
is not populated because the merging happens after we read the fine data.
This change aims to reduce confusion by making the coarse values available
even if fine data isn't used.

NOTE: Fine properties will be null and cause null reference exceptions if
accessed. This is by design so that algorithms error when trying to access
fine data that wasn't requested.
2018-04-24 18:23:01 -04:00
Michael Handschuh 21b5e1ff17 Add Fundamentals to Security
Fundamentals defines a merged view of coarse/fine universes
2018-04-24 15:32:58 -04:00
Stefano Raggi dd8b6af34b Restore Security.MarginModel property
This property has been restored and is now an alias for Security.BuyingPowerModel
2018-02-05 18:36:06 +01:00
Michael Handschuh f08184c0ae Revert class name changes from #1506
This caused several user algorithms to break. Also, its still correct to
call these margin models.
2018-02-04 14:20:38 -05:00
Michael 99327d106c Merge pull request #1506 from QuantConnect/refactor-margin-models
Refactor margin model interface
2018-02-02 11:31:00 -05:00
AlexCatarino dd14821e75 Enables custom volatility models in python algorithms
Creates a python wrapper for volatility models created in python algorithms and adds a method to the Security object to set such models.
Adds an algorithm to show how volatility models can be implemented.
2018-01-31 12:17:24 +00:00
Stefano Raggi acb5db6cf5 Rename Security.MarginModel to BuyingPowerModel 2018-01-31 11:47:34 +01:00
Stefano Raggi baced83ac4 Rename interface ISecurityMarginModel to IBuyingPowerModel
Also renamed all existing margin models to buying power models:
- SecurityMarginModel -> SecurityMarginBuyingPowerModel
- FutureMarginModel -> FutureMarginBuyingPowerModel
- OptionMarginModel -> OptionMarginBuyingPowerModel
2018-01-31 11:47:34 +01:00
Stefano Raggi f60863f5f9 Remove unnecessary LINQ queries from some Security properties
These properties are used frequently and should only be updated when adding a new subscription:
- Resolution
- IsFillDataForward
- IsExtendedMarketHours

This property can also be updated by SetDataNormalizationMode:
- DataNormalizationMode
2017-12-29 01:22:21 +01:00
AlexCatarino 751a66a36a Refactors Custom Models for python
Moves custom model setters from QCAlgorithm class to Security class.
Modifies algorithm examples to reflect the change.
2017-09-29 22:56:52 +01:00
Andrew 6aa87b458c Added Security.IsCustomData method
This method is a convient way to check if the security has a subscription that represents custom data. It returns true if the security contains at least one subscription that represents custom data
2017-08-21 16:27:51 -04:00
Jared b10222a83c Merge pull request #990 from andrewhart098/data-norm-options
DataNormalizationMode or options must be Raw
2017-06-27 20:16:20 -04:00
Andrew 5442b23b04 Add Equity.SetDataNormalizationMode override 2017-06-26 17:14:35 -04:00
Stefano Raggi 508e63af4d Update Bar types Volume and Bid/AskSize from long to decimal
This PR is another required step towards crypto-currency support.
2017-06-26 21:14:55 +02:00
Andrew 83e0ea1518 Make SetDataNormalization mode a virtual method
Option class now overwrites the Security.SetDataNormalizationMode and checks for the proper DataNormalizationMode
2017-06-26 13:52:19 -04:00
Andrew 646aca7f92 Throw if any other DataNormalization mode other than Raw is used with Options 2017-06-26 10:15:29 -04:00
quant1729 145ba7bd83 Updated code as per PR 2017-01-02 19:47:23 +01:00
quant1729 41bfdbcc9d Updated code according to the discussion in PR 2016-12-30 18:13:07 +01:00
quant1729 705024cd89 Merge branch 'futures'
Conflicts:
	Common/QuantConnect.csproj
2016-12-20 15:53:24 +01:00
quant1729 fd5f27e1cf Updated Security class to set correct market price. Fixing bug with zero security prices. 2016-12-16 17:19:17 +01:00
Andrew Hart 8ebbb7e385 SpreadSlippageModel removed and replaced with ConstantSlippageModel 2016-11-22 14:04:44 -05:00
Andrew Hart 81fe2a94cb Data formats (Trade/Quote) are configurable for each security 2016-11-18 15:30:54 -05:00
quant1729 1305d96edd Open interest support: backtesting, converters, live data handlers (IQFeed/IB), live trading (IB). First cut. Regression Test. 2016-11-15 21:33:33 +01: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 b315519da6 Sets default Security.PriceVariationModel to SecurityPriceVariationModel
In the base security class, sets default PriceVariationModel to SecurityPriceVariationModel
2016-09-20 16:40:50 -03: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
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
devalkeralia ab92ce2e53 Removed whitespaces from Security.cs and edited the lot size values for FXCM CFDs 2016-06-16 12:49:04 -04:00
devalkeralia c135d4314e Undid the changes to Security.cs and LiveTradingResultHandler.cs 2016-06-16 12:34:45 -04:00
devalkeralia c32b135d24 Constructed Lot Size and Set default values 2016-06-15 18:23:08 -04:00
AlexCatarino 8acff56a23 Fixes typos on Security.SetMarketPrice and Security.SetRealTimePrice summaries 2016-06-15 17:44:15 -03:00
AlexCatarino 14e7beb415 Fixes bug: RealTime price not set every second
On LiveTradingResultHandler.ProcessSynchronousEvents, realtime price was assigned to Security.Cache._lastData.Value and that assignment did not change Security.Price used to update Portfolio statistics (eg. TotalPortfolioValue).
For Forex securities, adds Portfolio.CashBook updates with realtime price.
2016-06-15 14:51:25 -03:00
Michael Handschuh c1c3ff252b Merge branch 'multi-subscriptions' into options-new 2016-04-20 12:14:42 -04:00
Michael Handschuh e933306ed1 Allow constructing Security without subscription config 2016-04-14 17:28:54 -04:00
Michael Handschuh 93357094c9 Reshuffle method in preparation for changes 2016-04-13 21:53:55 -04:00
Michael Handschuh a65802d5d0 Adds temporary shim ctor 2016-04-13 21:30:50 -04: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 37661429c2 Mark Security.SubscriptionDataConfig as obsolete 2016-04-12 19:06:58 -04:00
Michael Handschuh a44ce9f2ab Remove single subscription assumption from history impl
When this was originally written, we were assuming one subscription per security.
This removes that assumption and tries to find subscriptions matching the request
2016-04-12 19:06:43 -04:00