10841 Commits

Author SHA1 Message Date
Martin-Molinero 1d5c21b165 Fix rebase
- Fix ambiguous Index
- Remove StrategyCapacity.cs
- Update System.Threading.Tasks.Extensionsy
11240 11249 11250 11251 11252 11325
2021-04-06 15:00:19 -03:00
Stefano Raggi 291dfa2294 Upgrade IBAutomater to v1.0.51
ignored, and an empty message aborts the commit.
2021-04-06 11:35:52 -03:00
Martin Molinero d8fa81b680 Remove FXCM 2021-04-06 11:35:13 -03:00
Martin Molinero 26b959a331 Fix ambiguous errors. Add IBAutomator net5 2021-04-06 11:34:37 -03:00
Gerardo Salazar 53750622a4 Update projects to use .NET 5.0, the successor to .NET Core 2021-04-06 11:33:08 -03:00
Aaron Janeiro Stone 4de25b6cd4 _lastLow and _lastHigh are given resets under DeM's Reset method (#5449) 11229 11247 2021-04-06 10:15:16 -03:00
dependabot[bot] cdef9e709a Bump System.Net.Security from 4.3.0 to 4.3.1 in /Tests (#5453)
Bumps System.Net.Security from 4.3.0 to 4.3.1.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
11228
2021-04-06 10:11:43 -03:00
Colton Sellers 3579fecc58 Live Consolidator Bug Fix (#5429)
* Set _lastEmit before emitting, otherwise _workingBar is always null

* Aggregate bars if the data endTime is past lastEmit

* Add unit test

* Address Review

* Clean up unit tests

* Refactor solution to set consistent _lastEmit behaviour

* Add another unit test

* Make fixture non-parallelizable

* Undo last change, and adjust breaking test directly
11227
2021-04-05 17:05:53 -07:00
Stefano Raggi 3a390cfa9f Add IB brokerage message event filtering (#5452) 11223 2021-04-05 17:17:14 -03:00
Stefano Raggi 58dae061e7 Add REST API exception logging in Tradier brokerage (#5454) 11222 2021-04-05 17:14:52 -03:00
Martin-Molinero 3f2479393f Update clr-loader and remove workaround (#5451) 11220 2021-04-05 14:25:19 -03:00
Jasper van Merle 4849588c3b Fix flipped operator in random data generator (#5446) 11216 2021-04-05 11:07:51 -03:00
Martin-Molinero 3d84c76abb Add missing timedelta import in python custom data regression algorithms. Relate to https://github.com/QuantConnect/Lean/pull/5426/files (#5450) 11214 2021-04-05 10:26:51 -03:00
Colton Sellers 1c3d849ad5 Fix Warnings V2 (#5436)
* Reconcile duplicated code

* Add License header

* CS0219 Fixes: Value assigned, but never used

* CA1507: Use nameof in place of string literals

* CS0108 : Hides Inherited Member; Use new keyword to overwrite formally

* CS0114: Hides inherited member; use override keyword

* CS0168: Variable is declared but never used

* Tests CS1062; using obsolete implicit Symbol -> String; fix via .ToString()

* CS0472: Non Nullable Obj getting Null Checked

* CS0067 Member not used; ignore all cases for future use

* CS00162 : Unreachable code; either removed or ignored for debugging and test cases

* CS0169 Remove non-used fields; ignore those that may be used in future

* CS0414; Field is assigned but never used.

* CS0618; Obsolete properties and members; Only fixes simple ones, rest will have to broken up

* CS0649; Field never assigned too

* CS0659 & CS0661 ; Overwrite operators and equals but not hashcode; I don't really override it but just call base

* Small comment fix

* Cleanup pragma statement
11209
2021-04-02 11:20:01 -07:00
Jasper van Merle 271220083b Fix various map file generation issues (#5443) 11208 2021-04-02 11:08:02 -07:00
Stefano Raggi b29d0cbfaf Tradier Brokerage Updates (#5445)
* Tradier brokerage updates

- Add missing status check after REST API calls
- Initialize DataQueueHandler on-demand (on first subscribe call)

* Trigger build
11207
2021-04-02 10:58:27 -07:00
Tomas Rampas 27a25cd663 The null value parameter removed from call of OandaBrokerage c'tor from OandaDownloader class (#5430)
Co-authored-by: rampasto <tomas.rampas@outlook.com>
11186 11198
2021-03-30 15:25:54 -07:00
Derek Melchin 5ed61db2bb Fix timestamps in custom data algorithms (#5426)
* Correct custom data timestamp and match performance across languages

* Add EndTime property

* Add comment for crypto SetHoldings
11185
2021-03-30 14:48:59 -07:00
Colton Sellers 4a1485a291 QB Fundamental Test Fix (#5437)
* Use only 1 QB instance for fundamental tests, (want to see github workflow result)

* Fix small bug in test
11183
2021-03-30 06:42:39 -07:00
Alexandre Catarino d6072c88a5 Fixes LiveOptionChainProvider.FindOptionContracts (#5434)
`LiveOptionChainProvider.FindOptionContracts` handles the following data format:
`SPY  2021 03 26 190 000 C P  0 612 360000000`
where both existing `OptionRight.Call` and `OptionRight.Put` are declared in the same line.
11178
2021-03-29 13:39:41 -07:00
Colton Sellers 20910ca2dc Broken Regressions Fixes (#5421)
* Remove regression references to non-existant Python versions

* Adjust regressions estimated capacity not adjusted by #5389

* Adjusts regression algorithms so that they pass (Index/Index Options)

  * Changes start/end date on BasicTemplateIndexAlgorithm
  * Changes option pricing model to BlackScholes in
    IndexOptionCallITMGreeksExpiryRegressionAlgorithm

    - The root cause of why there are no greeks at times for these
      options was identified. It is most likely due to the underlying's
      VolatilityModel not having had enough data to be "warmed up",
      which means it will return a standard deviation of zero to the
      option pricing model, rendering most metrics as NaN.

* Adds missing index/index options regression algorithms

  - Regression algorithms are now 1-1 between C# and Python for
    Indexes/Index options. All regression tests are now passing

* Fixes broken BasicTemplateIndex regression algorithm

  * Previously traded SPY, but because we have no SPY data in Lean
    master, I instead opted for index options, since data for those
    dates is already included

* Deal with weekend for breaking test case

* Adjust DefaultEndDate test to always pass

* Check todays date for open

Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
11177
2021-03-29 13:35:03 -07:00
Jasper van Merle c333ccdc4a Check whether storage directory exists before enumerating it (#5432) 11176 2021-03-29 13:32:28 -07:00
Christian Korn 88c4a332bc Update PearsonCorrelationPairsTradingAlphaModel.cs (#5428)
Fix index of out bounds (#5427)
11171
2021-03-26 10:55:19 -07:00
Colton Sellers 5d762d16b2 GetFundamental Default End Date (#5401)
* Change default end date for GetFundamental

* Add DefaultEndDate test
11157 11167
2021-03-23 14:18:07 -07:00
Colton Sellers e2a0873b7c Fix Lean Warnings V1 (#5408)
Cleanup all non-breaking warnings
11155
2021-03-22 11:08:48 -07:00
Gerardo Salazar 31ebaaeaa9 Fixes live BTC futures contract crashing in IB brokerage (#5409) 11154 2021-03-22 08:48:58 -07:00
Jared 7625e232f4 Update readme.md 11151 2021-03-19 14:53:46 -07:00
Alexandre Catarino 63f3af7afe Remove decimal.py (#5406)
* Removes decimal.py

* Removes References to Decimal in Examples
11150
2021-03-19 14:17:05 -07:00
Colton Sellers 87b42f6fb5 Named Args Unit Tests (#5381)
Add regression and unit test
11145 11146 11147
2021-03-16 16:53:02 -07:00
Gerardo Salazar f9dc38efab Use trades per period instead of days for capacity calculation (#5389)
Use trades per period instead of days for capacity calculation
Updates regression algorithms
11144
2021-03-16 16:30:49 -07:00
Colton Sellers 5587efaadd Update Python Runtime dll location (#5398) 11142 2021-03-16 15:56:56 -07:00
Colton Sellers a642d53bf9 Specify clr-loader version (#5400) 11140 2021-03-16 14:50:47 -07:00
Colton Sellers 002151eab2 PythonNet 2.0.1 (#5390)
* Trigger rebuild

* Add Package QC PythonNet 2.0.1

* Update project files

* Push latest package

* Remove test package for shipping
11132 11135 11138 11139
2021-03-12 22:26:28 -03:00
Gerardo Salazar 4c085ff853 Adds Indexes and Index Options asset types (Backtesting/Live, IB only) (#5379)
* Add support for Index SecurityType  🚀 (#5364)

* Add Index SecurityType  🚀

* Extend SecurityIdentifier & Lean Data classes with Index support

* Add Index SecurityType  🚀

* Extend SecurityIdentifier & Lean Data classes with Index support

* Fixes

* Added index cross basic template demonstration

* WIP: Prototype index security type for LEAN as non tradable asset

* Re-adds Index entries to MHDB after rebase

* First steps to getting Index Options running

  * Looks at any instance where we pattern match for an option type
    and replaces it with a generic call to `.IsOption()` for easier
    extensibility in the future for additional option security types

  * Adds IndexOption security and misc. classes

  * Misc. changes, mainly related to any sort of special casing of
    equity options and made index options take the same path

* Enables index options data for backtesting

  * Adds new index options market hours to MHDB
  * Misc. bug fixes for index options
  * WIP: add live support for index options and indexes
  * Use OptionMarginModel for Index Options because they both use the
    same calculation for margin requirements

* Fixes contract not found errors on SPX index options and SPX index in IB

  * Turns out index options' last trading day is the day before expiry,
    which IB was expecting the last trading day.

* Add index option test cases (temp)

* LiveOptionChainProvider fix, use Symbol vs. ticker

  * Description updates to regression algorithms

* Fixes bug in live trading for indexes and index options

  * Adds overridable minimum price variation symbol property
  * Adds variable sized minimum price variation for index options
  * Adjusts symbol properties for index options
  * Misc. bug fixes

* Fixes option assignment simulation for European options

  * Updates index options regression algorithms (WIP)

* Fixes bug where index option exercise would trade index underlying

  * Fixes bugs where SecurityType.Index was getting flagged as tradable

* Regression algorithms updates and addresses review

  * Misc. style fixes and refactoring + a few bug fixes
  * Updates regression algorithms to run without runtime errors
  * Adds data for regression algos

* Sets DefaultOptionStyle on Canonical and support index options

* Update regression algos statistics

* Removes bad line in regression algorithm causing build to fail

* Minor tweaks

* Address review add comment about quoteBar parse scale

Co-authored-by: Balamurali Pandranki <balamurali@live.com>
Co-authored-by: Jared Broad <jaredbroad@gmail.com>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
11129
2021-03-12 20:46:23 -03:00
Jasper van Merle 3aa76d4289 Add report creator to Docker image (#5386) 11114 11119 11120 11121 11122 11124 11127 11128 11125 2021-03-11 14:42:26 -08:00
Martin-Molinero 5236fc202d Adding Symbol.Canonical (#5383)
- Adding Symbol.Canonical property which will be cached. Adding unit and
  regression tests
11112
2021-03-11 18:38:20 -03:00
quantify-cflynn 1ca4389ed2 Adds SharpeRatio indicator (#5348)
* RollingSharpeRatio Submission

Creation of RollingSharpeRatio indicator, utilizing LEAN engine. Tests were created and successfully passed by the indicator, using spy_rsr.txt as outside data file which was created during a prior running of the program.

* Fixed Test Case Loading and Added Indicator Function

Added the RSR() function to auto load the indicator in Algorithm\QCAlgorithm.Indicators.cs. Also added a reference for the test file ("spy_rsr.txt") in Tests\QuantConnect.Tests.csproj.

* Fixed SharpeRatio Indicator

Updated the base formula, indicator structure/call, and the testing data for the SharpeRatio indicator.

* Minor Fixes

- Removed dividend yield from calculation
- Fixed typos in code/documentation

* Minor Style Fix and Error Confirmation

- Changed style to match style guide better.
- Checking for confirmation that QuantConnect.Tests.Engine.DataFeeds.LinveTradingDataFeedTests.DelistedEventEmmited_Equity() is server side, as it runs locally and should not have been affected by prior changes

* Simplification and fixing of SR calculation

- Updates calculation to proper SR formula
- Utilizes IndicatorExtensions for SR calculation rather than manual calculation
- Defines counter for 1 extra period offset on warmup (otherwise first datapoint is inaccurate if warmup period is SharpePeriod length)

* Minor Fixes

- Removal of SharpePeriod and RiskFreeRate variables
- Substitution of (SharpePeriod + 1) for WarmUpPeriod
- Outdated comment fixes

* Resubmission for Mono Confirmation Error

Error detected on Git for this version of the program. An error should not occur as only comments and minor variables were edited. Resubmitting to see if it is a false positive mono error.

* Notation Fixes

Fixed notation regarding spacing and outdated comments.

* Removal of Counter Logic

- Replaces counter for warmup with improved IsReady logic

* Fixed Syntax

- Removed unused imports
- Fixed variable readability
- Fixed comments
- Replaced Tabs with spacing

Co-authored-by: quantify-cflynn <quantify-cflynn>
11111
2021-03-11 13:35:08 -08:00
Jared b8397db0b7 Usability buffer on allocation (#5385) 11110 2021-03-11 11:44:54 -08:00
Martin-Molinero d4ea5f7b04 Simplify cash limit allocation (#5382) 11106 2021-03-10 14:47:39 -08:00
Martin-Molinero 458272b2ea Fix mono running in research (#5380) 11100 2021-03-10 17:34:59 -03:00
Colton Sellers 6c7353d09a Trigger rebuild (#5377) 11084 11085 2021-03-09 18:44:18 -03:00
Colton Sellers 834d4a4d58 QC PythonNet 2.0 (#5376)
* Update to new QC PythonNet

* Update readme

* Remove Python.Runtime config, replaced by env var

* Allow local packages testing in repo

* Address Review

* Add the LocalPackages readme

* Update Jupyter Image

* Update Research ReadMe
2021-03-09 18:25:31 -03:00
Gerardo Salazar 561aa3cf25 Adds backwards compatibility for MHDB and SPDB for new SecurityTypes (#5373)
* Adds backwards compatibility for MHDB and SPDB for new SecurityTypes

* Skip invalid SecurityTypes in MHDB and SPDB

* One time log invalid SecurityTypes in MHDB/SPDB

* Moves logging of SecurityType into new extension method

  * Adds TryParseSecurityType to Extensions
11068 11069 11070 11072 11079 11080 11081 11071
2021-03-09 10:52:14 -03:00
hsm207 e4af2ef856 Fix typo (#5374) 11066 2021-03-09 10:29:21 -03:00
Martin-Molinero 3f8158a5be Add live trading Cash enforcement flag (#5372)
- Add live trading cash enforcement flag usefull for brokerages like IB
  which allow trading with currecies you don't have. Updating unit test
11065
2021-03-08 22:09:44 -03:00
Jared 0c4a641590 Changes Protection Level of Constructor of Serialized Order Classes (#5366)
Makes `SerializedOrderEvent.Id` a virtual member.

Co-authored-by: Alexandre Catarino <AlexCatarino@users.noreply.github.com>
11064
2021-03-08 17:03:09 -08:00
Stefano Raggi 20986059a9 Add OutsideRth property to InteractiveBrokersOrderProperties (#5360)
* Add OutsideRth property to InteractiveBrokersOrderProperties

* Address review
2021-03-08 20:15:25 -03:00
Balamurali Pandranki c22a538bad Indian stock markets support & Zerodha brokerage implementation (#4873)
* Indian stock markets & Samco and Zerodha brokerage implementations

* Build fixes & Implement multi leg orders (BracketOrder & CoverOrder)

* Build fixes

* Clean & refactor

* Clean up & remove samco brokerage

* Clean up & remove samco brokerage

* Fix Nifty, BankNifty & Sensex Index futures expiry time functions

* Fix Nifty, BankNifty & Sensex Index futures expiry time functions

* Fix Futures Expiry Testcases

* Fix Futures Expiry Testcases

* Refactor Zerodha Symbol Mapper

* Refactor Zerodha Symbol Mapper

* Add Future symbols to symbol prop db csv

* Fix Symbol Mapper context

* Fix Market Hours Database

* Fix OrderJsonConverter

* Add Zerodha AccountBaseCurrency

* Add QuantConnect License headers to new source files

* cleanup config.json formatting & tick aggregator implementation

* cleanup config.json formatting & tick aggregator implementation

* Refactor ZerodhaBrokerageModel

* Fix

* Build Fixes

* Refactor

* Refactor Brokerage class & remove TextFieldParser

* Refactor Brokerage FeeModel

* Add ZerodhaOrderProperties

* Add Refactor HistoryProvider

* Refactor CanExecuteOrder

* Refactor SymbolMapper

* Refactor market names

* Refactor & remove Zerodha subscription manager

* Refactor & remove ZerodhaWebSocketChannels

* Refactor & remove ZerodhaWebSocketChannels

* Refactor ZerodhaBrokerage

* Refactor symbol prop db

* zerodha update downloader ticker data using symbol name

* 1 Zerodha mapper class update to get instruments based on Market. 2 Zerodha Getholdings data fetch fix.

* Update market-hours-database.json

* Implement basic testcases for ZerodhaBrokerage

* Update market-hours-database.json

* Update Market.cs

* 1 Fix for Zerodha subscriber and unsubscribe 2 User of CSVHelper to read instrument list

* Rename Zerodha DataQueueHandler class implementation

* Changes related to TradeBar and emit tick

* Fix DataQueueUniverseProvider & Handle Timezone conversion in WS EmitQuotes

* Emit Order Fixes

* DataQueueHandler refactoring and build fix

* Update config.json

* Removal of IHistoryProvider impplementation

* Reverting timezone logic as already taken care by BrokerImplementation using Unix time

* Place, modify and cancel order implementation

* fix zerodha test cases

* Updating get quotes and restricting getHoldings to MIS

* Testcase Fixes

* Testcase Fixes

* Testcase Fixes

* Updating emitFillOrder

* Add ProductType to ZerodhaOrderProperties

* Addition of ZerodhaProduct Type property and test update

* Fix for unit tests and minor changes for place and update order

* Unit test fix for Zerodha

* Addition of the product type and trading segment configs

* PR review fixes

* Addition of trading segment and product type configs

* Nuget Fixes

* Fix ZerodhaBrokerage DataQueueHandler

* Cleanup OrderTypes & rm global.json

* Update UpdateOrderRequest.cs

* Removal of custom csvreader

* Implementing additional method CanPerformSelection

* Add LiveOptionChainProvider

* Clean up and add QC license headers

* Quick cleanup

* Update ZerodhaBrokerage.cs

* Fix OrderEvent timezone conversions

* use item.Unrealised for Intraday position holdings

* Refactor Option chain get instruments calls

* Refactor Option chain get instruments calls

* Review fixes

* Remove whitespaces

* Updating options strike price

* Undo time stamp change

* Optional gethistory

* Addition of comments and minor changes

* Build Fixes

* Add comments for LogType enums

* Options fix

* Fix json name in CsvInstrument

* Update tick generation in DataQueueHandler

- Use Timestamp field for both trades and quotes
- Fix incorrect bid/ask sizes
- Avoid reading depth on each tick to find top quote
- Use new Tick constructors
- Remove unnecessary locking

* Add missing null check in Utils.StringToDate

* Order fixes

- Include TriggerPending orders in GetOpenOrders
- Remove unnecessary invalid check in PlaceOrder
- Fix GetOrderPrice and GetOrderTriggerPrice

* Zerodha account balance fetch

* Removal of Futures and Options

* Remove Futures & Options Support

* Update ZerodhaBrokerage.cs

* Update ZerodhaBrokerage.cs

* Add License headers

* Add License Headers

* Refactor

* historical TradeBar & security fee calculation fixes

* fix brokerage test case

* Update ZerodhaBrokerage.cs

* Update ZerodhaBrokerageHistoryProviderTests.cs

Co-authored-by: Aman Ray <ray.aman9876@gmail.com>
Co-authored-by: Stefano Raggi <stefano.raggi67@gmail.com>
11058
2021-03-08 18:51:54 -03:00
Martin-Molinero 5dcda56a73 Revert "Revert "Upgrade IBAutomater to v1.0.51 (#5359)" (#5362)" (#5365)
This reverts commit c7fb6165e2.
11045 11049 11050 11051 11052
2021-03-08 09:54:50 -03:00
Jasper van Merle 8076782ea6 Make random data generator save non-equity data (#5371) 11044 2021-03-08 09:49:17 -03:00