Commit Graph

47 Commits

Author SHA1 Message Date
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 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
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
Michael Handschuh 0cc6a53e9c Set correct time zone for custom data in MarketHoursDatabase
Add MarketHoursDatabase.SetEntry and SetEntryAlwaysOpen. This allows runtime modification of the
market hours database which is necessary for correct custom data time zone handling.

Extracts complicate ternary logic into its own method and make it human readable.
Set the market hours entry for custom data universe subscriptions defaulting to the security's time zone.
2018-01-04 12:36:57 -05:00
Andrew 5442b23b04 Add Equity.SetDataNormalizationMode override 2017-06-26 17:14:35 -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
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 38248d641e Adds symbol properties to Security ctor 2016-02-16 13:26:02 -05:00
Michael Handschuh 0042586b6a Adds quote currency to Security ctor 2016-02-16 13:26:00 -05:00
Michael Handschuh 1956eda1b9 Remove unused equity/forex constructors 2016-02-12 16:58:34 -05:00
Michael Handschuh 96a5e76729 Adds IBrokerageModel.GetLeverage(Security)
Also removes leverage as Security ctor parameter
2016-01-19 14:20:23 -05:00
Michael Handschuh 4d295cfc94 Rework Security/Equity/Forex ctors
This is to ensure we're not setting the fill/fee/slip models via the
property setters, since this now will flip a flag indicating that they
have been explicitly set.
2016-01-19 01:50:24 -05:00
snugs 20bc747589 Changes from review 2015-12-17 11:33:49 -05:00
snugs a5c90bc97f Updates existing transaction models with new models 2015-12-16 19:48:29 -05:00
snugs 75a81f581e Rename SecurityExchangeHoursProvider to MarketHoursDatabase 2015-11-30 16:50:09 -05:00
snugs 5161dc9dd0 Use Market string constants instead of literals 2015-11-23 13:55:58 -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 3ad5540a8a Remove dependency on Security from SubscriptionDataReader
Add dynamic data flag to config
Remove dynamic data flag from Security
Rename dynamically loaded flag to IsCustomData
Remove Security from SubscriptionDataReader ctor
2015-09-15 15:40:12 -04:00
snugs 48267f14b2 Set time zone on custom data exchange hours 2015-08-13 13:27:42 -04:00
snugs e79e03e28b Check for Filled or PartiallyFilled for order value
When computing order.GetValue(marketPrice) sometimes we want to use the order.Price and other
times we want to use security.Price, we want to use order.Price if the order's status is either
Filled or PartiallyFilled
2015-07-09 20:13:15 -04:00
snugs 4cc5c1daf7 Use fill price for order value when filled 2015-07-09 18:24:03 -04:00
snugs bd3aaa2155 OBSOLETE Order.Value - Use Order.GetValue(currentMarketPrice) instead 2015-07-09 17:45:50 -04:00
snugs 6bd38ece77 Adds international/timezone support
Time sync:
	* Data feeds are required to time sync in UTC time
	* TimeSlice.Time is now in UTC

IAlgorithm
	* Time is now exclusively the algorithm's local time zone
	* Added UtcTime
	* SetDateTime( DateTime ) accepts a UTC time and is internally converted

SubscriptionDataConfig
	* Adds market and time zone as required ctor parameters

SecurityExchange
	* Now passes most calls directly through to SecurityExchangeHours class

SecurityExchangeHours
	* Holds market hours for each day of week (LocalMarketHours)
	* Talks in terms of local times in the SecurityExchangeHours.TimeZone time zone

Data/market-hours/
	* New data folder to hold market hour information
	* Includes market-hours-database.csv to hold market hours per market/symbol/security (see doc in file)
	* Includes holidays-usa.csv to hold holidays for 'usa' market
		+ The holiday files follow the pattern 'holidays-*.csv' where * is the market

TimeKeeper
	* Receives updates in UTC time
	* Passes that to LocalTimeKeeper's who lazily evaluate the time in their respective time zones
	* Eventually this can grow to be the sole source of time in the algorithm's scope

MISC:
	* Fixes exception thrown when exiting LiveTradingDataFeed
	* Fixes exception thrown when exiting FileSystemDataFeed
	* Fixes exception thrown when exiting StatusPing
	* Simplify FillForwardEnumerator logic with GetNextMarketOpen
	* Adds many time zones, see TimeZones.cs
2015-07-08 18:45:34 -04:00
QuantConnect fde0cbed3a Strip out block quote section header comments 2015-06-13 16:04:27 -04:00
snugs 887faa24e7 Adds support for hourly/daily data to LEAN engine 2015-06-02 21:44:44 -04:00
snugs 225eaf81c9 Initial impl of brokerage model 2015-05-23 15:44:00 -04:00
snugs 89902022fb Fixes bug in holdings not referencing real transaction model 2015-05-20 09:26:46 -04:00
snugs 89b6e98af8 Fixes warnings mostly relating to xml comments
Also cleans up some block comments

Via PR#72 - thanks @ammachado!
2015-05-13 10:56:47 -04:00
snugs e8c826c43f Removed redundant code from transaction models
Also added some tests
2015-05-11 18:51:35 -04:00
snugs 49b398f8ff DataStream sync by end of bar
Adds EndTime to BaseData
Adds Period to TradeBar
Now filling data forward on days missing files/data
Some performance enhancements
Removed sorted dictonary in DataStream/AlgorithmManager

We round down fill forward data in the data stream since if we were to perform this in the data feed we would continually produce data at the same time and it would all go into the algorithm at once.
2015-05-01 19:23:57 -04:00
snugs 97fc158f33 Fixes result sampling in light of split events 2015-04-29 17:47:03 -04:00
snugs b26e438e86 Adds Forex fee model that follows IB 2015-04-15 16:18:49 -04:00
snugs 1f15eb2c04 Initial implementation of Margin and Portfolio models
Changed system to use Margin Models, removing leverage wherever possible allowing for dynamic margin models.
Created first portfolio fill model for FOREX which treats it as a currency swap through the cashbook instead of a tradable asset.
Updated the Securities/SecurityPortfolioManager to use cashbook value + holdings removing FOREX virtual positions.
Created a new benchmark system for comparing quantconnect builds.
2015-04-13 20:51:43 -04:00
snugs 9924b0a872 Shares SubscriptionDataConfig in Security
Updates Securities.Update to take a slice of the 'newData' collection from AlgorithmManager to prevent an n^2 problem
This also has the affect that now all security prices are updated before ANY OnData events are fired (previously imported data could fire before these)
Adds the SubscriptionDataConfig to the Security object and requires it when adding new Securities in SecurityManager
Adds the SubscriptionIndex field to SubscriptionDataConfig, always handled by SubscriptionManager
2015-04-09 10:36:49 -04:00
Adriano Marcondes Machado b2229e8968 Fixed a few compilation warnings 2015-03-09 16:28:17 -03:00
Baran Dilber f9e1db8329 Added Leverage, UnleveredHoldingsCost to SecurityHoldings 2015-03-06 20:17:50 +02:00
QuantConnect dcc31d9dc1 Made derived equity & forex models overrides of base SecurityTransactionModel to avoid repeating reusable model code, added StopLimitOrder type to Common. Closes #33 2015-02-27 18:15:11 -03:00
QuantConnect 097543ec6a Rewrite transaction models to handle new order types, remove fill method, obsolete previous Order based fill methods 2015-02-23 14:59:08 -03:00
snugs 84c5d00a7e Adds SecurityType to SecurityHolding 2015-01-29 06:03:42 -05:00
snugs 733cf998c6 Remove is qc data
Removing the isQcData flags allowed better support for consistency between different data types. This has a knock-on effect of allowing custom data to be fillforward and loaded from a file system.
2015-01-25 22:47:38 -03:00
Jared Broad b3de520915 Initial commit 2015-01-12 12:03:33 -03:00