Commit Graph

71 Commits

Author SHA1 Message Date
Stefano Raggi f7e06510d4 Fix missing front month contract in energy futures backtesting
Energy futures (CL, HO, RB, NG) expire in the month before the contract month.

To handle these properly, the following changes have been implemented:
- the AlgoSeekFuturesReader has been updated to create the future symbol with the correct expiry date
- the zip entry names in futures data files now contain the full expiry date (in addition to the contract month)
- the sample data files have been updated to use the new zip entry names
- new unit tests have been added and existing ones updated
2019-04-29 09:40:59 +02:00
Martin Molinero c39638668c Overall performance improvements
- `FactorFile` will keep an ordered reversed list with the dates.
Calling `Reverse()` on the `SortedList` is expensive.
- `MapFiles` will keep first and last date, so we don't need to call
`First()` and `Last()` multiple times.
- `Liquidate` will go through all the algorithms securities only if
necessary
- `TradeBar` parsing will not call `new T` for pure `TradeBar` which is
expensive
- Removing `Lazy` hash code and security type for the
`SecurityIdentifier`, replacing for direct initialization. Accessing the
`Lazy` value adds an overhead.
- Replacing `Enum` to string for hardcoded switch statement. `Enum.ToString` is expensive.
- `DataManager` will be lazy for counting the subscriptions for
determining if its above the limit
- Adding `AlgorithmSecurityValuesProvider.GetAllValues()`, removes the
need to fetch all the security keys twice.
- During universe selection, will not try to re add already added symbol
2019-04-22 10:47:27 -03:00
Jared d367dbd025 Revert; unit test coverage.
Annoying spin off affects. Won't update now but flag for later standardization.
2019-01-14 19:44:49 -08:00
Jared 5e8d43df1a Sanity check for consistency with new method
Missing toLower
2019-01-14 16:03:27 -08:00
Gerardo Salazar c9d5764a4b Fix issue #2826 in which we were unable to write to write Futures or Options data to disk 2019-01-14 11:24:26 -08:00
Juan José D'Ambrosio 4ace8cb255 Lean Visualizer C# toolbox project and Python Wrapper working 2018-04-27 11:49:52 -03:00
AlexCatarino 6bbdbcb8fe Fixes LeanData.cs hard-coded Market.USA
It prevents support for new markets.
2018-01-19 18:09:52 +00:00
Andrew 18e2857e78 Don't include tick type in the filename
Update LeanDataTests to reflect correct crypto hour/daily filenames
2017-11-10 16:27:00 -05:00
Andrew 02278ef519 Add btcusd daily data in updated format
Now lean expects both trades and quotes as seperate files. This commit adds the data in the updated format
2017-10-27 16:22:28 -04:00
Andrew 076bb1627c Added KaikoDataConverter Toolbox project
This project can take trade as well as orderbook information from Kaiko
and convert the data into Lean compatible data at all resolutions in
modeled as both trades and quotes.
2017-10-27 15:50:47 -04:00
Andrew 9d90ff1cb1 Hourly and daily crypto files need their tick type specified in their zip archive filename 2017-10-26 15:13:48 -04:00
Andrew 8264cc4a9f LeanDataTests passing for crypto securities
The Crypto security can be modeled with both trades and quotes easily, therefore it is necessary to make sure that the LeanData, LeanDataWriter and associated BaseData.Reader() methods can read/write both Trades and Quotes.
2017-10-25 16:52:31 -04:00
Andrew 406eef196b Specify crypto only switch statement in LeanData.GenerateLine
Because cryptocurrencies can be either Trades or Quotes, the Crypto security type needs it's own switch statement in LeanData.GenerateLine. This produces non-scaled TradeBars or QuoteBarrs.
2017-10-25 16:50:48 -04:00
Jared 72b66501eb Merge pull request #1131 from QuantConnect/crypto-security
Crypto security
2017-09-14 10:48:31 -04:00
Jared Broad e8b117ad2a Throw meaningful exceptions when type incorrect 2017-08-31 17:19:36 -04:00
jameschch@outlook.com 578efe843f Further changes for crypto type 2017-08-29 12:19:15 +01:00
12112 3c4715ef99 Fixes bad merge 2017-08-29 10:52:56 +01:00
12112 921ec8f983 merge from upstream 2017-08-22 16:56:35 +01:00
12112 83fdf9c386 crypto wip 2017-07-14 16:53:42 +01:00
Andrew 35cdd07897 Update zip entry path of equity Tick files 2017-07-10 11:55:54 -04:00
smartquant 74a0163b73 Fix for OpenInterest daily/hourly file format in LeandData.GenerateLine to be yyyyMMdd HH:mm 2017-06-19 19:30:29 +02:00
smartquant fb2cf7deaf Fix for using daily or hourly resolution market data for futures.
- Open interest should use yyyyMMdd HH:mm in csv file when frequency is daily or hourly
- Filename should be [baseticker]_[quote|openinterest|trade]_yyyyMM.csv
2017-06-19 11:15:12 +02:00
Andrew 48da7a217f Removed boolean from LeanData writing futures files 2017-05-09 10:53:34 -04:00
Andrew 9fcf90fe60 Remove optional boolean in LeanData.ToCsv() 2017-05-08 13:18:54 -04:00
Andrew 33793ce1c4 Expiry calculated when futures symbol is created 2017-04-28 16:52:04 -04:00
Andrew cd4cd041d5 Futures data has no scaling applied when data is generated 2017-04-25 16:17:21 -04:00
Andrew 00fce19c80 Options and futures have seperate cases in LeanData.GenerateLine 2017-04-25 16:17:21 -04:00
Stefano Raggi e1710e9031 Remove BaseData underlying symbol from Future symbol 2017-04-17 13:52:23 +02:00
Andrew 5cedbeae3f Leveraging existing extension method to remove trailing 0s 2017-04-05 12:49:28 -04:00
Andrew ae188c58c5 Trim all trailing 0s when generating Lean formatted lines
Remove all trailing 0s in LeanData.GenerateLine(). This creates smaller data files and prevents large numbers of trailing zeros on data points.  This change will apply to all data written with LeanData.GenerateLine.
2017-04-05 11:41:48 -04:00
Stefano Raggi 44d9008cd0 Merge branch 'master' into OptionsBacktesting-UseQuote 2017-03-31 22:50:05 +02:00
Andrew bf82fdb4f7 Return Quotebars for FX and CFD line generation 2017-03-27 11:57:04 -04:00
Andrew d0d5385618 LeanData uses QuoteBars to generate Cfd and Forex lines 2017-03-24 16:59:24 -04:00
Ray Bohac 1dd2d6d351 Use TickType.Quote instead of TickType.Trade 2017-03-24 07:46:20 -04:00
Andrew eb9d78470c LeanData.TryParsePath now returns a symbol
Instead of returning a heavier Security object, LeanData.TryParsePath will return a symbol, datetime and resolution.
2017-03-09 14:44:17 -05:00
Andrew 8e3a0715fc Added LeanData.TryParsePath() and associated tests
This method takes a path and will return a Security and DateTime.  This is useful in the ApiDataProvider that uses the api to retrieve files that are not present on disc.  The IDataProvider only ha a path to the file.  Using this method, the ApiDataProvider can extract the useful information from the path to communicate with the api.
2017-03-09 11:34:36 -05:00
Andrew 9e2c435593 Forex and CFD Tick resolution SubscriptionDataConfigs are added as Quotes not Trades 2017-02-15 11:54:26 -05:00
Andrew Hart 99b9c7626e Expanded SecuirtyManagerTests to include Cfds, Concrete Options and Concrete Futures 2017-01-16 11:42:42 -05:00
Andrew Hart b49319bfdb Added IsCommonLeanDataType
This method is helpful in determining if a Type is a common data type, which are TradeBar, QuoteBar and OpenInterest.
2017-01-06 12:09:15 -05:00
Andrew Hart 46b74f6bae Refactored GetDataType into LeanData
This method is used by both Future and OptionsChainUniverse.  This method is useful, espeically in the SecurityManager.  It will eventually be used there.
2017-01-06 11:48:25 -05:00
quant1729 634db5ddbd Fixed several bugs in converters 2016-12-02 20:22:32 +01:00
quant1729 3819561a82 Merge branch 'futures' into master-futures-merged
Conflicts:
	Common/QuantConnect.csproj
	Tests/RegressionTests.cs
2016-12-01 17:32:40 +01: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
Michael Handschuh 16808c44d9 Add data tz aware GenerateLine
The current implementation of generate line doesn't take into
account that base data instances are typically time stamped
with their exchange time zone, but must be written to
disk in their data time zone.
2016-11-06 18:50:25 -05:00
quant1729 5803115548 Option splits and renames in backtesting. Added regression tests. 2016-10-26 21:20:03 +02:00
Andrew 63be681027 Added IntradayDividendSplits.cs 2016-10-22 09:23:50 -04:00
quant1729 1e514ea403 - Added continuous contract model interface
- Fixed several bugs in backtesting
2016-10-17 13:14:38 +02:00
quant1729 8494c9e1cf Added support for futures backtesting 2016-10-13 15:36:05 +02:00
quant1729 4f722d9765 Options converter:
- Fixed issue with changing option file formats (column order)
- Added support for symbol constraints to filter the symbols we may need
- Temporarily added support for command line argument (date)
Futures converter:
- First version. Works with supplied data files.
2016-10-13 14:32:54 +02:00