42 Commits

Author SHA1 Message Date
JosueNina 9ccdbec8ee Add ContractMultiplier setter to Cfd via CfdSymbolProperties (#9328)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add ContractMultiplier setter to Cfd via CfdSymbolProperties

* Fix regression tests

* Solve review comments

* Address new review comments

* Fix regression tests

* Use ContractSymbolProperties as base class

* Minor fix

* Address review comment
2026-04-08 10:47:47 -03:00
Martin-Molinero 9fa2630dc8 Add implicit security to symbol (#9032)
- Add implicit conversion from security to symbol. Adding regression
  algorithms
2025-10-13 17:58:57 -03:00
Martin-Molinero 408ffc0067 Add null slippage model (#7580)
- Add null single instance slippage model
2023-11-16 16:03:37 -03:00
Martin-Molinero ee683933a3 Feature Perpetual Crypto Futures (#6807)
Python Virtual Environments / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
* WIP

* Add base currency cash

* Symbol properties and data processing

* Add basic template algorithm

* Add hourly crypto future algorithm

* Minor fixes after live trading testing

* CoinApiDataQueueHandler CryptoFuture support

* Address reviews

* Fix regression algorithms after update
2022-12-30 13:58:11 -03:00
Jasper van Merle bb8bd27fe5 Support 2-leg currency conversions (#5552)
Build & Test Lean / build (push) Has been cancelled
* Apply changes from #2146 on current master

Credit for most of these changes goes to https://github.com/viliwonka.
Rebasing three years of changes didn't go so well, so I manually
applied the changes in #2146 on the current master branch.

This commit attempts to represent the changes in #2146 as closely as
possible, no cleanup has been performed yet. Despite this, some changes
were inevitable because part of #2146 has been implemented another way
in the past three years.

* Clean up

* Process review comments

* Add tests

* symbol -> potentialConversionRateSymbol

* Ensure regression tests run/get data

* Fix broken test

* Process review comments

* Process review comments

* Simplify currency conversion logic

* Performance improvement, doc updates and test rename

* Rebase fixes

* Remove obsolete properties

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-05-20 13:19:39 -03:00
Colton Sellers e2a0873b7c Fix Lean Warnings V1 (#5408)
Cleanup all non-breaking warnings
2021-03-22 11:08:48 -07:00
Martin Molinero a5dc1774a7 Add SecurityCacheProvider
- Adding `SecurityCacheProvider` this class allows for two different
`Security` to share the same data type cache through different instance
of `SecurityCache`. This is used to directly access custom data types
through their underlying in a peformant maner
- Some small improvements
2019-10-22 13:46:57 -03:00
Michael Handschuh 362826988f Improve DynamicSecurityData usability
Adds IRegisteredSecurityDataTypesProvider to track all the data types
registered in the algorithm. Using this data, we can detect if it's
possible that we'll eventually have a property of a certain type name.
For example, consider I wish to use security.Data.TradeBar but we haven't
received any trade bars yet. Before this change a KeyNotFoundException
would be raised, but since we can determine that we expect to have trade
bars, we can detect this and return an empty list when we haven't received
any data yet. This also removes the need to constantly do a HasData<T>()
check before accessing the dynamic members.

Closes #3620
2019-09-30 19:06:21 -04: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
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
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
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
Andrew Hart 8ebbb7e385 SpreadSlippageModel removed and replaced with ConstantSlippageModel 2016-11-22 14:04:44 -05: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
AlexCatarino 96eab852c2 Renames PipSize to MinimumPriceVariation
Renames SymbolProperties.PipSize to SymbolProperties.MinimumPriceVariation, since the term pip does not refer to a minimum price variation.
Adds MinimumPriceVariation and LotSize for Oanda Forex symbols in symbol-properties-database.
2016-09-15 11:02:51 -03:00
Michael Handschuh e933306ed1 Allow constructing Security without subscription config 2016-04-14 17:28:54 -04:00
Michael Handschuh a6c42a9b77 Add ctors that don't require a subscription 2016-04-13 21:39:15 -04:00
Michael Handschuh f73b8cf611 Adds IVolatilityModel and Security.VolatilityModel
Added indicator based implementation
Added relative standard deviation non-indicator implementation
2016-04-06 14:45:15 -04:00
Michael Handschuh a073bb6d17 Remove empty cfd/equity/forex portfolio models 2016-02-16 13:26:09 -05:00
Michael Handschuh cc888cda1e Remove empty cfd/equity/forex margin models 2016-02-16 13:26:09 -05:00
Michael Handschuh 204601224c Implement common SecurityMarginModel.ProcessFill
This method is now able to handle all current security types.
2016-02-16 13:26:07 -05:00
Michael Handschuh 6fb75150bb Remove overrides of GetMarginCallOrders 2016-02-16 13:26:07 -05:00
Michael Handschuh f1e2337e41 Remove overrides of GetInitialMarginRequiredForOrder 2016-02-16 13:26:06 -05:00
Michael Handschuh b4076c7d9f Remove unused properties/field in Cfd/Forex holdings 2016-02-16 13:26:06 -05:00
Michael Handschuh ba6f8fce1b Implement common Security.TotalCloseProfit() method 2016-02-16 13:26:05 -05:00
Michael Handschuh 23119349e5 Implement common Securty.HoldingsValue property 2016-02-16 13:26:05 -05:00
Michael Handschuh f0112b719e Implement common Security.HoldingsCost property 2016-02-16 13:26:04 -05:00
Michael Handschuh d9a9c136c2 Move quote currency validation to Security ctor 2016-02-16 13:26:03 -05:00
Michael Handschuh a6a6699b3a Removes Cfd.QuoteCurrencySymbol/Forex.QuoteCurrencySymbol 2016-02-16 13:26:03 -05:00
Michael Handschuh e892b0db6e Adds Security.SymbolProperties property 2016-02-16 13:26:02 -05:00
Michael Handschuh 38248d641e Adds symbol properties to Security ctor 2016-02-16 13:26:02 -05:00
Michael Handschuh efea1b1eca Add Security.QuoteCurrency property 2016-02-16 13:26:00 -05:00
Michael Handschuh 0042586b6a Adds quote currency to Security ctor 2016-02-16 13:26:00 -05:00
Michael Handschuh 716be38786 Fixes bad build from 7c20419 :/ 2016-02-12 11:31:52 -05:00
Michael Handschuh 7a7b77cae1 Update Order.GetValue to take a Security
Previously the get value functions were not respecting various conversion rates and contract multipliers
2016-02-04 19:56:26 -05:00
Michael Handschuh 983e5fd20b Remove redundant SecurityType Order.ctor argument 2016-02-04 17:59:35 -05:00
Stefano Raggi 52ccee0530 Adds validation checks in Cfd constructor and removes null checks from properties 2016-02-01 23:03:47 +01:00
Stefano Raggi 932b757a1b Remove Cfd.GetQuoteCurrency(Symbol) 2016-01-24 16:29:52 +01:00
Stefano Raggi 93b2d50a4e Adds SymbolProperties argument to Cfd constructor 2016-01-24 16:02:45 +01:00
Stefano Raggi 2790ce275a Sets default values in Cfd constructor 2016-01-21 21:44:23 +01:00
Stefano Raggi 73b38efdb8 Adds tests for Cfd class 2016-01-21 21:10:05 +01:00
Stefano Raggi a71c9f0e92 Adds new CFD classes 2016-01-20 21:50:50 +01:00