Commit Graph

72 Commits

Author SHA1 Message Date
Adalyat Nazirov a450cea8d0 keep actual exchange hours even it different from hours database (#4781) 2020-09-28 20:22:08 -03:00
Adalyat Nazirov 1e3a1e3c43 Historical data requests start & time fix (#4733)
* regression tests

* fix: apply the same time convertion to history request time as for data time

* ver2

* fixup

* unit tests

* do not need this conversion because RoundDownInTimeZone returns in proper TZ

* comment

* requested changes

* refactoring

* more refactoring

* fix existing test: should return Sunday if open

* more symbols

* fix existing tests: submit new btcusd data

* fix

* add Cfd symbol
2020-09-24 14:51:35 -03:00
Martin Molinero 2d0a046c1e Reviews: Add unit test and improve exception message 2020-06-10 19:20:21 -03:00
Martin Molinero 170d12859f Address reviews
- Reduce code duplication. Handle some missing History<TradeBar> for Tick
  resolution.
2020-06-09 19:49:36 -03:00
Martin Molinero a3c5fd9871 Fix Resolution.Tick TradeBar history request
- Throw exception if requesting Resolution.Tick using the TradeBar
  history request API
- Adding unit tests, asserting current behavior
2020-06-08 21:46:13 -03:00
Martin Molinero 058c9e4eac Revert Crypto Hour/Daily QuoteBars
- Reverting removal of Crypto Hour/Daily QuoteBars
- Updating tests
- Adding unit test where Equities ignore QuoteBars
2020-04-06 10:33:02 -03:00
Martin Molinero 499248fe12 Revert "Revert "Adding Support for Equity L1 Quote Data""
This reverts commit 8cd8d206ca.
2020-04-06 10:32:59 -03:00
Martin Molinero 2a2711d056 IndicatorWarmup fixes
- WarmupIndicator will be able to determine the correct type to use
- Fix bug in `History.GetMatchingSubscriptions()` which would use the
same TZ for exchange and data. Covered by regression algorithm.
- Consolidate will only infer `TickType` from `T` is not abstract
- Adding regression algorithm
- Slice will expose `Get(Type)` to get data by type, adding unit tests
2020-03-25 18:52:48 -03:00
Jared 8cd8d206ca Revert "Adding Support for Equity L1 Quote Data" 2020-03-11 19:16:05 -07:00
Martin Molinero 2190145830 Refactor quote type filtering logic 2020-03-11 14:34:13 -03:00
Juan José D'Ambrosio 1fa733a733 Fix issue with history request asking for Low resolution quotes 2020-03-11 14:34:13 -03:00
Juan José D'Ambrosio 1269966e51 Rebase and squash commits
Update test to the new crypto and equity subscriptions  rules:
- Only consolidates trades
- Low resolution data are only trades.
Update and fix tests

Add missing minute sample files

Update Regression algorithms statistics
2020-03-11 14:34:13 -03:00
AlexCatarino 8bd65ecc1d Fixes Typos 2020-02-03 21:11:40 +00:00
AlexCatarino 200d3b0271 Changes GetLastKnownPrice Logic to Increase History Look-back
Changes `GetLastKnownPrice` logic to retry to get non-null data after a first attempt. Previously, it would return null in the first attempt and illiquid securities would not have valid data to set its market price. In the second attempt, we increase the look-back period to the equivalent of three trading days worth of data.
2020-01-30 17:53:30 +00:00
AlexCatarino 13e1fb9743 Rebase With Master. New Subscriptons Can Be Set with UniverseSettings. 2019-04-18 23:29:51 +01:00
AlexCatarino 04a529c758 Addresses Review
- Removes `UniverseSettings.DataNormalizationMode` (it will ne addressed in a dedicated issue: https://github.com/QuantConnect/Lean/issues/3082)
- Adds examples/tests for Tick resolution, Forex (QuoteBar data) and Custom data.
  - Tick resolution is not allowed: logs a message
  - Custom data example/test added in `CustomDataNiftyAlgorithm`
- Adds support for ATR and VWAP since they are, respectively, a bar and a trade bar indicator.
- Adds consolidators to handle difference between data resolution and indicator resolution.
2019-04-18 23:29:51 +01:00
AlexCatarino 672cea86a6 Adds QCAlgorithm.WarmUpIndicator Method
This helper method can be used to warm up indicators individually whether it is created after the security has been added to the universe or before (universe selection scenario).

- Fix the subscription addition to `SubcriptionManager` when a History request is made before the security is created, since it should be not added.

- `IndicatorBase.Update` does not throw when an input is older than the last update. We only log (adds QuantConnect.Logging dependency to QuantConnect.Indicators) the error and discard the addition. Removes unit test for that exception.
2019-04-18 23:28:48 +01:00
Martin Molinero 8f6ad4e3c8 Cache raw data points
- `TextSubscriptionDataSourceReader` will now cache raw price mode data
points for each requested local source file, per data type.
Caching will be handled by the `MemoryCache` class.
- `GetLastKnownPrice()` will not `RoundDown` end time. This was causing
it to fail to fetch a data point in some cases.
2019-02-28 16:56:35 -03:00
Martin Molinero 541b4e3a00 Adding new HistoryRequestFactory
- Adding new `HistoryRequestFactory` class. Will provide some methods to
facilitate the creation of new `HistoryRequests`. Moving
`CreateHistoryRequest` and `GetStartTimeAlgoTz` into the new
`HistoryRequestFactory`. And consolidating `GetStartTimeAlgoTz` and
`GetStartTimeAlgoTzForSecurity`.
2018-12-19 16:14:42 -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
Michael Handschuh 5ba44ed5ab Remove universe symbols from history requests
The engine defines securities for each universe to properly track them within
the data feed. These securities are not tradable and have no price data associated
with them, and as such, we should not be sending history requests for these symbols.
This change removes all universe symbols from history requests.
NOTE: Requests made directly to the history provider are not filtered out, as the
filtering happens within the QCAlgorithm implementation.
2018-03-05 14:18:33 -05:00
AlexCatarino 599c00be5b Historical Data Requests fetchs data from non-subscribed securities
It was not possible to add a security based on its historical data, since we needed to add the security before requesting its security data. Universe Selection algorithms are an example of such usage.
2018-01-16 18:08:28 +00:00
Jared 755a0f8ba7 Merge pull request #1475 from StefanoRaggi/symbol-null-comparison-fix
Fix bug in Symbol inequality operator
2018-01-15 17:15:26 -05:00
Stefano Raggi 89a59351cd Add OnWarmupFinished method to QCAlgorithm
This method is being added to allow algorithms to complete initialization tasks that cannot be executed during Initialize, such as cancelling existing open orders in live trading.
This method will be called only once, when the warmup task is complete.

Closes #1043
2018-01-15 13:46:30 +01:00
Stefano Raggi 1075571752 Replace Symbol.Empty checks with null checks 2018-01-12 21:56:10 +01:00
Maly-Lemire ba30b2c547 Merge branch 'master' into master 2017-11-29 21:12:16 -05:00
Maly Lemire 657d98fa59 Added SetWarmUp resolution parameter. 2017-11-29 20:57:41 -05:00
Andrew dcd6f478a0 Include the TickType in the HistoryPacket
Currently the HistoryRequest includes information regarding the tick type, but that information is not passed to the HistoryPacket. Therefore, only the common data types for a history request are returned for history requests. This is problematic for crypto history requests that specify Trade History.
2017-11-13 15:25:10 -05:00
Andrew 357c6c79c4 Lift History request restrictions on Crypto security types
Currently, Crypto security types are restrictied to history requests that return QuoteBars. This removes that restriction and allows Crypto securities to make TradeBar history requests.
2017-11-12 16:57:12 -05:00
Andrew bf3eadf0c9 Throw when History methods recieve Symbol.Empty
Often users will request History with a string instead of a Symbol. Because of the implicit conversion between Symbol and string, this only works if the ticker has been first added to the algorithm as a security using a method like AddSecurity(), AddEquity() etc. This commit checks for failed implicit conversions in History request and returns an error message to the user that should better enable users to debug what has gone wrong.
2017-11-01 15:13:16 -04:00
Michael Handschuh 0e4fc0f7fb Prevent security price seeding if no history provider
This appears to be causing exceptions in travis when running the automated
test suite. I'm still unsure why it's only failing on this branch and not
on the master branch.
2017-10-17 12:15:58 -04:00
Jared 72b66501eb Merge pull request #1131 from QuantConnect/crypto-security
Crypto security
2017-09-14 10:48:31 -04:00
Stefano Raggi c0fa78080a Fix security type test 2017-09-11 20:48:43 +02:00
Stefano Raggi f5d4c4a318 Enable security seeding for Options and Futures 2017-09-11 20:37:07 +02:00
Michael Handschuh 89c6a1a566 Remove multiple enumerations of enumerable
Depending on the IHistoryProvider implementation, this could result in
multiple history requests being sent GetLastKnownPrice function call.
2017-09-02 13:56:48 -04:00
jameschch@outlook.com 578efe843f Further changes for crypto type 2017-08-29 12:19:15 +01:00
12112 4be1b7b413 Merge branch 'master' of https://github.com/QuantConnect/Lean 2017-08-22 16:56:52 +01:00
12112 921ec8f983 merge from upstream 2017-08-22 16:56:35 +01:00
Andrew c82f31aa6a Use GetCommonTickTypeForCommonDataTypes to get default tick types for history requests 2017-08-22 11:17:07 -04:00
Andrew 08bb34a1eb Add TickType field to the HistoryRequest class 2017-08-22 09:42:42 -04: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
Andrew 8a5af16051 Remove parameterless HistoryRequest constructor
This contractor was removed so that history requests do not assume any defaults - especially with exchange time zones and data time zones
2017-08-21 14:55:49 -04:00
Stefano Raggi 001183a917 Fix Warmup for Options and Futures
Warmup history requests for options and futures were only creating a single subscription for open interest (no trades or quotes).

Also some History overloads had the same issue.
2017-08-21 15:58:23 +02:00
Stefano Raggi 49b2240a73 Fix bug in security seeding when using Tick resolution
With securities added at Tick resolution the wrong data type was used for the seeding history request.
2017-08-09 17:58:38 +02:00
12112 83fdf9c386 crypto wip 2017-07-14 16:53:42 +01:00
Stefano Raggi b5c6af53c7 Fix Warmup/History requests for canonical symbols
CreateDateRangeHistoryRequests and CreateBarCountHistoryRequests were incorrectly including canonical symbols in history request generation
2017-05-05 15:07:13 +02:00
Stefano Raggi 2cbe2af4fd Remove redundant properties in HistoryRequest class
SecurityType and Market properties are already implicitly included in the Symbol property.

With this change we avoid forgetting to set these properties when creating HistoryRequest objects (issue #863)
2017-04-29 20:31:39 +02:00
Stefano Raggi 29da91847d Reuse LeanData.GetDataType in CreateHistoryRequest 2017-04-19 13:25:45 +02:00
Stefano Raggi f9de571521 Fix history request data type with Tick data and non-Tick resolution 2017-04-19 02:23:17 +02:00
Stefano Raggi dad6d3282d Replace Obsolete attributes with Error message for FX and CFD 2017-02-22 16:14:16 +01:00