Compare commits

..

85 Commits
12867 ... 13232

Author SHA1 Message Date
Martin-Molinero
0a315b0ae6 Update readme.md 2021-11-17 19:59:03 -03:00
Colton Sellers
33599b473d Refactor Delistings Processing (#6059)
* Move processing of delistings to Brokerage

* Deal with case that exchange is not open on OptionSymbol.ID.Date

* Refactor solution to use DelistingNotification event

* Adjust some regression expected liquidation time

* Mark some todos on deprecated functions

* Update expected liqudation time for Py regressions

* Update regressions that have been validated

* Use HandlePositionAssigned for assignment orders

* Update regressions

* Update some missed unit tests; remove one that is already covered by regression

* Cleanup deprecated backend functions

* nit - small cleanup adjustment

* Post rebase fix

* Address review

* Minor tweak to py regression
2021-11-17 17:43:35 -03:00
Jovad Uribe
325e788728 Super Trend Indicator (#6013)
* Super Trend Indicator #4653

* Updated test data

Previous test data was wrong

* Reduced if statement

* Updated tests

Replacing spy test data with dwac test data from trading view.

* Minor comment update

* Minor tweaks

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-11-17 12:19:26 -03:00
Martin-Molinero
57ac4d6497 Add import for System.Drawing (#6063) 2021-11-17 11:28:09 -03:00
Martin-Molinero
664dca2236 Tradier websocket bug fix (#6061)
- Tradier brokerage will use BaseWebsocketsBrokerage which handled
  websocket resubscription. Minor API changes
2021-11-16 18:44:38 -03:00
Ricardo Andrés Marino Rojas
5415fe6bc0 Beta indicator (#6042)
* First BetaIndicator prototype
- In construction

* Fist BetaIndicator version and unit tests

* More unit tests and regression test

* Nit change

* Requested changes

* Nit changes

* Requested changes

* Adjust beta formula slightly and nit changes

* Nit change
2021-11-15 15:57:24 -03:00
Martin-Molinero
b2517cbbb4 Fix DiskDataCacheProvider. Expanding unit test (#6058) 2021-11-15 15:57:09 -03:00
Martin-Molinero
b8b0d18993 Continuous futures (#6034)
* Continuous Future Contracts

* Mapping approach

* Tweaks WIP

* Live mapping

* Live mapping

- Add support for live mapping, refreshing mapfiles
- Fix future expiration functions
- Adding unit tests

* Update moq test package

* Continuous futures price scaling

* Refactor price factors scaling

* Factor file related renames

* Address reviews
2021-11-15 14:44:30 -03:00
Martin-Molinero
ad865e2a53 Add new CustomWeight, AlphaModel for AlphaStreams (#6052)
- Add new CustomWeight PCM for alpha streams
- Add new AlphaStreams AlphaModule that will handle security additions
  and removals, removing this logic from AlphaStreamsBasicTemplateAlgo
2021-11-15 14:33:16 -03:00
Martin-Molinero
57f0d17c5d Remove user plan enum (#6055)
* Remove user plan enum

- Get maximum order and runtime from job controls
- Remove user plan enum definitions

* Add log for BacktestingSetupHandler maximums
2021-11-12 19:37:23 -03:00
Ricardo Andrés Marino Rojas
d234d69abc Give timer more time (#6053) 2021-11-12 13:41:56 -03:00
Colton Sellers
dd4da7ba95 Feature Daily/Hourly Options Support (#6017)
* Create generic writing for LeanDataWriter, + notes on todos

* Make Options Daily/Hourly data store by year

* Refactor Generic Write

* Permit hour and daily resolutions for options

* Refactor writer to merge when needed with other files

* Cleanup redundancies, run write tasks in parallel

* Make needed classes/vars available

* Update tests to reflect new naming convention for daily hourly options data

* Add Byte[] overloads for ZipData functions in compression

* Implemented Store() for ZipDataCacheProvider

* Have LeanDataWriter use a DataCacheProvider

* ZipDataCacheProvider cleanup

* ZipDataCacheProvider tweaks, doesn't support storing non-zips

* Test adjustments

* Update LeanDataWriter to use Write instead of SaveDailyHourly/SaveMinuteSecond

* Implement tests to verify DownloadAndSave behavior

* Nit cleanup on DownloadAndSave tests

* Fix for options daily/hourly underlying equity subscription read

* Add daily/hourly options data and regressions

* Add missing open interest for hourly

* Fix writing of OpenInterest Daily/Hourly data

* Update data

* Fix Date typo in regression

* Use daily algorithm to test delisting

* Revisions part 1

* Expand test for DataCacheProviders; refactor DiskDataCacheProvider

* nit - test adjustments

* ZipDataCacheProvider test setup refactor

* Adjust multithreaded read/write test; fixes for ZipDataCacheProvider

* Move DiskDataCacheProvider to its own file and add write test

* Remove _appendToZips; always overwrite entry or create zip

* Add mapping regression for daily options

* nit - add license to regression

* Fix Tick write case where more than one data point for a DateTime

* Fix data issue

* Address review

* Tweaks for tests

* Stop Store() early if no entry name is given
2021-11-11 20:05:31 -03:00
Martin-Molinero
27f5223cd2 Pin dotnet interactive version for net5 (#6048) 2021-11-10 13:00:59 -03:00
Adalyat Nazirov
b3d3df3a3c rate limit is dependent on Account Tier, Tier1 by default (#6046) 2021-11-09 16:44:29 -03:00
Ricardo Andrés Marino Rojas
3c1ddb7b96 Enable Warm Up process in MacdAlphaModel (#6037)
* Warm up MACD indicators
- When a security is added in the MACD alpha model, it's warm up at once

* Add unit tests

* Nit change

* Code style and nit changes
2021-11-04 12:15:32 -03:00
Ronit Jain
926ac3879a Add try-catch and null check (#6038) 2021-11-03 20:07:47 -03:00
Martin-Molinero
0327b2012c Add default value for Exchange security types (#6032) 2021-11-01 12:05:15 -03:00
Martin-Molinero
cd5e1d9c54 Can serialize unknown exchange. Adding test (#6031) 2021-10-29 09:13:52 -07:00
Ricardo Andrés Marino Rojas
fc6ddc2120 Feature 5988 WarmUpIndicator() method for indicators written in Python (#6027)
* Implement IIndicatorWarmUpPeriodProvider
- Implement IIndicatorWarmUpPeriodProvider in PythonIndicator.cs
- Make a unit test to check whether the WarmUpPeriod is working as expected
- Make a regression test to check the new feature at a system level

* Nit change

* Change Period parameter for WarmUpPeriod parameter
- Change regression test to check if the new parameter keep backwards compatibility with indicators that do not set WarmUpPeriod

* Documentation change

* Fix tests bugs
- In CommonIndicatorTests.cs before finish the test it checks the period.value with the number of samples but for default the period.value was set to -1

* Change names

* Change WarmUp and RegisterIndicator methods
- Lean WarmUp indicator skip custom python indicators that don't define WarmUpPeriod parameter

* Call WarmUpIndicator manually
- Add a new "bridge" method called WarmUpIndicator in QCAlgorithm.Python.cs to set up everything to call WarmUpIndicator in QCAlgorithm.Indicators.cs
- Change the regression algorithm to warm up the indicators manually

* Remove unnecessary code and add more tests

* Nit change

* Revert "Nit change"

This reverts commit da411f59c9.

* Fix bugs

* Try fix bugs

* Add C# regression test
- More nit changes
- Fix bugs

* Requested changes

* Remove unnecessary code

* Requested changes

* Nit changes
- Add new Python class to check a custom indicator, which doesn't inherits from PythonIndicator, warms up properly

* Reduce redundant code

* Fix bug and add more unit and regression tests

* - Add more unit tests

* Nit change

* Test cleanup

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-10-28 20:29:22 -03:00
Ricardo Andrés Marino Rojas
013b9ea850 Set WarmUpPeriod value in MarketProfile constructor (#6029)
- Remove unnecessary attribute `_period` in MarketProfile
- Set the value of WarmUpPeriod to the period in MarketProfile constructor
- Fix unit test to check VolumeProfile and TimeProfile indicators are being warmed up properly and its WarmUpPeriod parameter isn't zero
2021-10-28 19:54:11 -03:00
Martin-Molinero
9f29e3bf4e Some performance improvements for IndexOptions (#6025)
- Some performance improvements for IndexOptions specially affects
  debugging C# algorithms.
2021-10-27 20:26:51 -03:00
Alexandre Catarino
4ecdf14ce8 Include Security Master Url to ApiDataProvider Error Message (#6023) 2021-10-27 14:58:15 -03:00
Martin-Molinero
ede2d4a5e4 Lazy loading of the SecurityDefinition file (#6024)
- Perform a lazy loading of the security definitions file. Adding unit
  tests
2021-10-27 14:57:50 -03:00
Martin-Molinero
8c71dbc8ba Revert "Feature 5988 IIndicatorWarmUpPeriodProvider for custom PythonIndicator (#5992)" (#6022)
This reverts commit 995f598999.
2021-10-26 22:07:22 -03:00
Martin-Molinero
d17865b2cf CoinApi read previous date file (#6019)
- If available, CoinApi converter will read previous date files to
  rescue initial midnight ticks for the processing date. Also make sure
  to drop ticks from tomorrow
2021-10-25 20:26:12 -03:00
Martin-Molinero
7b3b560dea Foundation update CVXPY 1.1.15 (#6020)
- Update cvxpy python package version to latest 1.1.15. To avoid
  installation issue `error in cvxpy setup command: use_2to3 is invalid`
2021-10-25 18:45:07 -03:00
Ricardo Andrés Marino Rojas
995f598999 Feature 5988 IIndicatorWarmUpPeriodProvider for custom PythonIndicator (#5992)
* Implement IIndicatorWarmUpPeriodProvider
- Implement IIndicatorWarmUpPeriodProvider in PythonIndicator.cs
- Make a unit test to check whether the WarmUpPeriod is working as expected
- Make a regression test to check the new feature at a system level

* Nit change

* Change Period parameter for WarmUpPeriod parameter
- Change regression test to check if the new parameter keep backwards compatibility with indicators that do not set WarmUpPeriod

* Documentation change

* Fix tests bugs
- In CommonIndicatorTests.cs before finish the test it checks the period.value with the number of samples but for default the period.value was set to -1

* Change names

* Change WarmUp and RegisterIndicator methods
- Lean WarmUp indicator skip custom python indicators that don't define WarmUpPeriod parameter

* Call WarmUpIndicator manually
- Add a new "bridge" method called WarmUpIndicator in QCAlgorithm.Python.cs to set up everything to call WarmUpIndicator in QCAlgorithm.Indicators.cs
- Change the regression algorithm to warm up the indicators manually

* Remove unnecessary code and add more tests

* Nit change

* Revert "Nit change"

This reverts commit da411f59c9.

* Fix bugs

* Try fix bugs

* Add C# regression test
- More nit changes
- Fix bugs

* Requested changes

* Remove unnecessary code

* Requested changes

* Nit changes
- Add new Python class to check a custom indicator, which doesn't inherits from PythonIndicator, warms up properly

* Reduce redundant code
2021-10-25 18:08:57 -03:00
Martin-Molinero
43c271a568 Atreyu template algorithm change traget SPY exchange (#6016) 2021-10-25 15:43:35 -03:00
IlshatGaripov
2e4252c92b LiveTradingResultHandler -> changes access modifier of SetNextStatusUpdate (#6015) 2021-10-25 11:17:35 -03:00
Adalyat Nazirov
0f189aa2b4 FTX brokerage rejects STOP order if market price missed (#6009)
* cannot submit stop orders with bad trigger price

* unit tests

* expect price data
2021-10-25 11:14:41 -03:00
IlshatGaripov
f55588e4c6 SecurityHolding -> impl. ToString() (#6014) 2021-10-25 11:07:34 -03:00
Martin-Molinero
58ccdee1b1 PythonNet version bump 2.0.10 (#6010) 2021-10-22 20:27:38 -03:00
Colton Sellers
6bd2859f64 Update to PythonNet 2.0.9 (#6004) 2021-10-21 20:06:38 -03:00
Alexandre Catarino
3ff7882dbf Round AverageLoss to Avoid Very Small Numbers (#6003) 2021-10-21 17:00:31 -03:00
Martin-Molinero
dace6d7ee1 Fix index live target exchange (#6000) 2021-10-20 17:26:25 -03:00
Colton Sellers
71d9eed07e BuyingPowerModel Fixes (#5996)
* Refactor error message for reproducability

* WIP Refactor GetMaximumOrderQuantityForTargetBuyingPower

* Additional tweaks and tests

* Address shorted margin case

* Reinstate tests with new modified function

* Update regression

* Some cleanup

* Expand test set

* Refactor solution

* Address review

* Final adjustments and cleanup

* Expand error message for GetAmountToOrder for safety and reproducibility

* Address reviews
2021-10-20 16:37:20 -03:00
Stas Kotykhin
c4a4550a66 Override History provider in kraken environment (#5998)
* add history-provider field to config.json

* Add comment
2021-10-20 16:36:34 -03:00
bmello4688
67081a8a05 Add virtual overrides for pivotpointshighlow computations (#5987)
* Add base class for pivotpointshighlow

* abstracts do not work well with python switch to virtuals and use pivotpointhighlow as base implementation

* added missing documentatino header

* moved reset back to original location
2021-10-19 21:45:18 -03:00
alexgallotta
a567053404 fix build command with dotnet (#5990) 2021-10-18 16:55:56 -03:00
Martin-Molinero
56b8ccc4b4 CoinApi log error on duplicate symbol (#5989) 2021-10-15 20:31:55 -03:00
Martin-Molinero
5f65677ede Add suuport for coinApi kraken ftx exchanges (#5985) 2021-10-15 11:24:30 -03:00
Ricardo Andrés Marino Rojas
def916aed1 Add IIndicatorWarmUpPeriodProvider for WindowIndicator.cs and Identity.cs indicators (#5984)
- Implement IIndicatorWarmUpPeriodProvider interface in both indicators
- Add test to check the new functionality is working as expected. To test WindowIndicator IIndicatorWarmUpPeriodProvider there was used WindowIdentity indicator tests because that indicator only inherits from it
2021-10-15 11:10:59 -03:00
Adalyat Nazirov
46ce138fa1 move methods for further usage across other brokerages (#5981) 2021-10-14 17:08:11 -03:00
Martin-Molinero
b8768ae274 Add FOPs price magnifier (#5979)
* Add FOPs price magnifier

* Improve unit tests
2021-10-14 11:57:48 -03:00
Ricardo Andrés Marino Rojas
db04b5e110 Feature 5930 price magnifier (#5977)
* Update SPDB with price magnifier parameter
- Add a new column for new parameter in symbol-properties-database.csv
- Change InteractiveBrokersBrokerage.cs implementation of GetContractPriceMagnifier() method in order to get the parameter directly from the SPDB
- Add test in SymbolPropertiesDatabaseTests.cs to check if the new parameter is loading properly

* Change GetContractPriceMagnifier() method name and implementation
- Change NormalizePriceToLean() and NormalizePriceToBrokerage() methods

* Nit change in GetSymbolPriceMagnifier() method

* Remove GetSymbolPriceMagnifier() method
- Remove redundant and unnecessary parameters in NormalizePriceToLean() and NormalizePriceToBrokerage()

* Requested changes and SPDB update
- Update SPDB with minimum order size parameter for futures in cents. The minimum order size parameter was extracted from the CME group API

* Address reviews. Adding unit test for failing case

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-10-14 11:16:23 -03:00
Colton Sellers
cff3640f15 Update to PythonNet 2.0.8 (#5978) 2021-10-13 20:19:06 -03:00
Martin-Molinero
b5574a7986 Do not emit zero quantity Exercise Order events (#5976)
- BrokerateTransactionHandler will not emit zero quantity Exercise order
  events. Updating unit tests
2021-10-12 19:38:37 -03:00
Martin-Molinero
c638f82337 Adjust Bitfinex currency fee error message (#5975) 2021-10-12 17:05:27 -03:00
Adalyat Nazirov
3a591c3a72 Fix Binance ExchangeInfo downloader (#5965)
* fix exchangeinfo downloader

* normalize data, update symbol properties

* min ordersize should be in base currency

* check min order size using quote currency price

* check order size in quote currency

* improve checks

* improve code; more unit tests

* more description

* fix failing test
2021-10-11 12:36:41 -03:00
Martin-Molinero
fdfb1b54c0 Add Binance debugging logs (#5974) 2021-10-11 11:55:12 -03:00
Adalyat Nazirov
7cfdd1243f FTX brokerage essentials (#5963)
* FTX config boilerplate

fixup

* required

* order props

* make orger props setter public

* add market props

* brokerage model

* deny modify order directly

* update markets

* unit tests

* fix market properties

* add comments

* return security benchmark

* fix fee calculation

* dont change access modifiers

* check brokerage CanSubmitOrder using min order quantity

* fix ticker values - use lean notation

* fix fee model

* fix error message
2021-10-08 19:16:38 -03:00
Stas Kotykhin
3fc042af33 Move bar aggregators to utils, add time overloads & add check of orderType for Kraken (#5969)
* Move Aggregate Quote and Trade Bars to utils

* Add decimal and long overload to UnixTimeStampToDateTime

* Add Kraken OrderType check in CanSubmitOrder

* PR !5969 review fixes
2021-10-08 17:59:32 -03:00
Martin-Molinero
1d6fed8843 Update python to 2.0.7 (#5968) 2021-10-08 12:55:14 -03:00
Colton Sellers
2109394060 Add subset test after dropping 'symbol' (#5966) 2021-10-06 18:21:33 -03:00
Colton Sellers
d2d99b1f10 Algorithm Sampling and Statistics Fixes (#5936)
* Implement scheduled event sampling solution

* Use UTC time, only update daily portfolio value once a day

* For daily resolutions sample chart always

* Cleanup

* Drop resample daily all together

* Force final sample

* Regression updates

* FIx LiveResultHandler to update portfolio and benchmark values outside of sampling event

* Name the daily sampling event

* Address review pt 1

* Drop force and use reference wrapper

* Adjust tests

* Fix warning for Benchmark Timezone Misalignment and also add test

* Fix for daily resolution orders and test adjustments

* Also warn on universe settings with daily resolution

* Update missed regression

* Fix reference wrapper use

* Update regression after rebase

* Add values back in for Daylight Algo

* Have statistics builder skip day 1 performance

* Regression adjustments

* Test adjustments

* Update regression unit test

* Adjust some regressions starts to show performance values

* Add hourly algorithm for beta comparison

* Address missing Python regression changes

* Remove null comment
2021-10-05 19:31:25 -03:00
Martin-Molinero
659735946a Bitfinex fees cash accounts (#5957)
* Bitfinex Fee adjustment

- Fix for bitfinex fee adjustment for cash account type only happen if
  the currencies are the expected ones, else log message.

* Adjust error handling to terminate algorithm

* Add bitfinex TESTBTCTESTUSD

* Minor improvements

- Add bitfinex test symbols to the SPDB
- Make SecurityDefinitionSymbolResolver log using trace
- Minor tweak for Bitfinex DQH lock contention
2021-10-04 18:15:32 -03:00
Stefano Raggi
29294cb1f4 Transaction handlers - minor updates (#5956)
- Move debug logging of order events from Brokerage to BrokerageTransactionHandler
- Override CurrentTimeUtc in BacktestingTransactionHandler
2021-10-01 19:09:08 -03:00
Ronit Jain
4546bbe9b1 Fix missing reference price when creating last entry (#5952)
* Fix code styling changes

* Cosmetic change

* Add reference price 1 for last entry

* Fix refernece price
2021-10-01 11:37:58 -03:00
Ricardo Andrés Marino Rojas
af958f0ce4 Bug 5904 minimum order size rejected order (#5949)
* - Update symbol-properties-database.csv, SymbolPropertiesDatabase.cs and SymbolProperties.cs with a new column for MinimumOrderSize parameter for Crypto type
- Change CanSubmitOrder() method implementation in GDAXBrokerageModel.cs to get the MinimumOrderSize from the security SymbolProperties directly
- Add CanSubmitOrder() method in Binance, Bitfinex and Kraken Brokerages models
- Add tests to check if CanSubmitOrder() method is working as expected in Binance, Bitfinex, Kraken and GDAX brokerages models
- Add tests to check if MinimumOrderSize parameter is loading correctly from symbol-properties-database.csv

* Revert "- Update symbol-properties-database.csv, SymbolPropertiesDatabase.cs and SymbolProperties.cs with a new column for MinimumOrderSize parameter for Crypto type"

This reverts commit e0fd66a5fa.

* Revert "Revert "- Update symbol-properties-database.csv, SymbolPropertiesDatabase.cs and SymbolProperties.cs with a new column for MinimumOrderSize parameter for Crypto type""

This reverts commit b0f37935fc.

* Requested changes in Crypto brokerage models
- Remove unnecessary commas in symbols-properties-database.csv
- Add TestHelpers class to reuse GetSecurity() method
- Add IsValidOrderSize() method in DefaultBrokerageModel class
- Remove unnecessary classes for brokerage models test helpers

* Nit change
- Remove unnecessary attribute from DefaultBrokerageModel.cs

* Nit change

* Nit changes and Regression test
- Add Bitfinex BTCUSD hourly data for 2 days
- Add regression test BuyBTCWithLessThanOneDollarAlgorithm.cs to test that the order size is taking into account when placing or updating an order
- Nit changes

* Change CanUpdateOrder() implementation
- CanUpdateOrder() now checks if the requested quantity value is valid

* Requested Changes
- Change regression algorithm BuyBTCWithLessThanOneDollar.cs name and implementation

* Nit changes
2021-09-30 18:30:04 -03:00
Stefano Raggi
6c42a266be IB brokerage - Update option positions at contract expiration (#5880)
* IB brokerage - Update option positions at contract expiration

* Add handling of live option expiration events

* Address review

- Nits

* Refactor option notification events [WIP]

* Add early exercise+assignment unit tests

* Fix sign bug in IB ExerciseOrder

* Address review

- log unexpected position
- add unit test cases for partial exercise/assignment
2021-09-30 13:48:41 -03:00
José Emiliano Cabrera Blancas
8b7da686ea Fix MovingAverageType in KeltnerChannels Indicator (#5954)
The Simple Moving Average was always used instead of the one passed to
the KeltnerChannels constructor.
2021-09-29 20:48:07 -03:00
Martin-Molinero
d3280c5e60 Move VX margin files (#5948) 2021-09-28 14:21:07 -03:00
Stas Kotykhin
fe1f22543f Add NonUpdateableLimitIfTouchedOrderTestParameters class (#5947) 2021-09-28 13:16:04 -03:00
Stefano Raggi
57ddbbbf05 IBAutomater updates (#5946) 2021-09-28 11:45:05 -03:00
Martin-Molinero
9579c4263b Fix history requests so they ignore internal subscriptions (#5945)
- Fix for history requests so that they ignore internal subscriptions
  accordengly. Adding regression test reproducing issue
2021-09-27 20:31:05 -03:00
Martin-Molinero
f082a40f34 Add missing comments (#5944) 2021-09-27 18:48:53 -03:00
Martin-Molinero
d739873daa Add aggregator reader (#5942)
* Add BaseDataCollectionAggregatorReader

- Add enumerable for BaseDataCollection
- Add BaseDataCollectionAggregatorReader
- Clean up CollectionSubscriptionDataSourceReader

* Address reviews

- Add new FileFormat that will be handled by the new Reader
- Adding unit tests for the new BaseDataCollectionAggregatorReader
- Some DataSourceReader duplication cleaning up

* Minor adjustment after some live trading tests
2021-09-27 17:25:23 -03:00
Martin-Molinero
0f7dfe8ec8 Fix live ETF universe selection (#5938)
- ETF live universe selection will behave the same as Coarse selection.
  Adding unit test
2021-09-23 15:11:35 -03:00
Alexandre Catarino
58968bf05f Adds Warnings to MOO and MOO using Tick Data (#5937)
Adds Warnings to MOO and MOO using Tick Data
These warnings are meant to let the user know that it was not possible to find ticks marked with the `OfficialOpen`, `OfficialClose`, `OpeningPrints` or `ClosingPrints` flags.
2021-09-22 19:17:18 -03:00
Stefano Raggi
627f280100 IB brokerage updates (#5933)
* Disconnect from IB API before waiting for restart

* Update IBAutomater to v2.0.62

* Update IBAutomater to v2.0.63
2021-09-22 18:52:00 -03:00
Alexandre Catarino
9ca57c2de9 Fixes Market On Close Fill of Equity Fill Model (#5913)
* Fixes Market On Close Fill of Equity Fill Model

Only use trade data (`Tick` with `TickTrade` type or `TradeBar`) to get the closing price, since MOC is filled with the closing price.

- Fix unit tests to show that the new implementation only fills with trade data from the current open market.
- Change regression tests to reflect the bug fix. All other changes are the consequence of using `TradeBar` instead of `QuoteBar`.

* Address Peer-Review

Fixes the logic with tick data: looking for the OfficalClose or ClosingPrints only apply if data from the extended market hours is included.
Adds additional logic to handle missing trade data.

* Refactors Timeout Logic and Adds It to MarketOnOpenFIll

-Refactors timeout logic to address peer-review and adds it to MOO fill too.
- Adds unit tests
2021-09-21 17:51:35 -03:00
Martin-Molinero
35c2951abb Tradier add retry logic. Clean up rate gate (#5935)
- Add Tradier retry logic in case of an unexpected execution failure
- Clean up rate gate logic to use RateGate class
2021-09-21 17:40:54 -03:00
Simon Judd
2c237b7f84 IB Brokerage - fix for futures contracts priced in cents (#5930)
* Fix IB futures prices where PriceMagnifier != 1

* Fix deadlock in GetOpenOrdersInternal by moving ConvertOrder call out of event handler;
Minor refactor to combine NormalizePrice and ConvertPrice methods

* IB future and future options price magnifier

* Address review. IB API clean up

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-09-20 16:17:25 -03:00
Martin-Molinero
4e6e0c85c6 Lean exchange improvements (#5932)
* Lean exchanges improvements

- Adding new Exchange class to avoid exchange code clash.
  Adding and updating unit test

* Add Market for MapFile API

* Self review
2021-09-20 13:50:15 -03:00
Colton Sellers
a2ac956d53 Move WickedRenkoConsolidator to RenkoConsolidator as Default (#5931)
* Rename Renko to ClassicRenko

* Rename WickedRenko to Renko

* Adjust tests and usages

* Backwards support WickedRenkoConsolidator

* Renames for consistency
2021-09-17 16:32:01 -03:00
Colton Sellers
5fecb77c8a Composite Indicator Fixes (#5929)
* Refactor for two types in composite indicator

* Fixes for unit tests

* Non generic indicator base

* Further seperate non-generic indicator base and generic input base

* Adjustments

* Remove generic CompositeIndicator

* Add test suite

* Make each method an individual case

* Address review

* Testing cleanup

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-09-16 17:58:10 -03:00
Stefano Raggi
3e8f15a62f Fix IB restarts during weekends (#5926)
* Fix IB restarts during weekends

* Address review

- Task.Delay usage
- update default delay from 10s to 5m
2021-09-15 19:16:34 -03:00
Martin-Molinero
0931ae868a Fix multiple coarse selection algorithms (#5927)
- Fix for live trading multiple coarse selections. Adding unit test
  reproducing issue.
2021-09-14 20:27:09 -03:00
Martin-Molinero
e13df5c901 Fix null reference loading existing holdings and cash balance (#5925) 2021-09-14 11:20:03 -03:00
Martin-Molinero
7be1b7db1a Algorithm Language can be case insensitive (#5924) 2021-09-13 10:31:31 -03:00
Gerardo Salazar
024d416ddd Adds support for getting a Lean symbol based on FIGI, CUSIP, ISIN, SEDOL (#5922)
* Adds support for getting a Lean symbol based on FIGI, CUSIP, ISIN, SEDOL

* Address review: bug fixes for mapping, improve docs, cleanup & refactor

  * Make LocalZipMapFileProvider and LocalZipFactorFileProvider only
    initialize if they haven't been initialized yet.

* Address review: makes ISIN, SEDOL, CUSIP case-insensitive

  * Cleans up map file provider in SecurityDefinitionSymbolResolver
  * Modifies some test cases to test for case-insensitivity

* Add null check for SecurityDefinitions

* Fix unit tests

Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2021-09-10 19:16:18 -07:00
Martin-Molinero
eb2dbe2af7 Fix FuncSecuritySeeder for python (#5923)
- Fix funcSecuritySeeder for python. Adding regression algorithm
2021-09-10 19:28:49 -03:00
Colton Sellers
8358c394e1 Support all security types for benchmarks (#5919)
* Adjust benchmark subscription to dynamically determine best resolution

* Get types from SM

* Add red/green test set for security types
2021-09-10 16:58:31 -03:00
Stefano Raggi
d7c7adbd0d Update IBAutomater to v2.0.57 (#5920) 2021-09-10 12:36:34 -03:00
Martin-Molinero
1ab1f90e27 Add research import QuantConnect.AlphaStream (#5918) 2021-09-09 15:12:42 -03:00
536 changed files with 20179 additions and 9688 deletions

View File

@@ -117,18 +117,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.700%"},
{"Expectancy", "1.781"},
{"Net Profit", "1.442%"},
{"Sharpe Ratio", "4.017"},
{"Probabilistic Sharpe Ratio", "59.636%"},
{"Sharpe Ratio", "4.86"},
{"Probabilistic Sharpe Ratio", "59.497%"},
{"Loss Rate", "33%"},
{"Win Rate", "67%"},
{"Profit-Loss Ratio", "3.17"},
{"Alpha", "1.53"},
{"Beta", "-0.292"},
{"Annual Standard Deviation", "0.279"},
{"Annual Variance", "0.078"},
{"Information Ratio", "-0.743"},
{"Tracking Error", "0.372"},
{"Treynor Ratio", "-3.845"},
{"Alpha", "4.181"},
{"Beta", "-1.322"},
{"Annual Standard Deviation", "0.321"},
{"Annual Variance", "0.103"},
{"Information Ratio", "-0.795"},
{"Tracking Error", "0.532"},
{"Treynor Ratio", "-1.18"},
{"Total Fees", "$14.78"},
{"Estimated Strategy Capacity", "$47000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},

View File

@@ -103,8 +103,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "0"},
{"Tracking Error", "0"},
{"Information Ratio", "-9.486"},
{"Tracking Error", "0.008"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -0,0 +1,151 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using QuantConnect.Data;
using QuantConnect.Indicators;
using QuantConnect.Interfaces;
using QuantConnect.Orders;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Regression test to explain how Beta indicator works
/// </summary>
public class AddBetaIndicatorRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private BetaIndicator _beta;
private SimpleMovingAverage _sma;
private decimal _lastSMAValue;
public override void Initialize()
{
SetStartDate(2013, 10, 07);
SetEndDate(2013, 10, 15);
SetCash(10000);
AddEquity("IBM");
AddEquity("SPY");
EnableAutomaticIndicatorWarmUp = true;
_beta = B("IBM", "SPY", 3, Resolution.Daily);
_sma = SMA("SPY", 3, Resolution.Daily);
_lastSMAValue = 0;
if (!_beta.IsReady)
{
throw new Exception("_beta indicator was expected to be ready");
}
}
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
var price = data["IBM"].Close;
Buy("IBM", 10);
LimitOrder("IBM", 10, price * 0.1m);
StopMarketOrder("IBM", 10, price / 0.1m);
}
if (_beta.Current.Value < 0m || _beta.Current.Value > 2.80m)
{
throw new Exception($"_beta value was expected to be between 0 and 2.80 but was {_beta.Current.Value}");
}
Log($"Beta between IBM and SPY is: {_beta.Current.Value}");
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
var order = Transactions.GetOrderById(orderEvent.OrderId);
var goUpwards = _lastSMAValue < _sma.Current.Value;
_lastSMAValue = _sma.Current.Value;
if (order.Status == OrderStatus.Filled)
{
if (order.Type == OrderType.Limit && Math.Abs(_beta.Current.Value - 1) < 0.2m && goUpwards)
{
Transactions.CancelOpenOrders(order.Symbol);
}
}
if (order.Status == OrderStatus.Canceled)
{
Log(orderEvent.ToString());
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public virtual Language[] Languages { get; } = { Language.CSharp};
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "12.939%"},
{"Drawdown", "0.300%"},
{"Expectancy", "0"},
{"Net Profit", "0.289%"},
{"Sharpe Ratio", "4.233"},
{"Probabilistic Sharpe Ratio", "68.349%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.035"},
{"Beta", "0.122"},
{"Annual Standard Deviation", "0.024"},
{"Annual Variance", "0.001"},
{"Information Ratio", "-3.181"},
{"Tracking Error", "0.142"},
{"Treynor Ratio", "0.842"},
{"Total Fees", "$1.00"},
{"Estimated Strategy Capacity", "$35000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},
{"Fitness Score", "0.022"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "8.508"},
{"Return Over Maximum Drawdown", "58.894"},
{"Portfolio Turnover", "0.022"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "bd88c6a0e10c7e146b05377205101a12"}
};
}
}

View File

@@ -40,7 +40,7 @@ namespace QuantConnect.Algorithm.CSharp
public override void Initialize()
{
SetStartDate(2020, 1, 5);
SetStartDate(2020, 1, 4);
SetEndDate(2020, 1, 6);
_es20h20 = AddFutureContract(
@@ -51,7 +51,7 @@ namespace QuantConnect.Algorithm.CSharp
QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 6, 19)),
Resolution.Minute).Symbol;
var optionChains = OptionChainProvider.GetOptionContractList(_es20h20, Time)
var optionChains = OptionChainProvider.GetOptionContractList(_es20h20, Time.AddDays(1))
.Concat(OptionChainProvider.GetOptionContractList(_es19m20, Time));
foreach (var optionContract in optionChains)
@@ -168,31 +168,31 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "217.585%"},
{"Compounding Annual Return", "116.059%"},
{"Drawdown", "0.600%"},
{"Expectancy", "0"},
{"Net Profit", "0.635%"},
{"Sharpe Ratio", "0"},
{"Sharpe Ratio", "17.16"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-14.395"},
{"Tracking Error", "0.043"},
{"Treynor Ratio", "0"},
{"Alpha", "2.25"},
{"Beta", "-1.665"},
{"Annual Standard Deviation", "0.071"},
{"Annual Variance", "0.005"},
{"Information Ratio", "5.319"},
{"Tracking Error", "0.114"},
{"Treynor Ratio", "-0.735"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$28000000.00"},
{"Estimated Strategy Capacity", "$24000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Fitness Score", "1"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "79228162514264337593543950335"},
{"Portfolio Turnover", "3.199"},
{"Portfolio Turnover", "2.133"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},

View File

@@ -42,7 +42,7 @@ namespace QuantConnect.Algorithm.CSharp
public override void Initialize()
{
SetStartDate(2020, 1, 5);
SetStartDate(2020, 1, 4);
SetEndDate(2020, 1, 6);
_es = AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, Market.CME);
@@ -227,31 +227,31 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-15.625%"},
{"Compounding Annual Return", "-10.708%"},
{"Drawdown", "0.200%"},
{"Expectancy", "0"},
{"Net Profit", "-0.093%"},
{"Sharpe Ratio", "-11.181"},
{"Sharpe Ratio", "-10.594"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.002"},
{"Beta", "-0.016"},
{"Annual Standard Deviation", "0.001"},
{"Alpha", "-0.261"},
{"Beta", "0.244"},
{"Annual Standard Deviation", "0.01"},
{"Annual Variance", "0"},
{"Information Ratio", "-14.343"},
{"Tracking Error", "0.044"},
{"Treynor Ratio", "0.479"},
{"Information Ratio", "-22.456"},
{"Tracking Error", "0.032"},
{"Treynor Ratio", "-0.454"},
{"Total Fees", "$3.70"},
{"Estimated Strategy Capacity", "$41000.00"},
{"Lowest Capacity Asset", "ES 31C3JQTOYO9T0|ES XCZJLC9NOB29"},
{"Fitness Score", "0.41"},
{"Fitness Score", "0.273"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-185.654"},
{"Portfolio Turnover", "0.821"},
{"Return Over Maximum Drawdown", "-123.159"},
{"Portfolio Turnover", "0.547"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},

View File

@@ -126,21 +126,21 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.300%"},
{"Expectancy", "-0.042"},
{"Net Profit", "-0.332%"},
{"Sharpe Ratio", "-3.7"},
{"Probabilistic Sharpe Ratio", "0.563%"},
{"Sharpe Ratio", "-3.149"},
{"Probabilistic Sharpe Ratio", "0.427%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.92"},
{"Alpha", "-0.021"},
{"Beta", "-0.011"},
{"Annual Standard Deviation", "0.006"},
{"Alpha", "-0.015"},
{"Beta", "-0.012"},
{"Annual Standard Deviation", "0.005"},
{"Annual Variance", "0"},
{"Information Ratio", "-3.385"},
{"Tracking Error", "0.058"},
{"Treynor Ratio", "2.117"},
{"Information Ratio", "-2.823"},
{"Tracking Error", "0.049"},
{"Treynor Ratio", "1.372"},
{"Total Fees", "$2.00"},
{"Estimated Strategy Capacity", "$45000000.00"},
{"Lowest Capacity Asset", "AOL R735QTJ8XC9X"},
{"Estimated Strategy Capacity", "$67000000.00"},
{"Lowest Capacity Asset", "AOL VRKS95ENLBYE|AOL R735QTJ8XC9X"},
{"Fitness Score", "0"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
@@ -160,7 +160,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "b006bb7864c0b2f1a6552fb2aa7f03b8"}
{"OrderListHash", "4f50b8360ea317ef974801649088bd06"}
};
}
}

View File

@@ -90,18 +90,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "3.300%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.168%"},
{"Sharpe Ratio", "-0.126"},
{"Probabilistic Sharpe Ratio", "45.081%"},
{"Sharpe Ratio", "62.513"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-2.896"},
{"Beta", "0.551"},
{"Annual Standard Deviation", "0.385"},
{"Annual Variance", "0.148"},
{"Information Ratio", "-13.66"},
{"Tracking Error", "0.382"},
{"Treynor Ratio", "-0.088"},
{"Alpha", "1.118"},
{"Beta", "1.19"},
{"Annual Standard Deviation", "0.213"},
{"Annual Variance", "0.046"},
{"Information Ratio", "70.862"},
{"Tracking Error", "0.043"},
{"Treynor Ratio", "11.209"},
{"Total Fees", "$23.21"},
{"Estimated Strategy Capacity", "$340000000.00"},
{"Lowest Capacity Asset", "FB V6OIPNZEM8V9"},

View File

@@ -101,18 +101,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "5.800%"},
{"Expectancy", "-0.731"},
{"Net Profit", "-5.588%"},
{"Sharpe Ratio", "-3.272"},
{"Probabilistic Sharpe Ratio", "5.825%"},
{"Sharpe Ratio", "-3.252"},
{"Probabilistic Sharpe Ratio", "5.526%"},
{"Loss Rate", "86%"},
{"Win Rate", "14%"},
{"Profit-Loss Ratio", "0.89"},
{"Alpha", "-0.594"},
{"Beta", "0.707"},
{"Annual Standard Deviation", "0.203"},
{"Annual Variance", "0.041"},
{"Information Ratio", "-2.929"},
{"Tracking Error", "0.193"},
{"Treynor Ratio", "-0.942"},
{"Alpha", "-0.499"},
{"Beta", "1.483"},
{"Annual Standard Deviation", "0.196"},
{"Annual Variance", "0.039"},
{"Information Ratio", "-3.844"},
{"Tracking Error", "0.142"},
{"Treynor Ratio", "-0.43"},
{"Total Fees", "$37.25"},
{"Estimated Strategy Capacity", "$520000000.00"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},

View File

@@ -30,7 +30,7 @@ namespace QuantConnect.Algorithm.CSharp
{
private Symbol _aapl;
private const string Ticker = "AAPL";
private FactorFile _factorFile;
private CorporateFactorProvider _factorFile;
private readonly IEnumerator<decimal> _expectedAdjustedVolume = new List<decimal> { 6164842, 3044047, 3680347, 3468303, 2169943, 2652523,
1499707, 1518215, 1655219, 1510487 }.GetEnumerator();
private readonly IEnumerator<decimal> _expectedAdjustedAskSize = new List<decimal> { 215600, 5600, 25200, 8400, 5600, 5600, 2800,
@@ -56,7 +56,7 @@ namespace QuantConnect.Algorithm.CSharp
factorFileProvider.Initialize(mapFileProvider, dataProvider);
_factorFile = factorFileProvider.Get(_aapl);
_factorFile = factorFileProvider.Get(_aapl) as CorporateFactorProvider;
}
/// <summary>
@@ -83,7 +83,7 @@ namespace QuantConnect.Algorithm.CSharp
if (_expectedAdjustedVolume.MoveNext() && _expectedAdjustedVolume.Current != aaplData.Volume)
{
// Our values don't match lets try and give a reason why
var dayFactor = _factorFile.GetSplitFactor(aaplData.Time);
var dayFactor = _factorFile.GetPriceScale(aaplData.Time, DataNormalizationMode.SplitAdjusted);
var probableAdjustedVolume = aaplData.Volume / dayFactor;
if (_expectedAdjustedVolume.Current == probableAdjustedVolume)
@@ -107,7 +107,7 @@ namespace QuantConnect.Algorithm.CSharp
if (_expectedAdjustedAskSize.MoveNext() && _expectedAdjustedAskSize.Current != aaplQuoteData.LastAskSize)
{
// Our values don't match lets try and give a reason why
var dayFactor = _factorFile.GetSplitFactor(aaplQuoteData.Time);
var dayFactor = _factorFile.GetPriceScale(aaplQuoteData.Time, DataNormalizationMode.SplitAdjusted);
var probableAdjustedAskSize = aaplQuoteData.LastAskSize / dayFactor;
if (_expectedAdjustedAskSize.Current == probableAdjustedAskSize)
@@ -126,7 +126,7 @@ namespace QuantConnect.Algorithm.CSharp
if (_expectedAdjustedBidSize.MoveNext() && _expectedAdjustedBidSize.Current != aaplQuoteData.LastBidSize)
{
// Our values don't match lets try and give a reason why
var dayFactor = _factorFile.GetSplitFactor(aaplQuoteData.Time);
var dayFactor = _factorFile.GetPriceScale(aaplQuoteData.Time, DataNormalizationMode.SplitAdjusted);
var probableAdjustedBidSize = aaplQuoteData.LastBidSize / dayFactor;
if (_expectedAdjustedBidSize.Current == probableAdjustedBidSize)

View File

@@ -198,18 +198,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0%"},
{"Expectancy", "0"},
{"Net Profit", "0.192%"},
{"Sharpe Ratio", "31.331"},
{"Probabilistic Sharpe Ratio", "88.448%"},
{"Sharpe Ratio", "231.673"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.138"},
{"Beta", "0.04"},
{"Annual Standard Deviation", "0.004"},
{"Alpha", "0.163"},
{"Beta", "-0.007"},
{"Annual Standard Deviation", "0.001"},
{"Annual Variance", "0"},
{"Information Ratio", "4.767"},
{"Tracking Error", "0.077"},
{"Treynor Ratio", "3.223"},
{"Information Ratio", "4.804"},
{"Tracking Error", "0.098"},
{"Treynor Ratio", "-22.526"},
{"Total Fees", "$307.50"},
{"Estimated Strategy Capacity", "$2600000.00"},
{"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"},

View File

@@ -13,15 +13,12 @@
* limitations under the License.
*/
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
using QuantConnect.Brokerages;
using QuantConnect.Securities;
using System.Collections.Generic;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Data.Custom.AlphaStreams;
using QuantConnect.Algorithm.Framework.Alphas;
using QuantConnect.Algorithm.Framework.Execution;
using QuantConnect.Algorithm.Framework.Portfolio;
@@ -32,8 +29,6 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public class AlphaStreamsBasicTemplateAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private Dictionary<Symbol, HashSet<Symbol>> _symbolsPerAlpha = new Dictionary<Symbol, HashSet<Symbol>>();
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
@@ -42,11 +37,11 @@ namespace QuantConnect.Algorithm.CSharp
SetStartDate(2018, 04, 04);
SetEndDate(2018, 04, 06);
SetAlpha(new AlphaStreamAlphaModule());
SetExecution(new ImmediateExecutionModel());
Settings.MinimumOrderMarginPortfolioPercentage = 0.01m;
SetPortfolioConstruction(new EqualWeightingAlphaStreamsPortfolioConstructionModel());
SetSecurityInitializer(new BrokerageModelSecurityInitializer(new DefaultBrokerageModel(),
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel,
new FuncSecuritySeeder(GetLastKnownPrices)));
foreach (var alphaId in new [] { "623b06b231eb1cc1aa3643a46", "9fc8ef73792331b11dbd5429a" })
@@ -55,77 +50,11 @@ namespace QuantConnect.Algorithm.CSharp
}
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
foreach (var portfolioState in data.Get<AlphaStreamsPortfolioState>().Values)
{
ProcessPortfolioState(portfolioState);
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
Log($"OnOrderEvent: {orderEvent}");
}
public override void OnSecuritiesChanged(SecurityChanges changes)
{
changes.FilterCustomSecurities = false;
foreach (var addedSecurity in changes.AddedSecurities)
{
if (addedSecurity.Symbol.IsCustomDataType<AlphaStreamsPortfolioState>())
{
if (!_symbolsPerAlpha.ContainsKey(addedSecurity.Symbol))
{
_symbolsPerAlpha[addedSecurity.Symbol] = new HashSet<Symbol>();
}
// warmup alpha state, adding target securities
ProcessPortfolioState(addedSecurity.Cache.GetData<AlphaStreamsPortfolioState>());
}
}
Log($"OnSecuritiesChanged: {changes}");
}
private bool UsedBySomeAlpha(Symbol asset)
{
return _symbolsPerAlpha.Any(pair => pair.Value.Contains(asset));
}
private void ProcessPortfolioState(AlphaStreamsPortfolioState portfolioState)
{
if (portfolioState == null)
{
return;
}
var alphaId = portfolioState.Symbol;
if (!_symbolsPerAlpha.TryGetValue(alphaId, out var currentSymbols))
{
_symbolsPerAlpha[alphaId] = currentSymbols = new HashSet<Symbol>();
}
var newSymbols = new HashSet<Symbol>(currentSymbols.Count);
foreach (var symbol in portfolioState.PositionGroups?.SelectMany(positionGroup => positionGroup.Positions).Select(state => state.Symbol) ?? Enumerable.Empty<Symbol>())
{
// only add it if it's not used by any alpha (already added check)
if (newSymbols.Add(symbol) && !UsedBySomeAlpha(symbol))
{
AddSecurity(symbol, resolution: UniverseSettings.Resolution, extendedMarketHours: UniverseSettings.ExtendedMarketHours);
}
}
_symbolsPerAlpha[alphaId] = newSymbols;
foreach (var symbol in currentSymbols.Where(symbol => !UsedBySomeAlpha(symbol)))
{
RemoveSecurity(symbol);
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>

View File

@@ -58,13 +58,13 @@ namespace QuantConnect.Algorithm.CSharp
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "16.59"},
{"Alpha", "0.008"},
{"Beta", "1.012"},
{"Alpha", "0.006"},
{"Beta", "1.011"},
{"Annual Standard Deviation", "0.343"},
{"Annual Variance", "0.117"},
{"Information Ratio", "-0.57"},
{"Information Ratio", "-0.859"},
{"Tracking Error", "0.004"},
{"Treynor Ratio", "-0.831"},
{"Treynor Ratio", "-0.832"},
{"Total Fees", "$2.89"},
{"Estimated Strategy Capacity", "$8900000000.00"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},

View File

@@ -14,9 +14,11 @@
*/
using System;
using QuantConnect.Interfaces;
using System.Collections.Generic;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Data.Custom.AlphaStreams;
using QuantConnect.Algorithm.Framework.Alphas;
using QuantConnect.Algorithm.Framework.Execution;
using QuantConnect.Algorithm.Framework.Portfolio;
using QuantConnect.Algorithm.Framework.Selection;
@@ -26,7 +28,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <summary>
/// Example algorithm consuming an alpha streams portfolio state and trading based on it
/// </summary>
public class AlphaStreamsUniverseSelectionTemplateAlgorithm : AlphaStreamsBasicTemplateAlgorithm
public class AlphaStreamsUniverseSelectionTemplateAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
@@ -36,6 +38,7 @@ namespace QuantConnect.Algorithm.CSharp
SetStartDate(2018, 04, 04);
SetEndDate(2018, 04, 06);
SetAlpha(new AlphaStreamAlphaModule());
SetExecution(new ImmediateExecutionModel());
Settings.MinimumOrderMarginPortfolioPercentage = 0.01m;
SetPortfolioConstruction(new EqualWeightingAlphaStreamsPortfolioConstructionModel());
@@ -65,23 +68,63 @@ namespace QuantConnect.Algorithm.CSharp
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public override Dictionary<string, string> ExpectedStatistics
public virtual Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
get
{
var result = base.ExpectedStatistics;
result["Compounding Annual Return"] = "-13.200%";
result["Information Ratio"] = "2.827";
result["Tracking Error"] = "0.248";
result["Fitness Score"] = "0.011";
result["Return Over Maximum Drawdown"] = "-113.513";
result["Portfolio Turnover"] = "0.023";
return result;
}
}
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-0.12%"},
{"Compounding Annual Return", "-13.200%"},
{"Drawdown", "0.200%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.116%"},
{"Sharpe Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "2.474"},
{"Tracking Error", "0.339"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$83000.00"},
{"Lowest Capacity Asset", "BTCUSD XJ"},
{"Fitness Score", "0.011"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-113.513"},
{"Portfolio Turnover", "0.023"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "2b94bc50a74caebe06c075cdab1bc6da"}
};
}
}

View File

@@ -85,18 +85,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.100%"},
{"Expectancy", "3.321"},
{"Net Profit", "0.089%"},
{"Sharpe Ratio", "0.868"},
{"Probabilistic Sharpe Ratio", "44.482%"},
{"Sharpe Ratio", "0.798"},
{"Probabilistic Sharpe Ratio", "40.893%"},
{"Loss Rate", "24%"},
{"Win Rate", "76%"},
{"Profit-Loss Ratio", "4.67"},
{"Alpha", "0.001"},
{"Beta", "-0"},
{"Alpha", "-0.001"},
{"Beta", "0.008"},
{"Annual Standard Deviation", "0.001"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.148"},
{"Tracking Error", "0.101"},
{"Treynor Ratio", "-4.168"},
{"Information Ratio", "-1.961"},
{"Tracking Error", "0.092"},
{"Treynor Ratio", "0.08"},
{"Total Fees", "$52.00"},
{"Estimated Strategy Capacity", "$32000000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -34,7 +34,7 @@ namespace QuantConnect.Algorithm.CSharp
{
UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw;
EnableAutomaticIndicatorWarmUp = true;
SetStartDate(2013, 10, 08);
SetStartDate(2013, 10, 07);
SetEndDate(2013, 10, 09);
var SP500 = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME);
@@ -151,31 +151,31 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-99.999%"},
{"Drawdown", "16.100%"},
{"Compounding Annual Return", "-100.000%"},
{"Drawdown", "19.800%"},
{"Expectancy", "0"},
{"Net Profit", "-6.366%"},
{"Sharpe Ratio", "1.194"},
{"Net Profit", "-10.353%"},
{"Sharpe Ratio", "-1.379"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "5.56"},
{"Beta", "-71.105"},
{"Annual Standard Deviation", "0.434"},
{"Annual Variance", "0.188"},
{"Information Ratio", "1.016"},
{"Tracking Error", "0.44"},
{"Treynor Ratio", "-0.007"},
{"Alpha", "3.004"},
{"Beta", "5.322"},
{"Annual Standard Deviation", "0.725"},
{"Annual Variance", "0.525"},
{"Information Ratio", "-0.42"},
{"Tracking Error", "0.589"},
{"Treynor Ratio", "-0.188"},
{"Total Fees", "$20.35"},
{"Estimated Strategy Capacity", "$19000000.00"},
{"Estimated Strategy Capacity", "$13000000.00"},
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
{"Fitness Score", "0.138"},
{"Fitness Score", "0.125"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-1.727"},
{"Return Over Maximum Drawdown", "-12.061"},
{"Portfolio Turnover", "4.916"},
{"Sortino Ratio", "-2.162"},
{"Return Over Maximum Drawdown", "-8.144"},
{"Portfolio Turnover", "3.184"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -189,7 +189,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "7c841ca58a4385f42236838e5bf0c382"}
{"OrderListHash", "7ff48adafe9676f341e64ac9388d3c2c"}
};
}
}

View File

@@ -305,18 +305,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.400%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.329%"},
{"Sharpe Ratio", "-11.083"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Sharpe Ratio", "-7.887"},
{"Probabilistic Sharpe Ratio", "1.216%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.003"},
{"Alpha", "-0.001"},
{"Beta", "0.097"},
{"Annual Standard Deviation", "0.002"},
{"Annual Variance", "0"},
{"Information Ratio", "9.742"},
{"Tracking Error", "0.021"},
{"Treynor Ratio", "-0.26"},
{"Information Ratio", "7.39"},
{"Tracking Error", "0.015"},
{"Treynor Ratio", "-0.131"},
{"Total Fees", "$2.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"},
@@ -339,7 +339,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "7f99e1a8ce4675a1e8bbe1ba45967ccd"}
{"OrderListHash", "f67306bc706a2cf66288f1cadf6148ed"}
};
}
}

View File

@@ -45,7 +45,7 @@ namespace QuantConnect.Algorithm.CSharp
{
// Can specify the default exchange to execute an order on.
// If not specified will default to the primary exchange
Exchange = Exchange.NASDAQ,
Exchange = Exchange.BATS,
// Currently only support order for the day
TimeInForce = TimeInForce.Day
};
@@ -59,7 +59,7 @@ namespace QuantConnect.Algorithm.CSharp
{
if (!Portfolio.Invested)
{
// will set 25% of our buying power with a market order that will be routed to exchange set in the default order properties (NASDAQ)
// will set 25% of our buying power with a market order that will be routed to exchange set in the default order properties (BATS)
SetHoldings("SPY", 0.25m);
// will increase our SPY holdings to 50% of our buying power with a market order that will be routed to ARCA
SetHoldings("SPY", 0.50m, orderProperties: new AtreyuOrderProperties { Exchange = Exchange.ARCA });
@@ -124,7 +124,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "cb542eaaeab5eac3bcae5d915ded30da"}
{"OrderListHash", "01a751a837beafd90015b2fd82edf994"}
};
}
}

View File

@@ -75,18 +75,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.200%"},
{"Expectancy", "0"},
{"Net Profit", "3.464%"},
{"Sharpe Ratio", "9.933"},
{"Probabilistic Sharpe Ratio", "82.470%"},
{"Sharpe Ratio", "19.148"},
{"Probabilistic Sharpe Ratio", "97.754%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.957"},
{"Beta", "-0.125"},
{"Annual Standard Deviation", "0.164"},
{"Annual Variance", "0.027"},
{"Information Ratio", "-4.577"},
{"Tracking Error", "0.225"},
{"Treynor Ratio", "-13.006"},
{"Alpha", "-0.005"},
{"Beta", "0.998"},
{"Annual Standard Deviation", "0.138"},
{"Annual Variance", "0.019"},
{"Information Ratio", "-34.028"},
{"Tracking Error", "0"},
{"Treynor Ratio", "2.651"},
{"Total Fees", "$3.45"},
{"Estimated Strategy Capacity", "$970000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -131,30 +131,30 @@ namespace QuantConnect.Algorithm.CSharp
{"Average Win", "0.00%"},
{"Average Loss", "0.00%"},
{"Compounding Annual Return", "-100.000%"},
{"Drawdown", "13.500%"},
{"Drawdown", "13.400%"},
{"Expectancy", "-0.818"},
{"Net Profit", "-13.517%"},
{"Sharpe Ratio", "-2.678"},
{"Net Profit", "-13.418%"},
{"Sharpe Ratio", "-321.172"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "89%"},
{"Win Rate", "11%"},
{"Profit-Loss Ratio", "0.69"},
{"Alpha", "4.469"},
{"Beta", "-0.961"},
{"Annual Standard Deviation", "0.373"},
{"Annual Variance", "0.139"},
{"Information Ratio", "-13.191"},
{"Tracking Error", "0.507"},
{"Treynor Ratio", "1.04"},
{"Alpha", "-1.208"},
{"Beta", "0.013"},
{"Annual Standard Deviation", "0.003"},
{"Annual Variance", "0"},
{"Information Ratio", "-71.816"},
{"Tracking Error", "0.24"},
{"Treynor Ratio", "-77.951"},
{"Total Fees", "$15207.00"},
{"Estimated Strategy Capacity", "$8000.00"},
{"Lowest Capacity Asset", "GC VOFJUCDY9XNH"},
{"Fitness Score", "0.033"},
{"Fitness Score", "0.031"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-8.62"},
{"Return Over Maximum Drawdown", "-7.81"},
{"Portfolio Turnover", "302.321"},
{"Sortino Ratio", "-9.206"},
{"Return Over Maximum Drawdown", "-7.871"},
{"Portfolio Turnover", "302.123"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -168,7 +168,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "35b3f4b7a225468d42ca085386a2383e"}
{"OrderListHash", "9e50b7d8e41033110f927658e731f4c6"}
};
}
}

View File

@@ -142,18 +142,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "5.000%"},
{"Expectancy", "0"},
{"Net Profit", "-3.312%"},
{"Sharpe Ratio", "-7.795"},
{"Probabilistic Sharpe Ratio", "0.164%"},
{"Sharpe Ratio", "-6.305"},
{"Probabilistic Sharpe Ratio", "9.342%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-1.362"},
{"Beta", "0.257"},
{"Annual Standard Deviation", "0.109"},
{"Annual Variance", "0.012"},
{"Information Ratio", "-14.947"},
{"Tracking Error", "0.19"},
{"Treynor Ratio", "-3.309"},
{"Alpha", "-1.465"},
{"Beta", "0.312"},
{"Annual Standard Deviation", "0.134"},
{"Annual Variance", "0.018"},
{"Information Ratio", "-14.77"},
{"Tracking Error", "0.192"},
{"Treynor Ratio", "-2.718"},
{"Total Fees", "$3.70"},
{"Estimated Strategy Capacity", "$52000000.00"},
{"Lowest Capacity Asset", "GC VL5E74HP3EE5"},

View File

@@ -0,0 +1,124 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using QuantConnect.Data;
using QuantConnect.Interfaces;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Basic template algorithm simply initializes the date range and cash. This is a skeleton
/// framework you can use for designing an algorithm.
/// </summary>
/// <meta name="tag" content="using data" />
/// <meta name="tag" content="using quantconnect" />
/// <meta name="tag" content="trading and orders" />
public class BasicTemplateHourlyAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2013, 10, 07); //Set Start Date
SetEndDate(2013, 10, 11); //Set End Date
SetCash(100000); //Set Strategy Cash
// Find more symbols here: http://quantconnect.com/data
// Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
// Futures Resolution: Tick, Second, Minute
// Options Resolution: Minute Only.
AddEquity("SPY", Resolution.Hour);
// There are other assets with similar methods. See "Selecting Options" etc for more details.
// AddFuture, AddForex, AddCfd, AddOption
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
SetHoldings(_spy, 1);
Debug("Purchased Stock");
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "227.693%"},
{"Drawdown", "2.000%"},
{"Expectancy", "0"},
{"Net Profit", "1.529%"},
{"Sharpe Ratio", "8.889"},
{"Probabilistic Sharpe Ratio", "67.609%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.005"},
{"Beta", "0.996"},
{"Annual Standard Deviation", "0.222"},
{"Annual Variance", "0.049"},
{"Information Ratio", "-14.564"},
{"Tracking Error", "0.001"},
{"Treynor Ratio", "1.978"},
{"Total Fees", "$3.44"},
{"Estimated Strategy Capacity", "$110000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},
{"Fitness Score", "0.247"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "12.105"},
{"Return Over Maximum Drawdown", "112.047"},
{"Portfolio Turnover", "0.249"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "f409be3a7c63d9c1394c2e6c005a15ee"}
};
}
}

View File

@@ -41,7 +41,7 @@ namespace QuantConnect.Algorithm.CSharp
public override void Initialize()
{
SetStartDate(2021, 1, 4);
SetEndDate(2021, 1, 15);
SetEndDate(2021, 1, 18);
SetCash(1000000);
// Use indicator for signal; but it cannot be traded
@@ -114,31 +114,31 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "4"},
{"Average Win", "0%"},
{"Average Loss", "-53.10%"},
{"Compounding Annual Return", "-96.172%"},
{"Compounding Annual Return", "-92.544%"},
{"Drawdown", "10.100%"},
{"Expectancy", "-1"},
{"Net Profit", "-9.915%"},
{"Sharpe Ratio", "-4.217"},
{"Probabilistic Sharpe Ratio", "0.052%"},
{"Sharpe Ratio", "-3.845"},
{"Probabilistic Sharpe Ratio", "0.053%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.908"},
{"Beta", "0.468"},
{"Annual Standard Deviation", "0.139"},
{"Annual Variance", "0.019"},
{"Information Ratio", "-9.003"},
{"Tracking Error", "0.142"},
{"Treynor Ratio", "-1.251"},
{"Alpha", "-0.558"},
{"Beta", "0.313"},
{"Annual Standard Deviation", "0.112"},
{"Annual Variance", "0.013"},
{"Information Ratio", "-6.652"},
{"Tracking Error", "0.125"},
{"Treynor Ratio", "-1.379"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$14000000.00"},
{"Estimated Strategy Capacity", "$13000000.00"},
{"Lowest Capacity Asset", "SPX XL80P3GHDZXQ|SPX 31"},
{"Fitness Score", "0.044"},
{"Fitness Score", "0.039"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-1.96"},
{"Return Over Maximum Drawdown", "-10.171"},
{"Portfolio Turnover", "0.34"},
{"Sortino Ratio", "-1.763"},
{"Return Over Maximum Drawdown", "-9.371"},
{"Portfolio Turnover", "0.278"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -152,7 +152,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "52521ab779446daf4d38a7c9bbbdd893"}
{"OrderListHash", "0668385036aba3e95127607dfc2f1a59"}
};
}
}

View File

@@ -41,7 +41,7 @@ namespace QuantConnect.Algorithm.CSharp
private readonly Identity _brent = new Identity("Brent");
private readonly Identity _wti = new Identity("WTI");
private CompositeIndicator<IndicatorDataPoint> _spread;
private CompositeIndicator _spread;
private ExponentialMovingAverage _emaWti;

View File

@@ -0,0 +1,171 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// This example demonstrates how to add options for a given underlying equity security.
/// It also shows how you can prefilter contracts easily based on strikes and expirations, and how you
/// can inspect the option chain to pick a specific option contract to trade.
/// </summary>
/// <meta name="tag" content="using data" />
/// <meta name="tag" content="options" />
/// <meta name="tag" content="filter selection" />
public class BasicTemplateOptionsDailyAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private const string UnderlyingTicker = "GOOG";
public Symbol OptionSymbol;
private bool _optionExpired;
public override void Initialize()
{
SetStartDate(2015, 12, 23);
SetEndDate(2016, 1, 20);
SetCash(100000);
var equity = AddEquity(UnderlyingTicker, Resolution.Daily);
var option = AddOption(UnderlyingTicker, Resolution.Daily);
OptionSymbol = option.Symbol;
option.SetFilter(x => x.CallsOnly().Strikes(0, 1).Expiration(0, 30));
// use the underlying equity as the benchmark
SetBenchmark(equity.Symbol);
}
/// <summary>
/// Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event
/// </summary>
/// <param name="slice">The current slice of data keyed by symbol string</param>
public override void OnData(Slice slice)
{
if (!Portfolio.Invested)
{
OptionChain chain;
if (slice.OptionChains.TryGetValue(OptionSymbol, out chain))
{
// Grab us the contract nearest expiry that is not today
var contractsByExpiration = chain.Where(x => x.Expiry != Time.Date).OrderBy(x => x.Expiry);
var contract = contractsByExpiration.FirstOrDefault();
if (contract != null)
{
// if found, trade it
MarketOrder(contract.Symbol, 1);
}
}
}
}
/// <summary>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
public override void OnOrderEvent(OrderEvent orderEvent)
{
Log(orderEvent.ToString());
// Check for our expected OTM option expiry
if (orderEvent.Message == "OTM")
{
// Assert it is at midnight (5AM UTC)
if (orderEvent.UtcTime != new DateTime(2016, 1, 16, 5, 0, 0))
{
throw new ArgumentException($"Expiry event was not at the correct time, {orderEvent.UtcTime}");
}
_optionExpired = true;
}
}
public override void OnEndOfAlgorithm()
{
// Assert we had our option expire and fill a liquidation order
if (_optionExpired != true)
{
throw new ArgumentException("Algorithm did not process the option expiration like expected");
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp, Language.Python };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-1.31%"},
{"Compounding Annual Return", "-15.304%"},
{"Drawdown", "1.300%"},
{"Expectancy", "-1"},
{"Net Profit", "-1.311%"},
{"Sharpe Ratio", "-3.31"},
{"Probabilistic Sharpe Ratio", "0.035%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0.034"},
{"Annual Variance", "0.001"},
{"Information Ratio", "-3.31"},
{"Tracking Error", "0.034"},
{"Treynor Ratio", "0"},
{"Total Fees", "$1.00"},
{"Estimated Strategy Capacity", "$18000.00"},
{"Lowest Capacity Asset", "GOOCV W78ZFMML01JA|GOOCV VP83T1ZUHROL"},
{"Fitness Score", "0"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-1.496"},
{"Return Over Maximum Drawdown", "-11.673"},
{"Portfolio Turnover", "0"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "c6d089f1fb86379c74a7413a9c2f8553"}
};
}
}

View File

@@ -41,7 +41,7 @@ namespace QuantConnect.Algorithm.CSharp
public override void Initialize()
{
SetStartDate(2015, 12, 24);
SetEndDate(2015, 12, 24);
SetEndDate(2015, 12, 28);
SetCash(100000);
var equity = AddEquity(UnderlyingTicker);
@@ -104,14 +104,14 @@ namespace QuantConnect.Algorithm.CSharp
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "0%"},
{"Drawdown", "0%"},
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Average Loss", "-0.40%"},
{"Compounding Annual Return", "-21.622%"},
{"Drawdown", "0.300%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.311%"},
{"Sharpe Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
@@ -124,12 +124,12 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Fees", "$1.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"},
{"Fitness Score", "0"},
{"Fitness Score", "0.188"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "0"},
{"Return Over Maximum Drawdown", "0"},
{"Portfolio Turnover", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-73.268"},
{"Portfolio Turnover", "0.376"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -143,7 +143,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "92d8a50efe230524512404dab66b19dd"}
{"OrderListHash", "452e7a36e0a95e33d3457a908add3ead"}
};
}
}

View File

@@ -36,7 +36,7 @@ namespace QuantConnect.Algorithm.CSharp
UniverseSettings.Resolution = Resolution.Minute;
SetStartDate(2014, 06, 05);
SetEndDate(2014, 06, 06);
SetEndDate(2014, 06, 09);
SetCash(100000);
// set framework models
@@ -142,47 +142,47 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "4"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Average Win", "0.14%"},
{"Average Loss", "-0.28%"},
{"Compounding Annual Return", "0%"},
{"Drawdown", "0%"},
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "0"},
{"Tracking Error", "0"},
{"Treynor Ratio", "0"},
{"Drawdown", "385.400%"},
{"Expectancy", "-0.249"},
{"Net Profit", "-386.489%"},
{"Sharpe Ratio", "-0.033"},
{"Probabilistic Sharpe Ratio", "1.235%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.50"},
{"Alpha", "-95.983"},
{"Beta", "263.726"},
{"Annual Standard Deviation", "30.617"},
{"Annual Variance", "937.371"},
{"Information Ratio", "-0.044"},
{"Tracking Error", "30.604"},
{"Treynor Ratio", "-0.004"},
{"Total Fees", "$3.00"},
{"Estimated Strategy Capacity", "$74000.00"},
{"Lowest Capacity Asset", "AAPL 2ZQGWTSSZ0WLI|AAPL R735QTJ8XC9X"},
{"Fitness Score", "0"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},
{"Fitness Score", "0.168"},
{"Kelly Criterion Estimate", "0.327"},
{"Kelly Criterion Probability Value", "1"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "79228162514264337593543950335"},
{"Portfolio Turnover", "0"},
{"Total Insights Generated", "26"},
{"Return Over Maximum Drawdown", "0"},
{"Portfolio Turnover", "0.224"},
{"Total Insights Generated", "28"},
{"Total Insights Closed", "24"},
{"Total Insights Analysis Completed", "24"},
{"Long Insight Count", "26"},
{"Long Insight Count", "28"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$31.01809"},
{"Estimated Monthly Alpha Value", "$13.64796"},
{"Total Accumulated Estimated Alpha Value", "$1.89555"},
{"Mean Population Estimated Insight Value", "$0.07898125"},
{"Mean Population Direction", "50%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "50.0482%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "ce06ddfa4b2ffeb666a8910ac8836992"}
{"OrderListHash", "87603bd45898dd9c456745fa51f989a5"}
};
}
}

View File

@@ -0,0 +1,158 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// This example demonstrates how to add options for a given underlying equity security.
/// It also shows how you can prefilter contracts easily based on strikes and expirations, and how you
/// can inspect the option chain to pick a specific option contract to trade.
/// </summary>
/// <meta name="tag" content="using data" />
/// <meta name="tag" content="options" />
/// <meta name="tag" content="filter selection" />
public class BasicTemplateOptionsHourlyAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private const string UnderlyingTicker = "AAPL";
public Symbol OptionSymbol;
public override void Initialize()
{
SetStartDate(2014, 6, 6);
SetEndDate(2014, 6, 9);
SetCash(100000);
var equity = AddEquity(UnderlyingTicker, Resolution.Hour);
var option = AddOption(UnderlyingTicker, Resolution.Hour);
OptionSymbol = option.Symbol;
// set our strike/expiry filter for this option chain
option.SetFilter(u => u.Strikes(-2, +2)
// Expiration method accepts TimeSpan objects or integer for days.
// The following statements yield the same filtering criteria
.Expiration(0, 180));
// .Expiration(TimeSpan.Zero, TimeSpan.FromDays(180)));
// use the underlying equity as the benchmark
SetBenchmark(equity.Symbol);
}
/// <summary>
/// Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event
/// </summary>
/// <param name="slice">The current slice of data keyed by symbol string</param>
public override void OnData(Slice slice)
{
if (!Portfolio.Invested && IsMarketOpen(OptionSymbol))
{
OptionChain chain;
if (slice.OptionChains.TryGetValue(OptionSymbol, out chain))
{
// we find at the money (ATM) put contract with farthest expiration
var atmContract = chain
.OrderByDescending(x => x.Expiry)
.ThenBy(x => Math.Abs(chain.Underlying.Price - x.Strike))
.ThenByDescending(x => x.Right)
.FirstOrDefault();
if (atmContract != null)
{
// if found, trade it
MarketOrder(atmContract.Symbol, 1);
MarketOnCloseOrder(atmContract.Symbol, -1);
}
}
}
}
/// <summary>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
public override void OnOrderEvent(OrderEvent orderEvent)
{
Log(orderEvent.ToString());
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp, Language.Python };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "4"},
{"Average Win", "0%"},
{"Average Loss", "-0.07%"},
{"Compounding Annual Return", "-12.496%"},
{"Drawdown", "0.200%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.134%"},
{"Sharpe Ratio", "-8.839"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.083"},
{"Beta", "-0.054"},
{"Annual Standard Deviation", "0.008"},
{"Annual Variance", "0"},
{"Information Ratio", "-18.699"},
{"Tracking Error", "0.155"},
{"Treynor Ratio", "1.296"},
{"Total Fees", "$4.00"},
{"Estimated Strategy Capacity", "$1000.00"},
{"Lowest Capacity Asset", "AAPL 2ZTXYMUAHCIAU|AAPL R735QTJ8XC9X"},
{"Fitness Score", "0.04"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-118.28"},
{"Portfolio Turnover", "0.081"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "81e8a822d43de2165c1d3f52964ec312"}
};
}
}

View File

@@ -85,18 +85,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.100%"},
{"Expectancy", "-1"},
{"Net Profit", "0.667%"},
{"Sharpe Ratio", "3.507"},
{"Probabilistic Sharpe Ratio", "59.181%"},
{"Sharpe Ratio", "3.993"},
{"Probabilistic Sharpe Ratio", "58.777%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.384"},
{"Beta", "0.564"},
{"Annual Standard Deviation", "0.116"},
{"Annual Variance", "0.013"},
{"Information Ratio", "-10.791"},
{"Tracking Error", "0.092"},
{"Treynor Ratio", "0.718"},
{"Alpha", "-0.598"},
{"Beta", "0.569"},
{"Annual Standard Deviation", "0.133"},
{"Annual Variance", "0.018"},
{"Information Ratio", "-13.973"},
{"Tracking Error", "0.104"},
{"Treynor Ratio", "0.932"},
{"Total Fees", "$46.20"},
{"Estimated Strategy Capacity", "$2300000.00"},
{"Lowest Capacity Asset", "AIG R735QTJ8XC9X"},

View File

@@ -33,7 +33,7 @@ namespace QuantConnect.Algorithm.CSharp
{
SetAccountCurrency("EUR");
SetStartDate(2019, 2, 20);
SetStartDate(2019, 2, 19);
SetEndDate(2019, 2, 21);
SetCash("EUR", 100000);
@@ -75,34 +75,34 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "251"},
{"Total Trades", "279"},
{"Average Win", "0.01%"},
{"Average Loss", "-0.01%"},
{"Compounding Annual Return", "-37.465%"},
{"Compounding Annual Return", "-33.650%"},
{"Drawdown", "0.300%"},
{"Expectancy", "-0.285"},
{"Net Profit", "-0.257%"},
{"Sharpe Ratio", "-40.568"},
{"Expectancy", "-0.345"},
{"Net Profit", "-0.337%"},
{"Sharpe Ratio", "-19.772"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "66%"},
{"Win Rate", "34%"},
{"Profit-Loss Ratio", "1.08"},
{"Loss Rate", "68%"},
{"Win Rate", "32%"},
{"Profit-Loss Ratio", "1.07"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0.006"},
{"Annual Standard Deviation", "0.014"},
{"Annual Variance", "0"},
{"Information Ratio", "-40.568"},
{"Tracking Error", "0.006"},
{"Information Ratio", "-19.772"},
{"Tracking Error", "0.014"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$660000.00"},
{"Estimated Strategy Capacity", "$670000.00"},
{"Lowest Capacity Asset", "DE30EUR 8I"},
{"Fitness Score", "0.002"},
{"Fitness Score", "0"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-23.868"},
{"Return Over Maximum Drawdown", "-170.818"},
{"Portfolio Turnover", "12.673"},
{"Sortino Ratio", "-101.587"},
{"Return Over Maximum Drawdown", "-110.633"},
{"Portfolio Turnover", "9.513"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -116,7 +116,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "6745cf313aa3ef780d052ca3ba933c6c"}
{"OrderListHash", "64c098abe3c1e7206424b0c3825b0069"}
};
}
}

View File

@@ -27,7 +27,7 @@ namespace QuantConnect.Algorithm.CSharp
/// <meta name="tag" content="indicators" />
/// <meta name="tag" content="using data" />
/// <meta name="tag" content="consolidating data" />
public class RenkoConsolidatorAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
public class ClassicRenkoConsolidatorAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
/// <summary>
/// Initializes the algorithm state.
@@ -43,7 +43,7 @@ namespace QuantConnect.Algorithm.CSharp
// property of the data it receives.
// break SPY into $2.5 renko bricks and send that data to our 'OnRenkoBar' method
var renkoClose = new RenkoConsolidator(2.5m);
var renkoClose = new ClassicRenkoConsolidator(2.5m);
renkoClose.DataConsolidated += (sender, consolidated) =>
{
// call our event handler for renko data
@@ -58,7 +58,7 @@ namespace QuantConnect.Algorithm.CSharp
// this allows us to perform the renko logic on values other than Close, even computed values!
// break SPY into (2*o + h + l + 3*c)/7
var renko7bar = new RenkoConsolidator<TradeBar>(2.5m, x => (2 * x.Open + x.High + x.Low + 3 * x.Close) / 7m, x => x.Volume);
var renko7bar = new ClassicRenkoConsolidator<TradeBar>(2.5m, x => (2 * x.Open + x.High + x.Low + 3 * x.Close) / 7m, x => x.Volume);
renko7bar.DataConsolidated += (sender, consolidated) =>
{
HandleRenko7Bar(consolidated);
@@ -123,18 +123,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "6.800%"},
{"Expectancy", "0.281"},
{"Net Profit", "7.841%"},
{"Sharpe Ratio", "0.878"},
{"Probabilistic Sharpe Ratio", "43.343%"},
{"Sharpe Ratio", "0.799"},
{"Probabilistic Sharpe Ratio", "39.344%"},
{"Loss Rate", "43%"},
{"Win Rate", "57%"},
{"Profit-Loss Ratio", "1.24"},
{"Alpha", "0.065"},
{"Beta", "0.013"},
{"Annual Standard Deviation", "0.077"},
{"Annual Variance", "0.006"},
{"Information Ratio", "-0.513"},
{"Tracking Error", "0.139"},
{"Treynor Ratio", "5.253"},
{"Alpha", "0.009"},
{"Beta", "0.411"},
{"Annual Standard Deviation", "0.07"},
{"Annual Variance", "0.005"},
{"Information Ratio", "-0.703"},
{"Tracking Error", "0.083"},
{"Treynor Ratio", "0.136"},
{"Total Fees", "$129.35"},
{"Estimated Strategy Capacity", "$1000000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -168,18 +168,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.400%"},
{"Expectancy", "0"},
{"Net Profit", "1.163%"},
{"Sharpe Ratio", "2.876"},
{"Probabilistic Sharpe Ratio", "64.984%"},
{"Sharpe Ratio", "2.754"},
{"Probabilistic Sharpe Ratio", "64.748%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.237"},
{"Beta", "-0.188"},
{"Annual Standard Deviation", "0.089"},
{"Annual Variance", "0.008"},
{"Information Ratio", "2.409"},
{"Tracking Error", "0.148"},
{"Treynor Ratio", "-1.358"},
{"Alpha", "0.277"},
{"Beta", "0.436"},
{"Annual Standard Deviation", "0.086"},
{"Annual Variance", "0.007"},
{"Information Ratio", "3.572"},
{"Tracking Error", "0.092"},
{"Treynor Ratio", "0.54"},
{"Total Fees", "$2.00"},
{"Estimated Strategy Capacity", "$49000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},

View File

@@ -41,7 +41,7 @@ namespace QuantConnect.Algorithm.CSharp
_aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
UniverseSettings.Resolution = Resolution.Minute;
SetStartDate(2014, 06, 05);
SetStartDate(2014, 06, 04);
SetEndDate(2014, 06, 06);
var selectionUniverse = AddUniverse(enumerable => new[] { Time.Date <= new DateTime(2014, 6, 5) ? _twx : _aapl },
@@ -144,34 +144,12 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "13"},
{"Average Win", "0.65%"},
{"Average Loss", "-0.05%"},
{"Compounding Annual Return", "79228162514264337593543950335%"},
{"Drawdown", "0.500%"},
{"Expectancy", "1.393"},
{"Net Profit", "149.699%"},
{"Sharpe Ratio", "4.743312616499238E+27"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "83%"},
{"Win Rate", "17%"},
{"Profit-Loss Ratio", "13.36"},
{"Alpha", "7.922816251426434E+28"},
{"Beta", "304.581"},
{"Annual Standard Deviation", "16.703"},
{"Annual Variance", "278.995"},
{"Information Ratio", "4.75893717482582E+27"},
{"Tracking Error", "16.648"},
{"Treynor Ratio", "2.6012216611301735E+26"},
{"Total Fees", "$13.20"},
{"Estimated Strategy Capacity", "$3000000.00"},
{"Lowest Capacity Asset", "AOL VRKS95ENLBYE|AOL R735QTJ8XC9X"},
{"Fitness Score", "0.18"},
{"Fitness Score", "0.12"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "79228162514264337593543950335"},
{"Portfolio Turnover", "0.18"},
{"Portfolio Turnover", "0.12"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},

View File

@@ -123,18 +123,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.700%"},
{"Expectancy", "0.850"},
{"Net Profit", "0.637%"},
{"Sharpe Ratio", "1.131"},
{"Probabilistic Sharpe Ratio", "50.538%"},
{"Sharpe Ratio", "1.088"},
{"Probabilistic Sharpe Ratio", "50.223%"},
{"Loss Rate", "40%"},
{"Win Rate", "60%"},
{"Profit-Loss Ratio", "2.08"},
{"Alpha", "0.186"},
{"Beta", "0.465"},
{"Annual Standard Deviation", "0.123"},
{"Annual Variance", "0.015"},
{"Information Ratio", "1.908"},
{"Tracking Error", "0.126"},
{"Treynor Ratio", "0.299"},
{"Alpha", "0.198"},
{"Beta", "0.741"},
{"Annual Standard Deviation", "0.118"},
{"Annual Variance", "0.014"},
{"Information Ratio", "2.294"},
{"Tracking Error", "0.097"},
{"Treynor Ratio", "0.173"},
{"Total Fees", "$27.94"},
{"Estimated Strategy Capacity", "$200000000.00"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},

View File

@@ -107,18 +107,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.000%"},
{"Expectancy", "0"},
{"Net Profit", "1.003%"},
{"Sharpe Ratio", "5.024"},
{"Probabilistic Sharpe Ratio", "68.421%"},
{"Sharpe Ratio", "5.36"},
{"Probabilistic Sharpe Ratio", "69.521%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.312"},
{"Beta", "0.27"},
{"Alpha", "0"},
{"Beta", "1.003"},
{"Annual Standard Deviation", "0.087"},
{"Annual Variance", "0.008"},
{"Information Ratio", "-0.242"},
{"Tracking Error", "0.105"},
{"Treynor Ratio", "1.616"},
{"Annual Variance", "0.007"},
{"Information Ratio", "6.477"},
{"Tracking Error", "0"},
{"Treynor Ratio", "0.462"},
{"Total Fees", "$3.08"},
{"Estimated Strategy Capacity", "$720000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -147,22 +147,22 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-99.999%"},
{"Drawdown", "16.100%"},
{"Compounding Annual Return", "0%"},
{"Drawdown", "0%"},
{"Expectancy", "0"},
{"Net Profit", "-6.366%"},
{"Sharpe Ratio", "1.194"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "5.56"},
{"Beta", "-71.105"},
{"Annual Standard Deviation", "0.434"},
{"Annual Variance", "0.188"},
{"Information Ratio", "1.016"},
{"Tracking Error", "0.44"},
{"Treynor Ratio", "-0.007"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "0"},
{"Tracking Error", "0"},
{"Treynor Ratio", "0"},
{"Total Fees", "$20.35"},
{"Estimated Strategy Capacity", "$19000000.00"},
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},

View File

@@ -177,18 +177,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.900%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.540%"},
{"Sharpe Ratio", "-3.168"},
{"Probabilistic Sharpe Ratio", "23.963%"},
{"Sharpe Ratio", "-3.349"},
{"Probabilistic Sharpe Ratio", "25.715%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.456"},
{"Beta", "0.157"},
{"Annual Standard Deviation", "0.075"},
{"Annual Variance", "0.006"},
{"Information Ratio", "-9.176"},
{"Tracking Error", "0.178"},
{"Treynor Ratio", "-1.514"},
{"Alpha", "-0.724"},
{"Beta", "0.22"},
{"Annual Standard Deviation", "0.086"},
{"Annual Variance", "0.007"},
{"Information Ratio", "-12.125"},
{"Tracking Error", "0.187"},
{"Treynor Ratio", "-1.304"},
{"Total Fees", "$32.32"},
{"Estimated Strategy Capacity", "$95000000.00"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},

View File

@@ -0,0 +1,184 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
using QuantConnect.Securities;
using QuantConnect.Data.Market;
using System.Collections.Generic;
using QuantConnect.Securities.Future;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Continuous Back Month Raw Futures Regression algorithm. Asserting and showcasing the behavior of adding a continuous future
/// </summary>
public class ContinuousBackMonthRawFutureRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private List<SymbolChangedEvent> _mappings = new();
private Future _continuousContract;
private DateTime _lastDateLog;
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2013, 7, 1);
SetEndDate(2014, 1, 1);
_continuousContract = AddFuture(Futures.Indices.SP500EMini,
dataNormalizationMode: DataNormalizationMode.Raw,
dataMappingMode: DataMappingMode.FirstDayMonth,
contractDepthOffset: 1
);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (data.Keys.Count != 1)
{
throw new Exception($"We are getting data for more than one symbols! {string.Join(",", data.Keys.Select(symbol => symbol))}");
}
foreach (var changedEvent in data.SymbolChangedEvents.Values)
{
if (changedEvent.Symbol == _continuousContract.Symbol)
{
_mappings.Add(changedEvent);
Log($"SymbolChanged event: {changedEvent}");
var currentExpiration = changedEvent.Symbol.Underlying.ID.Date;
// +4 months cause we are actually using the back month, es is quarterly contract
var frontMonthExpiration = FuturesExpiryFunctions.FuturesExpiryFunction(_continuousContract.Symbol)(Time.AddMonths(1 + 4));
if (currentExpiration != frontMonthExpiration.Date)
{
throw new Exception($"Unexpected current mapped contract expiration {currentExpiration}" +
$" @ {Time} it should be AT front month expiration {frontMonthExpiration}");
}
}
}
if (_lastDateLog.Month != Time.Month)
{
_lastDateLog = Time;
Log($"{Time}- {Securities[_continuousContract.Symbol].GetLastData()}");
if (Portfolio.Invested)
{
Liquidate();
}
else if(_continuousContract.HasData)
{
// This works because we set this contract as tradable, even if it's a canonical security
Buy(_continuousContract.Symbol, 1);
}
if(Time.Month == 1 && Time.Year == 2013)
{
var response = History(new[] { _continuousContract.Symbol }, 60 * 24 * 90);
if (!response.Any())
{
throw new Exception("Unexpected empty history response");
}
}
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
if (orderEvent.Status == OrderStatus.Filled)
{
Log($"{orderEvent}");
}
}
public override void OnEndOfAlgorithm()
{
var expectedMappingCounts = 2;
if (_mappings.Count != expectedMappingCounts)
{
throw new Exception($"Unexpected symbol changed events: {_mappings.Count}, was expecting {expectedMappingCounts}");
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "1.11%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "2.199%"},
{"Drawdown", "1.700%"},
{"Expectancy", "0"},
{"Net Profit", "1.109%"},
{"Sharpe Ratio", "0.717"},
{"Probabilistic Sharpe Ratio", "38.157%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.007"},
{"Beta", "0.099"},
{"Annual Standard Deviation", "0.022"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.732"},
{"Tracking Error", "0.076"},
{"Treynor Ratio", "0.156"},
{"Total Fees", "$3.70"},
{"Estimated Strategy Capacity", "$3900000.00"},
{"Lowest Capacity Asset", "ES 1S1"},
{"Fitness Score", "0.007"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "0.484"},
{"Return Over Maximum Drawdown", "1.736"},
{"Portfolio Turnover", "0.011"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "7d6fb409115f2f8d403c7eb261b9b3b6"}
};
}
}

View File

@@ -0,0 +1,197 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
using QuantConnect.Securities;
using QuantConnect.Data.Market;
using System.Collections.Generic;
using QuantConnect.Securities.Future;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Continuous Futures Back Month #1 Regression algorithm. Asserting and showcasing the behavior of adding a continuous future
/// </summary>
public class ContinuousFutureBackMonthRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private List<SymbolChangedEvent> _mappings = new();
private Future _continuousContract;
private DateTime _lastDateLog;
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2013, 7, 1);
SetEndDate(2014, 1, 1);
try
{
AddFuture(Futures.Indices.SP500EMini,
dataNormalizationMode: DataNormalizationMode.BackwardsPanamaCanal,
dataMappingMode: DataMappingMode.OpenInterest,
contractDepthOffset: 5
);
throw new Exception("Expected out of rage exception. We don't support that many back months");
}
catch (ArgumentOutOfRangeException)
{
// expected
}
_continuousContract = AddFuture(Futures.Indices.SP500EMini,
dataNormalizationMode: DataNormalizationMode.BackwardsPanamaCanal,
dataMappingMode: DataMappingMode.OpenInterest,
contractDepthOffset: 1
);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (data.Keys.Count != 1)
{
throw new Exception($"We are getting data for more than one symbols! {string.Join(",", data.Keys.Select(symbol => symbol))}");
}
foreach (var changedEvent in data.SymbolChangedEvents.Values)
{
if (changedEvent.Symbol == _continuousContract.Symbol)
{
_mappings.Add(changedEvent);
Log($"SymbolChanged event: {changedEvent}");
var backMonthExpiration = changedEvent.Symbol.Underlying.ID.Date;
var frontMonthExpiration = FuturesExpiryFunctions.FuturesExpiryFunction(_continuousContract.Symbol)(Time.AddMonths(1));
if (backMonthExpiration <= frontMonthExpiration.Date)
{
throw new Exception($"Unexpected current mapped contract expiration {backMonthExpiration}" +
$" @ {Time} it should be AFTER front month expiration {frontMonthExpiration}");
}
}
}
if (_lastDateLog.Month != Time.Month)
{
_lastDateLog = Time;
Log($"{Time}- {Securities[_continuousContract.Symbol].GetLastData()}");
if (Portfolio.Invested)
{
Liquidate();
}
else if(_continuousContract.HasData)
{
// This works because we set this contract as tradable, even if it's a canonical security
Buy(_continuousContract.Symbol, 1);
}
if(Time.Month == 1 && Time.Year == 2013)
{
var response = History(new[] { _continuousContract.Symbol }, 60 * 24 * 90);
if (!response.Any())
{
throw new Exception("Unexpected empty history response");
}
}
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
if (orderEvent.Status == OrderStatus.Filled)
{
Log($"{orderEvent}");
}
}
public override void OnEndOfAlgorithm()
{
var expectedMappingCounts = 2;
if (_mappings.Count != expectedMappingCounts)
{
throw new Exception($"Unexpected symbol changed events: {_mappings.Count}, was expecting {expectedMappingCounts}");
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "1.11%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "2.092%"},
{"Drawdown", "1.700%"},
{"Expectancy", "0"},
{"Net Profit", "1.055%"},
{"Sharpe Ratio", "0.682"},
{"Probabilistic Sharpe Ratio", "36.937%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.007"},
{"Beta", "0.099"},
{"Annual Standard Deviation", "0.022"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.742"},
{"Tracking Error", "0.076"},
{"Treynor Ratio", "0.149"},
{"Total Fees", "$5.55"},
{"Estimated Strategy Capacity", "$190000.00"},
{"Lowest Capacity Asset", "ES 1S1"},
{"Fitness Score", "0.01"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "0.479"},
{"Return Over Maximum Drawdown", "1.652"},
{"Portfolio Turnover", "0.015"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "9f7574803b8ebfac8f912019c943d27e"}
};
}
}

View File

@@ -0,0 +1,183 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Orders;
using QuantConnect.Interfaces;
using QuantConnect.Securities;
using QuantConnect.Data.Market;
using System.Collections.Generic;
using QuantConnect.Securities.Future;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Continuous Futures Regression algorithm. Asserting and showcasing the behavior of adding a continuous future
/// </summary>
public class ContinuousFutureRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private List<SymbolChangedEvent> _mappings = new();
private Future _continuousContract;
private DateTime _lastDateLog;
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2013, 7, 1);
SetEndDate(2014, 1, 1);
_continuousContract = AddFuture(Futures.Indices.SP500EMini,
dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
dataMappingMode: DataMappingMode.LastTradingDay,
contractDepthOffset: 0
);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (data.Keys.Count != 1)
{
throw new Exception($"We are getting data for more than one symbols! {string.Join(",", data.Keys.Select(symbol => symbol))}");
}
foreach (var changedEvent in data.SymbolChangedEvents.Values)
{
if (changedEvent.Symbol == _continuousContract.Symbol)
{
_mappings.Add(changedEvent);
Log($"SymbolChanged event: {changedEvent}");
var currentExpiration = changedEvent.Symbol.Underlying.ID.Date;
var frontMonthExpiration = FuturesExpiryFunctions.FuturesExpiryFunction(_continuousContract.Symbol)(Time.AddMonths(1));
if (currentExpiration != frontMonthExpiration.Date)
{
throw new Exception($"Unexpected current mapped contract expiration {currentExpiration}" +
$" @ {Time} it should be AT front month expiration {frontMonthExpiration}");
}
}
}
if (_lastDateLog.Month != Time.Month)
{
_lastDateLog = Time;
Log($"{Time}- {Securities[_continuousContract.Symbol].GetLastData()}");
if (Portfolio.Invested)
{
Liquidate();
}
else if(_continuousContract.HasData)
{
// This works because we set this contract as tradable, even if it's a canonical security
Buy(_continuousContract.Symbol, 1);
}
if(Time.Month == 1 && Time.Year == 2013)
{
var response = History(new[] { _continuousContract.Symbol }, 60 * 24 * 90);
if (!response.Any())
{
throw new Exception("Unexpected empty history response");
}
}
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
if (orderEvent.Status == OrderStatus.Filled)
{
Log($"{orderEvent}");
}
}
public override void OnEndOfAlgorithm()
{
var expectedMappingCounts = 2;
if (_mappings.Count != expectedMappingCounts)
{
throw new Exception($"Unexpected symbol changed events: {_mappings.Count}, was expecting {expectedMappingCounts}");
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp, Language.Python };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "1.03%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "1.970%"},
{"Drawdown", "1.400%"},
{"Expectancy", "0"},
{"Net Profit", "0.994%"},
{"Sharpe Ratio", "0.7"},
{"Probabilistic Sharpe Ratio", "37.553%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.006"},
{"Beta", "0.091"},
{"Annual Standard Deviation", "0.02"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.745"},
{"Tracking Error", "0.076"},
{"Treynor Ratio", "0.153"},
{"Total Fees", "$5.55"},
{"Estimated Strategy Capacity", "$48000000.00"},
{"Lowest Capacity Asset", "ES 1S1"},
{"Fitness Score", "0.01"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "0.492"},
{"Return Over Maximum Drawdown", "1.708"},
{"Portfolio Turnover", "0.016"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "fb3bb82d84fc6c390a40f36d0d1faf59"}
};
}
}

View File

@@ -133,18 +133,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "53.000%"},
{"Expectancy", "-0.053"},
{"Net Profit", "-29.486%"},
{"Sharpe Ratio", "-0.078"},
{"Probabilistic Sharpe Ratio", "0.004%"},
{"Sharpe Ratio", "-0.072"},
{"Probabilistic Sharpe Ratio", "0.001%"},
{"Loss Rate", "56%"},
{"Win Rate", "44%"},
{"Profit-Loss Ratio", "1.15"},
{"Alpha", "-0.013"},
{"Beta", "0.007"},
{"Annual Standard Deviation", "0.163"},
{"Annual Variance", "0.027"},
{"Information Ratio", "-0.393"},
{"Tracking Error", "0.238"},
{"Treynor Ratio", "-1.72"},
{"Alpha", "-0.004"},
{"Beta", "-0.095"},
{"Annual Standard Deviation", "0.149"},
{"Annual Variance", "0.022"},
{"Information Ratio", "-0.34"},
{"Tracking Error", "0.23"},
{"Treynor Ratio", "0.113"},
{"Total Fees", "$796.82"},
{"Estimated Strategy Capacity", "$1200000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -104,18 +104,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "21.600%"},
{"Expectancy", "0"},
{"Net Profit", "38.619%"},
{"Sharpe Ratio", "33.779"},
{"Probabilistic Sharpe Ratio", "77.029%"},
{"Sharpe Ratio", "14.33"},
{"Probabilistic Sharpe Ratio", "75.756%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "32.812"},
{"Beta", "8.756"},
{"Annual Standard Deviation", "1.11"},
{"Annual Variance", "1.231"},
{"Information Ratio", "37.501"},
{"Tracking Error", "0.985"},
{"Treynor Ratio", "4.281"},
{"Alpha", "10.389"},
{"Beta", "8.754"},
{"Annual Standard Deviation", "0.95"},
{"Annual Variance", "0.903"},
{"Information Ratio", "15.703"},
{"Tracking Error", "0.844"},
{"Treynor Ratio", "1.555"},
{"Total Fees", "$30.00"},
{"Estimated Strategy Capacity", "$22000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -123,13 +123,13 @@ namespace QuantConnect.Algorithm.CSharp
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.736"},
{"Beta", "0.142"},
{"Alpha", "1.747"},
{"Beta", "0.047"},
{"Annual Standard Deviation", "0.84"},
{"Annual Variance", "0.706"},
{"Information Ratio", "1.925"},
{"Tracking Error", "0.846"},
{"Treynor Ratio", "12.334"},
{"Information Ratio", "1.922"},
{"Tracking Error", "0.848"},
{"Treynor Ratio", "37.47"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "BTC.Bitcoin 2S"},

View File

@@ -93,13 +93,13 @@ namespace QuantConnect.Algorithm.CSharp
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.736"},
{"Beta", "0.142"},
{"Alpha", "1.747"},
{"Beta", "0.047"},
{"Annual Standard Deviation", "0.84"},
{"Annual Variance", "0.706"},
{"Information Ratio", "1.925"},
{"Tracking Error", "0.846"},
{"Treynor Ratio", "12.333"},
{"Information Ratio", "1.922"},
{"Tracking Error", "0.848"},
{"Treynor Ratio", "37.473"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "BTC.Bitcoin 2S"},

View File

@@ -128,18 +128,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "11.000%"},
{"Expectancy", "0"},
{"Net Profit", "-10.343%"},
{"Sharpe Ratio", "-1.554"},
{"Probabilistic Sharpe Ratio", "0.001%"},
{"Sharpe Ratio", "-1.696"},
{"Probabilistic Sharpe Ratio", "0.009%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.91"},
{"Beta", "-5.602"},
{"Annual Standard Deviation", "0.643"},
{"Annual Variance", "0.413"},
{"Information Ratio", "-1.378"},
{"Tracking Error", "0.736"},
{"Treynor Ratio", "0.178"},
{"Alpha", "-0.924"},
{"Beta", "-5.612"},
{"Annual Standard Deviation", "0.587"},
{"Annual Variance", "0.345"},
{"Information Ratio", "-1.517"},
{"Tracking Error", "0.664"},
{"Treynor Ratio", "0.177"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "NWSA.CustomDataUsingMapping T3MO1488O0H0"},

View File

@@ -199,18 +199,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "2.400%"},
{"Expectancy", "-0.187"},
{"Net Profit", "-0.629%"},
{"Sharpe Ratio", "-1.475"},
{"Probabilistic Sharpe Ratio", "23.597%"},
{"Sharpe Ratio", "-1.281"},
{"Probabilistic Sharpe Ratio", "21.874%"},
{"Loss Rate", "70%"},
{"Win Rate", "30%"},
{"Profit-Loss Ratio", "1.73"},
{"Alpha", "-0.136"},
{"Beta", "0.126"},
{"Annual Standard Deviation", "0.047"},
{"Alpha", "-0.096"},
{"Beta", "0.122"},
{"Annual Standard Deviation", "0.04"},
{"Annual Variance", "0.002"},
{"Information Ratio", "-5.094"},
{"Tracking Error", "0.118"},
{"Treynor Ratio", "-0.547"},
{"Information Ratio", "-4.126"},
{"Tracking Error", "0.102"},
{"Treynor Ratio", "-0.417"},
{"Total Fees", "$62.25"},
{"Estimated Strategy Capacity", "$52000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -90,18 +90,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.200%"},
{"Expectancy", "0"},
{"Net Profit", "1.694%"},
{"Sharpe Ratio", "6.988"},
{"Probabilistic Sharpe Ratio", "68.188%"},
{"Sharpe Ratio", "8.671"},
{"Probabilistic Sharpe Ratio", "67.159%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.172"},
{"Beta", "0.14"},
{"Annual Standard Deviation", "0.196"},
{"Annual Variance", "0.038"},
{"Information Ratio", "-0.118"},
{"Tracking Error", "0.256"},
{"Treynor Ratio", "9.783"},
{"Alpha", "-0.053"},
{"Beta", "1.003"},
{"Annual Standard Deviation", "0.223"},
{"Annual Variance", "0.05"},
{"Information Ratio", "-35.82"},
{"Tracking Error", "0.001"},
{"Treynor Ratio", "1.93"},
{"Total Fees", "$3.45"},
{"Estimated Strategy Capacity", "$970000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -189,8 +189,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.564"},
{"Tracking Error", "0.214"},
{"Information Ratio", "-2.094"},
{"Tracking Error", "0.175"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -0,0 +1,202 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using QuantConnect.Data.Market;
using QuantConnect.Interfaces;
using QuantConnect.Indicators;
using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Regression test to check custom indicators warms up properly
/// when one of them define WarmUpPeriod parameter and the other doesn't
/// </summary>
public class CustomWarmUpPeriodIndicatorAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private CustomSMA _customNotWarmUp;
private CSMAWithWarmUp _customWarmUp;
public override void Initialize()
{
SetStartDate(2013, 10, 7);
SetEndDate(2013, 10, 11);
AddEquity("SPY", Resolution.Second);
// Create two custom indicators, where one of them defines WarmUpPeriod parameter
_customNotWarmUp = new CustomSMA("_customNotWarmUp", 60);
_customWarmUp = new CSMAWithWarmUp("_customWarmUp", 60);
// Register the daily data of "SPY" to automatically update both indicators
RegisterIndicator("SPY", _customWarmUp, Resolution.Minute);
RegisterIndicator("SPY", _customNotWarmUp, Resolution.Minute);
// Warm up _customWarmUp indicator
WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute);
// Check _customWarmUp indicator has already been warmed up with the requested data
if (!_customWarmUp.IsReady)
{
throw new Exception("_customWarmUp indicator was expected to be ready");
}
if (_customWarmUp.Samples != 60)
{
throw new Exception("_customWarmUp indicator was expected to have processed 60 datapoints already");
}
// Try to warm up _customNotWarmUp indicator. It's expected from LEAN to skip the warm up process
// because this indicator doesn't implement IIndicatorWarmUpPeriodProvider
WarmUpIndicator("SPY", _customNotWarmUp, Resolution.Minute);
// Check _customNotWarmUp indicator is not ready, because the warm up process was skipped
if (_customNotWarmUp.IsReady)
{
throw new Exception("_customNotWarmUp indicator wasn't expected to be warmed up");
}
}
public void OnData(TradeBars data)
{
if (!Portfolio.Invested)
{
SetHoldings("SPY", 1);
}
if (Time.Second == 0)
{
// Compute the difference between the indicators values
var diff = Math.Abs(_customNotWarmUp.Current.Value - _customWarmUp.Current.Value);
// Check _customNotWarmUp indicator is ready when the number of samples is bigger than its period
if (_customNotWarmUp.IsReady != (_customNotWarmUp.Samples >= 60))
{
throw new Exception("_customNotWarmUp indicator was expected to be ready when the number of samples were bigger that its WarmUpPeriod parameter");
}
// Check their values are the same when both are ready
if (diff > 1e-10m && _customNotWarmUp.IsReady && _customWarmUp.IsReady)
{
throw new Exception($"The values of the indicators are not the same. The difference is {diff}");
}
}
}
/// <summary>
/// Custom implementation of SimpleMovingAverage.
/// Represents the traditional simple moving average indicator (SMA) without WarmUpPeriod parameter defined
/// </summary>
private class CustomSMA : IndicatorBase<IBaseData>
{
private Queue<IBaseData> _queue;
private int _period;
public CustomSMA(string name, int period)
: base(name)
{
_queue = new Queue<IBaseData>();
_period = period;
}
public override bool IsReady => _queue.Count == _period;
protected override decimal ComputeNextValue(IBaseData input)
{
_queue.Enqueue(input);
if (_queue.Count > _period)
{
_queue.Dequeue();
}
var items = (_queue.ToArray());
var sum = 0m;
Array.ForEach(items, i => sum += i.Value);
return sum / _queue.Count;
}
}
/// <summary>
/// Custom implementation of SimpleMovingAverage.
/// Represents the traditional simple moving average indicator (SMA) with WarmUpPeriod defined
/// </summary>
private class CSMAWithWarmUp : CustomSMA, IIndicatorWarmUpPeriodProvider
{
public CSMAWithWarmUp(string name, int period)
: base(name, period)
{
WarmUpPeriod = period;
}
public int WarmUpPeriod { get; private set; }
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp, Language.Python };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "272.157%"},
{"Drawdown", "2.200%"},
{"Expectancy", "0"},
{"Net Profit", "1.694%"},
{"Sharpe Ratio", "8.897"},
{"Probabilistic Sharpe Ratio", "67.609%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.003"},
{"Beta", "0.998"},
{"Annual Standard Deviation", "0.222"},
{"Annual Variance", "0.049"},
{"Information Ratio", "-14.534"},
{"Tracking Error", "0.001"},
{"Treynor Ratio", "1.98"},
{"Total Fees", "$3.45"},
{"Estimated Strategy Capacity", "$310000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},
{"Fitness Score", "0.246"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "9.761"},
{"Return Over Maximum Drawdown", "107.509"},
{"Portfolio Turnover", "0.249"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "e10039d74166b161f3ea2851a5e85843"}
};
}
}

View File

@@ -114,8 +114,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.098"},
{"Tracking Error", "0.179"},
{"Information Ratio", "-0.101"},
{"Tracking Error", "0.185"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -114,8 +114,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.111"},
{"Tracking Error", "0.207"},
{"Information Ratio", "-0.104"},
{"Tracking Error", "0.192"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -94,32 +94,32 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "1.63%"},
{"Average Win", "1.64%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "7.292%"},
{"Drawdown", "1.300%"},
{"Compounding Annual Return", "7.329%"},
{"Drawdown", "1.500%"},
{"Expectancy", "0"},
{"Net Profit", "1.634%"},
{"Sharpe Ratio", "2.495"},
{"Probabilistic Sharpe Ratio", "92.298%"},
{"Net Profit", "1.642%"},
{"Sharpe Ratio", "2.36"},
{"Probabilistic Sharpe Ratio", "94.555%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.006"},
{"Beta", "0.157"},
{"Annual Standard Deviation", "0.033"},
{"Beta", "0.158"},
{"Annual Standard Deviation", "0.03"},
{"Annual Variance", "0.001"},
{"Information Ratio", "-4.901"},
{"Tracking Error", "0.081"},
{"Treynor Ratio", "0.519"},
{"Total Fees", "$3.70"},
{"Information Ratio", "-4.44"},
{"Tracking Error", "0.075"},
{"Treynor Ratio", "0.441"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$170000000.00"},
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
{"Fitness Score", "0.019"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "1.362"},
{"Return Over Maximum Drawdown", "9.699"},
{"Sortino Ratio", "1.369"},
{"Return Over Maximum Drawdown", "9.749"},
{"Portfolio Turnover", "0.023"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -134,7 +134,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "00d6dc8775da38f7f79defad06de240a"}
{"OrderListHash", "4c5e32aedcd5bb67642d1629628fe615"}
};
}
}

View File

@@ -132,18 +132,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "45.600%"},
{"Expectancy", "-1"},
{"Net Profit", "-26.400%"},
{"Sharpe Ratio", "-0.557"},
{"Probabilistic Sharpe Ratio", "20.162%"},
{"Sharpe Ratio", "-0.602"},
{"Probabilistic Sharpe Ratio", "19.127%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.564"},
{"Beta", "-0.663"},
{"Annual Standard Deviation", "1.752"},
{"Annual Variance", "3.069"},
{"Information Ratio", "-0.906"},
{"Tracking Error", "1.763"},
{"Treynor Ratio", "1.472"},
{"Alpha", "-0.559"},
{"Beta", "-0.807"},
{"Annual Standard Deviation", "1.582"},
{"Annual Variance", "2.502"},
{"Information Ratio", "-0.905"},
{"Tracking Error", "1.593"},
{"Treynor Ratio", "1.181"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$1000000.00"},
{"Lowest Capacity Asset", "SPX 31KC0UJFONTBI|SPX 31"},
@@ -166,7 +166,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "4ae4c1d8e4054c41908fd36e893699a6"}
{"OrderListHash", "721fddfd1327f7adcc2883d1412708c9"}
};
}
}

View File

@@ -140,34 +140,34 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-3.23%"},
{"Compounding Annual Return", "-79.990%"},
{"Drawdown", "4.300%"},
{"Average Loss", "-5.58%"},
{"Compounding Annual Return", "-87.694%"},
{"Drawdown", "5.600%"},
{"Expectancy", "-1"},
{"Net Profit", "-4.312%"},
{"Sharpe Ratio", "-5.958"},
{"Probabilistic Sharpe Ratio", "0.000%"},
{"Net Profit", "-5.578%"},
{"Sharpe Ratio", "-4.683"},
{"Probabilistic Sharpe Ratio", "0.008%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.685"},
{"Beta", "-0.445"},
{"Annual Standard Deviation", "0.119"},
{"Annual Variance", "0.014"},
{"Information Ratio", "-4.887"},
{"Tracking Error", "0.155"},
{"Treynor Ratio", "1.589"},
{"Total Fees", "$55.05"},
{"Estimated Strategy Capacity", "$43000.00"},
{"Alpha", "-0.622"},
{"Beta", "-0.877"},
{"Annual Standard Deviation", "0.142"},
{"Annual Variance", "0.02"},
{"Information Ratio", "-3.844"},
{"Tracking Error", "0.186"},
{"Treynor Ratio", "0.759"},
{"Total Fees", "$36.70"},
{"Estimated Strategy Capacity", "$65000.00"},
{"Lowest Capacity Asset", "AAA SEVKGI6HF885"},
{"Fitness Score", "0.002"},
{"Fitness Score", "0.003"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-15.687"},
{"Return Over Maximum Drawdown", "-18.549"},
{"Portfolio Turnover", "0.334"},
{"Sortino Ratio", "-10.959"},
{"Return Over Maximum Drawdown", "-15.72"},
{"Portfolio Turnover", "0.224"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
@@ -181,7 +181,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "e357cfa77fd5e5b974c68d550fa66490"}
{"OrderListHash", "2d66947eafcca81ba9a2cd3bb351eee2"}
};
}
}

View File

@@ -108,9 +108,9 @@ namespace QuantConnect.Algorithm.CSharp
{"Average Loss", "-0.02%"},
{"Compounding Annual Return", "-0.111%"},
{"Drawdown", "0.100%"},
{"Expectancy", "-0.679"},
{"Net Profit", "-0.112%"},
{"Sharpe Ratio", "-1.052"},
{"Expectancy", "-0.678"},
{"Net Profit", "-0.111%"},
{"Sharpe Ratio", "-0.967"},
{"Probabilistic Sharpe Ratio", "0.000%"},
{"Loss Rate", "80%"},
{"Win Rate", "20%"},
@@ -119,10 +119,10 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "-0.001"},
{"Annual Standard Deviation", "0.001"},
{"Annual Variance", "0"},
{"Information Ratio", "-1.182"},
{"Tracking Error", "0.117"},
{"Treynor Ratio", "1.617"},
{"Total Fees", "$37.00"},
{"Information Ratio", "-1.075"},
{"Tracking Error", "0.107"},
{"Treynor Ratio", "1.353"},
{"Total Fees", "$14.80"},
{"Estimated Strategy Capacity", "$860000000.00"},
{"Lowest Capacity Asset", "DC V5E8P9SH0U0X"},
{"Fitness Score", "0"},
@@ -144,7 +144,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "de309ab56d2fcd80ff03df2802d9feda"}
{"OrderListHash", "d10e8665214344369e3e8f1c49dbdd67"}
};
}
}

View File

@@ -173,18 +173,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "12.400%"},
{"Expectancy", "0"},
{"Net Profit", "153.224%"},
{"Sharpe Ratio", "1.233"},
{"Probabilistic Sharpe Ratio", "65.906%"},
{"Sharpe Ratio", "1.116"},
{"Probabilistic Sharpe Ratio", "56.426%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.146"},
{"Beta", "-0.016"},
{"Annual Standard Deviation", "0.117"},
{"Annual Variance", "0.014"},
{"Information Ratio", "-0.052"},
{"Tracking Error", "0.204"},
{"Treynor Ratio", "-8.847"},
{"Alpha", "0.054"},
{"Beta", "0.507"},
{"Annual Standard Deviation", "0.107"},
{"Annual Variance", "0.011"},
{"Information Ratio", "-0.082"},
{"Tracking Error", "0.105"},
{"Treynor Ratio", "0.235"},
{"Total Fees", "$49.43"},
{"Estimated Strategy Capacity", "$740000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -195,18 +195,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "10.400%"},
{"Expectancy", "0.068"},
{"Net Profit", "14.802%"},
{"Sharpe Ratio", "1.077"},
{"Probabilistic Sharpe Ratio", "50.578%"},
{"Sharpe Ratio", "0.978"},
{"Probabilistic Sharpe Ratio", "46.740%"},
{"Loss Rate", "46%"},
{"Win Rate", "54%"},
{"Profit-Loss Ratio", "0.97"},
{"Alpha", "0.137"},
{"Beta", "-0.069"},
{"Annual Standard Deviation", "0.119"},
{"Annual Variance", "0.014"},
{"Information Ratio", "0.046"},
{"Tracking Error", "0.169"},
{"Treynor Ratio", "-1.869"},
{"Alpha", "0.008"},
{"Beta", "0.98"},
{"Annual Standard Deviation", "0.109"},
{"Annual Variance", "0.012"},
{"Information Ratio", "0.158"},
{"Tracking Error", "0.041"},
{"Treynor Ratio", "0.109"},
{"Total Fees", "$7495.19"},
{"Estimated Strategy Capacity", "$320000.00"},
{"Lowest Capacity Asset", "BNO UN3IMQ2JU1YD"},

View File

@@ -168,18 +168,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "10.300%"},
{"Expectancy", "0.081"},
{"Net Profit", "16.153%"},
{"Sharpe Ratio", "1.17"},
{"Probabilistic Sharpe Ratio", "54.048%"},
{"Sharpe Ratio", "1.062"},
{"Probabilistic Sharpe Ratio", "50.224%"},
{"Loss Rate", "45%"},
{"Win Rate", "55%"},
{"Profit-Loss Ratio", "0.97"},
{"Alpha", "0.147"},
{"Beta", "-0.068"},
{"Annual Standard Deviation", "0.119"},
{"Annual Variance", "0.014"},
{"Information Ratio", "0.11"},
{"Tracking Error", "0.169"},
{"Treynor Ratio", "-2.057"},
{"Alpha", "0.018"},
{"Beta", "0.979"},
{"Annual Standard Deviation", "0.109"},
{"Annual Variance", "0.012"},
{"Information Ratio", "0.38"},
{"Tracking Error", "0.041"},
{"Treynor Ratio", "0.118"},
{"Total Fees", "$5869.25"},
{"Estimated Strategy Capacity", "$320000.00"},
{"Lowest Capacity Asset", "BNO UN3IMQ2JU1YD"},

View File

@@ -106,8 +106,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-7.163"},
{"Tracking Error", "0.195"},
{"Information Ratio", "-8.91"},
{"Tracking Error", "0.223"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -107,18 +107,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.100%"},
{"Expectancy", "0"},
{"Net Profit", "0.618%"},
{"Sharpe Ratio", "9.975"},
{"Probabilistic Sharpe Ratio", "99.752%"},
{"Sharpe Ratio", "8.815"},
{"Probabilistic Sharpe Ratio", "99.065%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.23"},
{"Beta", "-0.031"},
{"Alpha", "0.12"},
{"Beta", "0.143"},
{"Annual Standard Deviation", "0.022"},
{"Annual Variance", "0"},
{"Information Ratio", "-2.899"},
{"Tracking Error", "0.101"},
{"Treynor Ratio", "-6.961"},
{"Information Ratio", "-3.746"},
{"Tracking Error", "0.084"},
{"Treynor Ratio", "1.349"},
{"Total Fees", "$1.00"},
{"Estimated Strategy Capacity", "$1000000000.00"},
{"Lowest Capacity Asset", "GOOG T1AZ164W5VTX"},

View File

@@ -122,18 +122,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "2.900%"},
{"Expectancy", "-1"},
{"Net Profit", "-1.740%"},
{"Sharpe Ratio", "-2.982"},
{"Probabilistic Sharpe Ratio", "22.315%"},
{"Sharpe Ratio", "-2.985"},
{"Probabilistic Sharpe Ratio", "24.619%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.387"},
{"Beta", "-0.138"},
{"Annual Standard Deviation", "0.195"},
{"Annual Variance", "0.038"},
{"Information Ratio", "-6.727"},
{"Tracking Error", "0.294"},
{"Treynor Ratio", "4.201"},
{"Alpha", "1.316"},
{"Beta", "-0.998"},
{"Annual Standard Deviation", "0.222"},
{"Annual Variance", "0.049"},
{"Information Ratio", "-5.951"},
{"Tracking Error", "0.445"},
{"Treynor Ratio", "0.664"},
{"Total Fees", "$20.23"},
{"Estimated Strategy Capacity", "$520000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -114,18 +114,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.200%"},
{"Expectancy", "-0.021"},
{"Net Profit", "-0.873%"},
{"Sharpe Ratio", "-2.308"},
{"Probabilistic Sharpe Ratio", "31.792%"},
{"Sharpe Ratio", "-2.39"},
{"Probabilistic Sharpe Ratio", "33.387%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.96"},
{"Alpha", "-0.675"},
{"Beta", "0.232"},
{"Annual Standard Deviation", "0.152"},
{"Annual Variance", "0.023"},
{"Information Ratio", "-8.38"},
{"Tracking Error", "0.209"},
{"Treynor Ratio", "-1.514"},
{"Alpha", "-1.646"},
{"Beta", "0.62"},
{"Annual Standard Deviation", "0.175"},
{"Annual Variance", "0.031"},
{"Information Ratio", "-17.555"},
{"Tracking Error", "0.137"},
{"Treynor Ratio", "-0.674"},
{"Total Fees", "$17.19"},
{"Estimated Strategy Capacity", "$640000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -139,18 +139,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "29.500%"},
{"Expectancy", "-1"},
{"Net Profit", "-7.888%"},
{"Sharpe Ratio", "-0.612"},
{"Probabilistic Sharpe Ratio", "34.280%"},
{"Sharpe Ratio", "-0.593"},
{"Probabilistic Sharpe Ratio", "34.346%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-13.93"},
{"Beta", "6.525"},
{"Annual Standard Deviation", "1.619"},
{"Annual Variance", "2.62"},
{"Information Ratio", "-2.091"},
{"Tracking Error", "1.422"},
{"Treynor Ratio", "-0.152"},
{"Alpha", "-15.391"},
{"Beta", "7.259"},
{"Annual Standard Deviation", "1.679"},
{"Annual Variance", "2.818"},
{"Information Ratio", "-2.032"},
{"Tracking Error", "1.466"},
{"Treynor Ratio", "-0.137"},
{"Total Fees", "$40.70"},
{"Estimated Strategy Capacity", "$4000000.00"},
{"Lowest Capacity Asset", "GC VL5E74HP3EE5"},

View File

@@ -171,18 +171,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "3.300%"},
{"Expectancy", "-0.225"},
{"Net Profit", "-2.705%"},
{"Sharpe Ratio", "-4.958"},
{"Probabilistic Sharpe Ratio", "1.087%"},
{"Sharpe Ratio", "-5.022"},
{"Probabilistic Sharpe Ratio", "1.586%"},
{"Loss Rate", "65%"},
{"Win Rate", "35%"},
{"Profit-Loss Ratio", "1.20"},
{"Alpha", "-1.401"},
{"Beta", "0.525"},
{"Annual Standard Deviation", "0.135"},
{"Annual Variance", "0.018"},
{"Information Ratio", "-16.23"},
{"Tracking Error", "0.127"},
{"Treynor Ratio", "-1.27"},
{"Alpha", "-1.879"},
{"Beta", "0.571"},
{"Annual Standard Deviation", "0.149"},
{"Annual Variance", "0.022"},
{"Information Ratio", "-22.181"},
{"Tracking Error", "0.123"},
{"Treynor Ratio", "-1.31"},
{"Total Fees", "$670.68"},
{"Estimated Strategy Capacity", "$190000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},

View File

@@ -134,18 +134,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "2.500%"},
{"Expectancy", "-1"},
{"Net Profit", "-1.040%"},
{"Sharpe Ratio", "-8.265"},
{"Sharpe Ratio", "-9.302"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.187"},
{"Beta", "0.585"},
{"Annual Standard Deviation", "0.065"},
{"Annual Variance", "0.004"},
{"Information Ratio", "1.345"},
{"Tracking Error", "0.048"},
{"Treynor Ratio", "-0.925"},
{"Alpha", "-0.283"},
{"Beta", "0.55"},
{"Annual Standard Deviation", "0.075"},
{"Annual Variance", "0.006"},
{"Information Ratio", "0.914"},
{"Tracking Error", "0.061"},
{"Treynor Ratio", "-1.267"},
{"Total Fees", "$21.45"},
{"Estimated Strategy Capacity", "$830000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -109,18 +109,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.100%"},
{"Expectancy", "0"},
{"Net Profit", "0.100%"},
{"Sharpe Ratio", "7.449"},
{"Probabilistic Sharpe Ratio", "85.066%"},
{"Sharpe Ratio", "8.342"},
{"Probabilistic Sharpe Ratio", "83.750%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.006"},
{"Alpha", "0"},
{"Beta", "0.033"},
{"Annual Standard Deviation", "0.007"},
{"Annual Standard Deviation", "0.008"},
{"Annual Variance", "0"},
{"Information Ratio", "-7.131"},
{"Tracking Error", "0.189"},
{"Treynor Ratio", "1.576"},
{"Information Ratio", "-8.908"},
{"Tracking Error", "0.215"},
{"Treynor Ratio", "1.992"},
{"Total Fees", "$4.00"},
{"Estimated Strategy Capacity", "$6000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -81,21 +81,21 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "0%"},
{"Drawdown", "0%"},
{"Compounding Annual Return", "16.086%"},
{"Drawdown", "0.100%"},
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Net Profit", "0.148%"},
{"Sharpe Ratio", "9.758"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Standard Deviation", "0.014"},
{"Annual Variance", "0"},
{"Information Ratio", "0"},
{"Tracking Error", "0"},
{"Information Ratio", "9.758"},
{"Tracking Error", "0.014"},
{"Treynor Ratio", "0"},
{"Total Fees", "$5.93"},
{"Estimated Strategy Capacity", "$150000.00"},

View File

@@ -92,18 +92,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.300%"},
{"Expectancy", "0"},
{"Net Profit", "1.947%"},
{"Sharpe Ratio", "14.546"},
{"Probabilistic Sharpe Ratio", "90.065%"},
{"Sharpe Ratio", "21.391"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "2.13"},
{"Beta", "-0.467"},
{"Annual Standard Deviation", "0.165"},
{"Annual Variance", "0.027"},
{"Information Ratio", "7.676"},
{"Tracking Error", "0.389"},
{"Treynor Ratio", "-5.146"},
{"Alpha", "4.505"},
{"Beta", "0.567"},
{"Annual Standard Deviation", "0.192"},
{"Annual Variance", "0.037"},
{"Information Ratio", "30.843"},
{"Tracking Error", "0.156"},
{"Treynor Ratio", "7.25"},
{"Total Fees", "$22.30"},
{"Estimated Strategy Capacity", "$250000000.00"},
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},

View File

@@ -149,8 +149,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "5.865"},
{"Tracking Error", "0.106"},
{"Information Ratio", "5.91"},
{"Tracking Error", "0.13"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -153,8 +153,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "5.865"},
{"Tracking Error", "0.106"},
{"Information Ratio", "5.91"},
{"Tracking Error", "0.13"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -101,21 +101,21 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "6"},
{"Average Win", "6.02%"},
{"Average Loss", "-2.40%"},
{"Compounding Annual Return", "915.480%"},
{"Compounding Annual Return", "1497.266%"},
{"Drawdown", "5.500%"},
{"Expectancy", "1.338"},
{"Net Profit", "11.400%"},
{"Sharpe Ratio", "9.507"},
{"Probabilistic Sharpe Ratio", "76.768%"},
{"Net Profit", "13.775%"},
{"Sharpe Ratio", "3.309"},
{"Probabilistic Sharpe Ratio", "61.758%"},
{"Loss Rate", "33%"},
{"Win Rate", "67%"},
{"Profit-Loss Ratio", "2.51"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0.507"},
{"Annual Variance", "0.257"},
{"Information Ratio", "9.507"},
{"Tracking Error", "0.507"},
{"Annual Standard Deviation", "0.379"},
{"Annual Variance", "0.144"},
{"Information Ratio", "3.309"},
{"Tracking Error", "0.379"},
{"Treynor Ratio", "0"},
{"Total Fees", "$2651.01"},
{"Estimated Strategy Capacity", "$30000.00"},
@@ -139,7 +139,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "2b3ac55337ce5619fc0388ccdac72c54"}
{"OrderListHash", "604291218c630343a896bfa2f3104932"}
};
}
}

View File

@@ -86,18 +86,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "55.000%"},
{"Expectancy", "-1"},
{"Net Profit", "125.420%"},
{"Sharpe Ratio", "0.469"},
{"Probabilistic Sharpe Ratio", "2.603%"},
{"Sharpe Ratio", "0.427"},
{"Probabilistic Sharpe Ratio", "1.166%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.092"},
{"Beta", "-0.091"},
{"Annual Standard Deviation", "0.179"},
{"Annual Variance", "0.032"},
{"Information Ratio", "-0.001"},
{"Tracking Error", "0.265"},
{"Treynor Ratio", "-0.927"},
{"Alpha", "-0"},
{"Beta", "0.997"},
{"Annual Standard Deviation", "0.164"},
{"Annual Variance", "0.027"},
{"Information Ratio", "-0.213"},
{"Tracking Error", "0.001"},
{"Treynor Ratio", "0.07"},
{"Total Fees", "$43.46"},
{"Estimated Strategy Capacity", "$430000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -119,32 +119,32 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "6"},
{"Average Win", "2.93%"},
{"Average Win", "2.94%"},
{"Average Loss", "-4.15%"},
{"Compounding Annual Return", "-5.673%"},
{"Drawdown", "5.700%"},
{"Expectancy", "-0.148"},
{"Net Profit", "-2.802%"},
{"Sharpe Ratio", "-0.49"},
{"Probabilistic Sharpe Ratio", "10.317%"},
{"Compounding Annual Return", "-5.589%"},
{"Drawdown", "5.600%"},
{"Expectancy", "-0.145"},
{"Net Profit", "-2.760%"},
{"Sharpe Ratio", "-0.45"},
{"Probabilistic Sharpe Ratio", "9.306%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.70"},
{"Alpha", "-0.042"},
{"Profit-Loss Ratio", "0.71"},
{"Alpha", "-0.036"},
{"Beta", "-0.012"},
{"Annual Standard Deviation", "0.087"},
{"Annual Variance", "0.007"},
{"Information Ratio", "-0.162"},
{"Tracking Error", "0.418"},
{"Treynor Ratio", "3.493"},
{"Total Fees", "$14.80"},
{"Estimated Strategy Capacity", "$180000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Annual Standard Deviation", "0.08"},
{"Annual Variance", "0.006"},
{"Information Ratio", "-0.149"},
{"Tracking Error", "0.387"},
{"Treynor Ratio", "2.943"},
{"Total Fees", "$3.70"},
{"Estimated Strategy Capacity", "$280000000.00"},
{"Lowest Capacity Asset", "ES XFH59UPBIJ7O|ES XFH59UK0MYO1"},
{"Fitness Score", "0.017"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-0.097"},
{"Return Over Maximum Drawdown", "-1.002"},
{"Sortino Ratio", "-0.096"},
{"Return Over Maximum Drawdown", "-0.993"},
{"Portfolio Turnover", "0.043"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -159,7 +159,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "fc9eb9b0a644e4890d5ec3d40367d0e1"}
{"OrderListHash", "18f8a17034aa12be40581baecca96788"}
};
}
}

View File

@@ -126,7 +126,7 @@ namespace QuantConnect.Algorithm.CSharp
private void AssertFutureOptionOrderExercise(OrderEvent orderEvent, Security future, Security optionContract)
{
var expectedLiquidationTimeUtc = new DateTime(2020, 6, 19, 20, 0, 0);
var expectedLiquidationTimeUtc = new DateTime(2020, 6, 20, 4, 0, 0);
if (orderEvent.Direction == OrderDirection.Sell && future.Holdings.Quantity != 0)
{
@@ -203,27 +203,27 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "1.22%"},
{"Average Loss", "-7.42%"},
{"Compounding Annual Return", "-12.482%"},
{"Average Win", "1.26%"},
{"Average Loss", "-7.41%"},
{"Compounding Annual Return", "-12.424%"},
{"Drawdown", "6.300%"},
{"Expectancy", "-0.417"},
{"Net Profit", "-6.282%"},
{"Sharpe Ratio", "-1.316"},
{"Probabilistic Sharpe Ratio", "0.004%"},
{"Expectancy", "-0.415"},
{"Net Profit", "-6.252%"},
{"Sharpe Ratio", "-1.226"},
{"Probabilistic Sharpe Ratio", "0.002%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.17"},
{"Alpha", "-0.1"},
{"Alpha", "-0.086"},
{"Beta", "0.004"},
{"Annual Standard Deviation", "0.076"},
{"Annual Variance", "0.006"},
{"Information Ratio", "-0.305"},
{"Tracking Error", "0.411"},
{"Treynor Ratio", "-27.616"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$180000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Annual Standard Deviation", "0.07"},
{"Annual Variance", "0.005"},
{"Information Ratio", "-0.283"},
{"Tracking Error", "0.379"},
{"Treynor Ratio", "-23.811"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$270000000.00"},
{"Lowest Capacity Asset", "ES XFH59UPBIJ7O|ES XFH59UK0MYO1"},
{"Fitness Score", "0.008"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
@@ -243,7 +243,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "c59d790b89d76f1ad3bb7738b28567c9"}
{"OrderListHash", "b738fdaf1dae6849884df9e51eb6482b"}
};
}
}

View File

@@ -168,32 +168,32 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "8.71%"},
{"Average Loss", "-34.89%"},
{"Compounding Annual Return", "-50.850%"},
{"Drawdown", "29.200%"},
{"Expectancy", "-0.375"},
{"Net Profit", "-29.224%"},
{"Sharpe Ratio", "-1.025"},
{"Probabilistic Sharpe Ratio", "0.019%"},
{"Average Win", "8.93%"},
{"Average Loss", "-34.88%"},
{"Compounding Annual Return", "-50.632%"},
{"Drawdown", "29.100%"},
{"Expectancy", "-0.372"},
{"Net Profit", "-29.072%"},
{"Sharpe Ratio", "-0.978"},
{"Probabilistic Sharpe Ratio", "0.012%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.25"},
{"Alpha", "-0.387"},
{"Profit-Loss Ratio", "0.26"},
{"Alpha", "-0.339"},
{"Beta", "0.017"},
{"Annual Standard Deviation", "0.377"},
{"Annual Variance", "0.142"},
{"Information Ratio", "-0.751"},
{"Tracking Error", "0.548"},
{"Treynor Ratio", "-22.299"},
{"Total Fees", "$37.00"},
{"Estimated Strategy Capacity", "$33000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Fitness Score", "0.056"},
{"Annual Standard Deviation", "0.347"},
{"Annual Variance", "0.12"},
{"Information Ratio", "-0.714"},
{"Tracking Error", "0.505"},
{"Treynor Ratio", "-19.672"},
{"Total Fees", "$9.25"},
{"Estimated Strategy Capacity", "$50000000.00"},
{"Lowest Capacity Asset", "ES XFH59UPBIJ7O|ES XFH59UK0MYO1"},
{"Fitness Score", "0.055"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-0.155"},
{"Return Over Maximum Drawdown", "-1.741"},
{"Return Over Maximum Drawdown", "-1.743"},
{"Portfolio Turnover", "0.152"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -208,7 +208,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "ca0898608da51d972723b1065a3f0d47"}
{"OrderListHash", "ed0cbd8487dd45519e5d0225e51ba29c"}
};
}
}

View File

@@ -179,24 +179,24 @@ namespace QuantConnect.Algorithm.CSharp
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-4.03%"},
{"Compounding Annual Return", "-8.103%"},
{"Average Loss", "-4.02%"},
{"Compounding Annual Return", "-8.099%"},
{"Drawdown", "4.000%"},
{"Expectancy", "-1"},
{"Net Profit", "-4.029%"},
{"Sharpe Ratio", "-1.266"},
{"Probabilistic Sharpe Ratio", "0.015%"},
{"Net Profit", "-4.027%"},
{"Sharpe Ratio", "-1.175"},
{"Probabilistic Sharpe Ratio", "0.009%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.065"},
{"Alpha", "-0.056"},
{"Beta", "0.002"},
{"Annual Standard Deviation", "0.051"},
{"Annual Variance", "0.003"},
{"Information Ratio", "-0.222"},
{"Tracking Error", "0.408"},
{"Treynor Ratio", "-27.32"},
{"Total Fees", "$3.70"},
{"Annual Standard Deviation", "0.047"},
{"Annual Variance", "0.002"},
{"Information Ratio", "-0.206"},
{"Tracking Error", "0.376"},
{"Treynor Ratio", "-23.481"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$200000000.00"},
{"Lowest Capacity Asset", "ES XFH59UPHGV9G|ES XFH59UK0MYO1"},
{"Fitness Score", "0"},
@@ -218,7 +218,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "5dc2591837f882d173d2d4852b3b0626"}
{"OrderListHash", "cf1c12b839e49456dc2793f0e63c7803"}
};
}
}

View File

@@ -37,7 +37,7 @@ namespace QuantConnect.Algorithm.CSharp
public override void Initialize()
{
SetStartDate(2020, 1, 5);
SetStartDate(2020, 1, 4);
SetEndDate(2020, 1, 6);
var goldFutures = AddFuture("GC", Resolution.Minute, Market.COMEX);
@@ -105,31 +105,31 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "4"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-8.289%"},
{"Compounding Annual Return", "-5.605%"},
{"Drawdown", "3.500%"},
{"Expectancy", "0"},
{"Net Profit", "-0.047%"},
{"Sharpe Ratio", "0"},
{"Sharpe Ratio", "-10.898"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Alpha", "-0.135"},
{"Beta", "0.124"},
{"Annual Standard Deviation", "0.005"},
{"Annual Variance", "0"},
{"Information Ratio", "-14.395"},
{"Tracking Error", "0.043"},
{"Treynor Ratio", "0"},
{"Information Ratio", "-17.984"},
{"Tracking Error", "0.038"},
{"Treynor Ratio", "-0.467"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$31000000.00"},
{"Estimated Strategy Capacity", "$25000000.00"},
{"Lowest Capacity Asset", "OG 31BFX0QKBVPGG|GC XE1Y0ZJ8NQ8T"},
{"Fitness Score", "0.019"},
{"Fitness Score", "0.012"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-194.237"},
{"Portfolio Turnover", "0.038"},
{"Return Over Maximum Drawdown", "-126.806"},
{"Portfolio Turnover", "0.025"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},

View File

@@ -127,7 +127,7 @@ namespace QuantConnect.Algorithm.CSharp
private void AssertFutureOptionOrderExercise(OrderEvent orderEvent, Security future, Security optionContract)
{
var expectedLiquidationTimeUtc = new DateTime(2020, 6, 19, 20, 0, 0);
var expectedLiquidationTimeUtc = new DateTime(2020, 6, 20, 4, 0, 0);
if (orderEvent.Direction == OrderDirection.Buy && future.Holdings.Quantity != 0)
{
@@ -204,31 +204,31 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "4.15%"},
{"Average Loss", "-8.27%"},
{"Compounding Annual Return", "-8.944%"},
{"Drawdown", "4.500%"},
{"Expectancy", "-0.249"},
{"Net Profit", "-4.457%"},
{"Sharpe Ratio", "-1.381"},
{"Probabilistic Sharpe Ratio", "0.002%"},
{"Average Win", "4.18%"},
{"Average Loss", "-8.26%"},
{"Compounding Annual Return", "-8.884%"},
{"Drawdown", "4.400%"},
{"Expectancy", "-0.247"},
{"Net Profit", "-4.427%"},
{"Sharpe Ratio", "-1.283"},
{"Probabilistic Sharpe Ratio", "0.001%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.50"},
{"Alpha", "-0.072"},
{"Beta", "0.003"},
{"Annual Standard Deviation", "0.052"},
{"Annual Variance", "0.003"},
{"Information Ratio", "-0.239"},
{"Tracking Error", "0.408"},
{"Treynor Ratio", "-28.523"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$220000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Profit-Loss Ratio", "0.51"},
{"Alpha", "-0.061"},
{"Beta", "0.002"},
{"Annual Standard Deviation", "0.048"},
{"Annual Variance", "0.002"},
{"Information Ratio", "-0.221"},
{"Tracking Error", "0.376"},
{"Treynor Ratio", "-24.544"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$330000000.00"},
{"Lowest Capacity Asset", "ES 31EL5FAOOQON8|ES XFH59UK0MYO1"},
{"Fitness Score", "0.008"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-0.224"},
{"Sortino Ratio", "-0.225"},
{"Return Over Maximum Drawdown", "-2.009"},
{"Portfolio Turnover", "0.023"},
{"Total Insights Generated", "0"},
@@ -244,7 +244,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "d3fa88c3acadb9345ceac76a2dd3b520"}
{"OrderListHash", "99f96f433bc76c31cb25bcd9117a6bf1"}
};
}
}

View File

@@ -178,24 +178,24 @@ namespace QuantConnect.Algorithm.CSharp
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-5.12%"},
{"Compounding Annual Return", "-10.230%"},
{"Average Loss", "-5.11%"},
{"Compounding Annual Return", "-10.226%"},
{"Drawdown", "5.100%"},
{"Expectancy", "-1"},
{"Net Profit", "-5.116%"},
{"Sharpe Ratio", "-1.253"},
{"Probabilistic Sharpe Ratio", "0.015%"},
{"Net Profit", "-5.114%"},
{"Sharpe Ratio", "-1.164"},
{"Probabilistic Sharpe Ratio", "0.009%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.082"},
{"Alpha", "-0.07"},
{"Beta", "0.003"},
{"Annual Standard Deviation", "0.065"},
{"Annual Standard Deviation", "0.06"},
{"Annual Variance", "0.004"},
{"Information Ratio", "-0.262"},
{"Tracking Error", "0.409"},
{"Treynor Ratio", "-27.056"},
{"Total Fees", "$3.70"},
{"Information Ratio", "-0.243"},
{"Tracking Error", "0.378"},
{"Treynor Ratio", "-23.284"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$360000000.00"},
{"Lowest Capacity Asset", "ES 31EL5FBZBMXES|ES XFH59UK0MYO1"},
{"Fitness Score", "0"},
@@ -217,7 +217,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "a35054d03fd2caa0a96cbe12e427e928"}
{"OrderListHash", "ec799886c15ac6c4b8fb3d873d7e6b14"}
};
}
}

View File

@@ -189,31 +189,31 @@ namespace QuantConnect.Algorithm.CSharp
{
{"Total Trades", "3"},
{"Average Win", "10.05%"},
{"Average Loss", "-5.63%"},
{"Compounding Annual Return", "8.083%"},
{"Average Loss", "-5.60%"},
{"Compounding Annual Return", "8.148%"},
{"Drawdown", "0.500%"},
{"Expectancy", "0.393"},
{"Net Profit", "3.855%"},
{"Sharpe Ratio", "1.182"},
{"Probabilistic Sharpe Ratio", "57.797%"},
{"Expectancy", "0.397"},
{"Net Profit", "3.886%"},
{"Sharpe Ratio", "1.088"},
{"Probabilistic Sharpe Ratio", "53.421%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "1.79"},
{"Alpha", "0.067"},
{"Alpha", "0.057"},
{"Beta", "-0.002"},
{"Annual Standard Deviation", "0.057"},
{"Annual Standard Deviation", "0.053"},
{"Annual Variance", "0.003"},
{"Information Ratio", "0.101"},
{"Tracking Error", "0.41"},
{"Treynor Ratio", "-27.331"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$200000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Information Ratio", "0.094"},
{"Tracking Error", "0.379"},
{"Treynor Ratio", "-23.276"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$300000000.00"},
{"Lowest Capacity Asset", "ES XFH59UP5K75W|ES XFH59UK0MYO1"},
{"Fitness Score", "0.02"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "17.201"},
{"Return Over Maximum Drawdown", "17.34"},
{"Portfolio Turnover", "0.02"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -228,7 +228,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "8e380e4d5c5e3e145ba388f7853829bb"}
{"OrderListHash", "8a33f32b29bcc66d4dd779b36df9a010"}
};
}
}

View File

@@ -173,30 +173,30 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "2"},
{"Average Win", "1.81%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "3.752%"},
{"Compounding Annual Return", "3.756%"},
{"Drawdown", "0.000%"},
{"Expectancy", "0"},
{"Net Profit", "1.809%"},
{"Sharpe Ratio", "1.283"},
{"Probabilistic Sharpe Ratio", "65.521%"},
{"Net Profit", "1.811%"},
{"Sharpe Ratio", "1.183"},
{"Probabilistic Sharpe Ratio", "60.811%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.031"},
{"Alpha", "0.026"},
{"Beta", "-0.001"},
{"Annual Standard Deviation", "0.024"},
{"Annual Variance", "0.001"},
{"Information Ratio", "0.013"},
{"Tracking Error", "0.406"},
{"Treynor Ratio", "-28.184"},
{"Total Fees", "$3.70"},
{"Annual Standard Deviation", "0.022"},
{"Annual Variance", "0"},
{"Information Ratio", "0.012"},
{"Tracking Error", "0.375"},
{"Treynor Ratio", "-24.052"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$78000000.00"},
{"Lowest Capacity Asset", "ES XFH59UPNF7B8|ES XFH59UK0MYO1"},
{"Fitness Score", "0"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "95.495"},
{"Return Over Maximum Drawdown", "95.594"},
{"Portfolio Turnover", "0"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -211,7 +211,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "35baadd70ec72c735eadbf55d702fe04"}
{"OrderListHash", "8cb012d36057103bf26a897fe5fa54d6"}
};
}
}

View File

@@ -185,32 +185,32 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "3"},
{"Average Win", "10.18%"},
{"Average Loss", "-8.05%"},
{"Compounding Annual Return", "2.726%"},
{"Average Win", "10.19%"},
{"Average Loss", "-8.02%"},
{"Compounding Annual Return", "2.790%"},
{"Drawdown", "0.500%"},
{"Expectancy", "0.133"},
{"Net Profit", "1.318%"},
{"Sharpe Ratio", "0.927"},
{"Probabilistic Sharpe Ratio", "46.325%"},
{"Expectancy", "0.135"},
{"Net Profit", "1.348%"},
{"Sharpe Ratio", "0.862"},
{"Probabilistic Sharpe Ratio", "42.945%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "1.27"},
{"Alpha", "0.022"},
{"Alpha", "0.02"},
{"Beta", "-0.001"},
{"Annual Standard Deviation", "0.024"},
{"Annual Standard Deviation", "0.023"},
{"Annual Variance", "0.001"},
{"Information Ratio", "-0.008"},
{"Tracking Error", "0.406"},
{"Treynor Ratio", "-24.058"},
{"Total Fees", "$7.40"},
{"Estimated Strategy Capacity", "$130000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Information Ratio", "-0.006"},
{"Tracking Error", "0.375"},
{"Treynor Ratio", "-20.61"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$200000000.00"},
{"Lowest Capacity Asset", "ES 31EL5FAOUP0P0|ES XFH59UK0MYO1"},
{"Fitness Score", "0.021"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "5.725"},
{"Return Over Maximum Drawdown", "5.859"},
{"Portfolio Turnover", "0.022"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -225,7 +225,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "519cc7c39703b6e6913dbe98468da872"}
{"OrderListHash", "eb37251ad1e32dd348af8a69e1888053"}
};
}
}

View File

@@ -170,32 +170,32 @@ namespace QuantConnect.Algorithm.CSharp
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "3.28%"},
{"Average Win", "3.29%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "6.865%"},
{"Compounding Annual Return", "6.869%"},
{"Drawdown", "0.000%"},
{"Expectancy", "0"},
{"Net Profit", "3.284%"},
{"Sharpe Ratio", "1.309"},
{"Probabilistic Sharpe Ratio", "66.205%"},
{"Net Profit", "3.286%"},
{"Sharpe Ratio", "1.205"},
{"Probabilistic Sharpe Ratio", "61.483%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.056"},
{"Alpha", "0.048"},
{"Beta", "-0.002"},
{"Annual Standard Deviation", "0.043"},
{"Annual Standard Deviation", "0.04"},
{"Annual Variance", "0.002"},
{"Information Ratio", "0.076"},
{"Tracking Error", "0.408"},
{"Treynor Ratio", "-28.646"},
{"Total Fees", "$3.70"},
{"Information Ratio", "0.07"},
{"Tracking Error", "0.377"},
{"Treynor Ratio", "-24.401"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$80000000.00"},
{"Lowest Capacity Asset", "ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1"},
{"Fitness Score", "0"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "150.763"},
{"Return Over Maximum Drawdown", "150.849"},
{"Portfolio Turnover", "0"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
@@ -210,7 +210,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "5571280f1efb15dd3899896fb72385ff"}
{"OrderListHash", "76ed4eaa5f6ed50aa6134aecfbbe9e29"}
};
}
}

View File

@@ -89,18 +89,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "5.400%"},
{"Expectancy", "0"},
{"Net Profit", "-3.474%"},
{"Sharpe Ratio", "-4.693"},
{"Sharpe Ratio", "-68.954"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.575"},
{"Beta", "-0.437"},
{"Annual Standard Deviation", "0.194"},
{"Annual Variance", "0.038"},
{"Information Ratio", "-19.629"},
{"Tracking Error", "0.336"},
{"Treynor Ratio", "2.082"},
{"Alpha", "-1.896"},
{"Beta", "0.058"},
{"Annual Standard Deviation", "0.014"},
{"Annual Variance", "0"},
{"Information Ratio", "-75.062"},
{"Tracking Error", "0.229"},
{"Treynor Ratio", "-16.736"},
{"Total Fees", "$1.85"},
{"Estimated Strategy Capacity", "$93000000.00"},
{"Lowest Capacity Asset", "GC VOFJUCDY9XNH"},

View File

@@ -38,7 +38,7 @@ namespace QuantConnect.Algorithm.CSharp
private readonly DateTime _expectedExpiryWarningTime = new DateTime(2020, 6, 19);
private readonly DateTime _expectedExpiryDelistingTime = new DateTime(2020, 6, 20);
private readonly DateTime _expectedLiquidationTime = new DateTime(2020, 6, 19, 16, 0, 0);
private readonly DateTime _expectedLiquidationTime = new DateTime(2020, 6, 20);
public override void Initialize()
{
@@ -183,23 +183,23 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "3"},
{"Average Win", "10.15%"},
{"Average Loss", "-11.34%"},
{"Compounding Annual Return", "-2.578%"},
{"Compounding Annual Return", "-2.573%"},
{"Drawdown", "2.300%"},
{"Expectancy", "-0.053"},
{"Net Profit", "-2.345%"},
{"Sharpe Ratio", "-0.969"},
{"Probabilistic Sharpe Ratio", "0.004%"},
{"Expectancy", "-0.052"},
{"Net Profit", "-2.341%"},
{"Sharpe Ratio", "-0.867"},
{"Probabilistic Sharpe Ratio", "0.001%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.89"},
{"Alpha", "-0.018"},
{"Profit-Loss Ratio", "0.90"},
{"Alpha", "-0.014"},
{"Beta", "0.001"},
{"Annual Standard Deviation", "0.018"},
{"Annual Standard Deviation", "0.016"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.696"},
{"Tracking Error", "0.33"},
{"Treynor Ratio", "-16.321"},
{"Total Fees", "$7.40"},
{"Information Ratio", "-0.603"},
{"Tracking Error", "0.291"},
{"Treynor Ratio", "-13.292"},
{"Total Fees", "$3.70"},
{"Estimated Strategy Capacity", "$45000000.00"},
{"Lowest Capacity Asset", "ES XFH59UK0MYO1"},
{"Fitness Score", "0.005"},
@@ -221,7 +221,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "0128b145984582f5eba7e95881d9b62d"}
{"OrderListHash", "67d8ad460ff796937ee252c3e4340e62"}
};
}
}

View File

@@ -99,8 +99,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-3.432"},
{"Tracking Error", "0.098"},
{"Information Ratio", "-3.102"},
{"Tracking Error", "0.091"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -304,18 +304,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.200%"},
{"Expectancy", "0"},
{"Net Profit", "1.694%"},
{"Sharpe Ratio", "8.671"},
{"Probabilistic Sharpe Ratio", "67.159%"},
{"Sharpe Ratio", "57.51"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "1.614"},
{"Beta", "0.062"},
{"Annual Standard Deviation", "0.223"},
{"Annual Variance", "0.05"},
{"Information Ratio", "-11.911"},
{"Tracking Error", "0.271"},
{"Treynor Ratio", "31.034"},
{"Alpha", "-0.041"},
{"Beta", "0.998"},
{"Annual Standard Deviation", "0.177"},
{"Annual Variance", "0.031"},
{"Information Ratio", "-150.576"},
{"Tracking Error", "0"},
{"Treynor Ratio", "10.228"},
{"Total Fees", "$3.45"},
{"Estimated Strategy Capacity", "$970000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},

View File

@@ -89,8 +89,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-7.163"},
{"Tracking Error", "0.195"},
{"Information Ratio", "-8.91"},
{"Tracking Error", "0.223"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},

View File

@@ -93,18 +93,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "31.700%"},
{"Expectancy", "0"},
{"Net Profit", "-16.363%"},
{"Sharpe Ratio", "-0.506"},
{"Probabilistic Sharpe Ratio", "27.578%"},
{"Sharpe Ratio", "-0.474"},
{"Probabilistic Sharpe Ratio", "25.138%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.45"},
{"Beta", "2.007"},
{"Annual Standard Deviation", "1.118"},
{"Annual Variance", "1.25"},
{"Information Ratio", "-0.069"},
{"Tracking Error", "0.869"},
{"Treynor Ratio", "-0.282"},
{"Alpha", "0.335"},
{"Beta", "2.004"},
{"Annual Standard Deviation", "0.924"},
{"Annual Variance", "0.854"},
{"Information Ratio", "-0.073"},
{"Tracking Error", "0.718"},
{"Treynor Ratio", "-0.218"},
{"Total Fees", "$5.40"},
{"Estimated Strategy Capacity", "$2400000.00"},
{"Lowest Capacity Asset", "SPWR TDQZFPKOZ5UT"},

View File

@@ -111,11 +111,11 @@ namespace QuantConnect.Algorithm.CSharp
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "0%"},
{"Drawdown", "0%"},
{"Compounding Annual Return", "-0.068%"},
{"Drawdown", "0.000%"},
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Net Profit", "-0.001%"},
{"Sharpe Ratio", "-9.163"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
@@ -124,7 +124,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "0"},
{"Information Ratio", "-9.163"},
{"Tracking Error", "0"},
{"Treynor Ratio", "0"},
{"Total Fees", "$1.00"},

View File

@@ -103,18 +103,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "1.200%"},
{"Expectancy", "-0.267"},
{"Net Profit", "2.120%"},
{"Sharpe Ratio", "4.022"},
{"Probabilistic Sharpe Ratio", "77.412%"},
{"Sharpe Ratio", "3.329"},
{"Probabilistic Sharpe Ratio", "76.344%"},
{"Loss Rate", "50%"},
{"Win Rate", "50%"},
{"Profit-Loss Ratio", "0.47"},
{"Alpha", "0.02"},
{"Beta", "0.476"},
{"Annual Standard Deviation", "0.068"},
{"Annual Variance", "0.005"},
{"Information Ratio", "-3.529"},
{"Tracking Error", "0.073"},
{"Treynor Ratio", "0.576"},
{"Alpha", "0.019"},
{"Beta", "0.478"},
{"Annual Standard Deviation", "0.058"},
{"Annual Variance", "0.003"},
{"Information Ratio", "-2.771"},
{"Tracking Error", "0.063"},
{"Treynor Ratio", "0.408"},
{"Total Fees", "$16.73"},
{"Estimated Strategy Capacity", "$7000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},

View File

@@ -127,18 +127,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.100%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.110%"},
{"Sharpe Ratio", "-3.525"},
{"Probabilistic Sharpe Ratio", "0.518%"},
{"Sharpe Ratio", "-3.157"},
{"Probabilistic Sharpe Ratio", "0.427%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.014"},
{"Alpha", "-0.011"},
{"Beta", "-0.004"},
{"Annual Standard Deviation", "0.004"},
{"Annual Standard Deviation", "0.003"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.453"},
{"Tracking Error", "0.156"},
{"Treynor Ratio", "3.397"},
{"Information Ratio", "-0.405"},
{"Tracking Error", "0.138"},
{"Treynor Ratio", "2.704"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX XL80P3HB5O6M|SPX 31"},

View File

@@ -189,18 +189,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "2.300%"},
{"Expectancy", "-1"},
{"Net Profit", "10.274%"},
{"Sharpe Ratio", "6.904"},
{"Probabilistic Sharpe Ratio", "89.741%"},
{"Sharpe Ratio", "5.298"},
{"Probabilistic Sharpe Ratio", "88.621%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "2.674"},
{"Beta", "-0.22"},
{"Annual Standard Deviation", "0.386"},
{"Annual Variance", "0.149"},
{"Information Ratio", "6.086"},
{"Tracking Error", "0.428"},
{"Treynor Ratio", "-12.111"},
{"Alpha", "1.836"},
{"Beta", "-0.228"},
{"Annual Standard Deviation", "0.345"},
{"Annual Variance", "0.119"},
{"Information Ratio", "4.653"},
{"Tracking Error", "0.383"},
{"Treynor Ratio", "-8.001"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX XL80P3GHDZXQ|SPX 31"},
@@ -223,7 +223,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "6dda4f153b0be9fdf55026da439f90f6"}
{"OrderListHash", "25cc4301125ffaa12dd8d8f4387adf06"}
};
}
}

View File

@@ -168,18 +168,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "9.800%"},
{"Expectancy", "-1"},
{"Net Profit", "2.644%"},
{"Sharpe Ratio", "7.691"},
{"Probabilistic Sharpe Ratio", "91.027%"},
{"Sharpe Ratio", "5.789"},
{"Probabilistic Sharpe Ratio", "89.964%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "3.219"},
{"Beta", "-0.229"},
{"Annual Standard Deviation", "0.417"},
{"Annual Variance", "0.174"},
{"Information Ratio", "6.893"},
{"Tracking Error", "0.457"},
{"Treynor Ratio", "-14.008"},
{"Alpha", "2.169"},
{"Beta", "-0.238"},
{"Annual Standard Deviation", "0.373"},
{"Annual Variance", "0.139"},
{"Information Ratio", "5.17"},
{"Tracking Error", "0.409"},
{"Treynor Ratio", "-9.071"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$44000000.00"},
{"Lowest Capacity Asset", "SPX XL80P3GHDZXQ|SPX 31"},
@@ -202,7 +202,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "3cccf8c2409ee8a9020ba79a6c45742a"}
{"OrderListHash", "bd96db56c80107572e8fc13c8794279b"}
};
}
}

View File

@@ -179,8 +179,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.000%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.010%"},
{"Sharpe Ratio", "-5.154"},
{"Probabilistic Sharpe Ratio", "0.016%"},
{"Sharpe Ratio", "-4.584"},
{"Probabilistic Sharpe Ratio", "0.015%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
@@ -188,9 +188,9 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.374"},
{"Tracking Error", "0.155"},
{"Treynor Ratio", "-4.059"},
{"Information Ratio", "-0.334"},
{"Tracking Error", "0.138"},
{"Treynor Ratio", "-9.47"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$22000.00"},
{"Lowest Capacity Asset", "SPX XL80P59H5E6M|SPX 31"},
@@ -213,7 +213,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "177477b78d9264384a09f1607e8c7d11"}
{"OrderListHash", "e971949fb0d1cc8d034ad7cba97d09cc"}
};
}
}

View File

@@ -194,18 +194,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "13.800%"},
{"Expectancy", "-1"},
{"Net Profit", "-11.084%"},
{"Sharpe Ratio", "-1.894"},
{"Probabilistic Sharpe Ratio", "0.621%"},
{"Sharpe Ratio", "-1.893"},
{"Probabilistic Sharpe Ratio", "0.513%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.765"},
{"Beta", "0.207"},
{"Annual Standard Deviation", "0.398"},
{"Annual Variance", "0.158"},
{"Information Ratio", "-1.952"},
{"Tracking Error", "0.415"},
{"Treynor Ratio", "-3.636"},
{"Alpha", "-0.683"},
{"Beta", "0.218"},
{"Annual Standard Deviation", "0.356"},
{"Annual Variance", "0.126"},
{"Information Ratio", "-1.94"},
{"Tracking Error", "0.37"},
{"Treynor Ratio", "-3.083"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX 31KC0UJHC75TA|SPX 31"},
@@ -228,7 +228,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "f2d98f952cc0b54fb620795018682105"}
{"OrderListHash", "6df8b200489a2f217cd514592ee98663"}
};
}
}

View File

@@ -178,18 +178,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.400%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.370%"},
{"Sharpe Ratio", "-3.622"},
{"Probabilistic Sharpe Ratio", "0.270%"},
{"Sharpe Ratio", "-3.253"},
{"Probabilistic Sharpe Ratio", "0.221%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.046"},
{"Alpha", "-0.037"},
{"Beta", "0.007"},
{"Annual Standard Deviation", "0.013"},
{"Annual Standard Deviation", "0.011"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.662"},
{"Tracking Error", "0.154"},
{"Treynor Ratio", "-6.383"},
{"Information Ratio", "-0.595"},
{"Tracking Error", "0.137"},
{"Treynor Ratio", "-5.349"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX 31KC0UJFONTBI|SPX 31"},
@@ -212,7 +212,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "6faffe52c64c2148458af1d2deb68a6f"}
{"OrderListHash", "b0c50080f0229facd065721f1f5d715e"}
};
}
}

View File

@@ -180,18 +180,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "13.400%"},
{"Expectancy", "0"},
{"Net Profit", "-10.734%"},
{"Sharpe Ratio", "-1.928"},
{"Probabilistic Sharpe Ratio", "0.619%"},
{"Sharpe Ratio", "-1.921"},
{"Probabilistic Sharpe Ratio", "0.511%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.753"},
{"Beta", "0.2"},
{"Annual Standard Deviation", "0.385"},
{"Annual Variance", "0.148"},
{"Information Ratio", "-1.981"},
{"Tracking Error", "0.403"},
{"Treynor Ratio", "-3.708"},
{"Alpha", "-0.671"},
{"Beta", "0.211"},
{"Annual Standard Deviation", "0.344"},
{"Annual Variance", "0.118"},
{"Information Ratio", "-1.963"},
{"Tracking Error", "0.36"},
{"Treynor Ratio", "-3.133"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX XL80P3GHDZXQ|SPX 31"},
@@ -214,7 +214,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "439042b39981ea246e50728cc57c31c7"}
{"OrderListHash", "856448f4cbba4fc39af8dba369c054df"}
};
}
}

View File

@@ -172,8 +172,8 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0%"},
{"Expectancy", "0"},
{"Net Profit", "0.010%"},
{"Sharpe Ratio", "5.161"},
{"Probabilistic Sharpe Ratio", "99.241%"},
{"Sharpe Ratio", "4.589"},
{"Probabilistic Sharpe Ratio", "98.983%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
@@ -181,9 +181,9 @@ namespace QuantConnect.Algorithm.CSharp
{"Beta", "-0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.358"},
{"Tracking Error", "0.155"},
{"Treynor Ratio", "-4.064"},
{"Information Ratio", "-0.32"},
{"Tracking Error", "0.138"},
{"Treynor Ratio", "-9.479"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$22000.00"},
{"Lowest Capacity Asset", "SPX XL80P59H5E6M|SPX 31"},
@@ -206,7 +206,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "b55e2b2bd35bc3200e228b4e6e77dd90"}
{"OrderListHash", "76ffdfc100ba7778009e35966bd92cfc"}
};
}
}

View File

@@ -184,18 +184,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "2.400%"},
{"Expectancy", "0"},
{"Net Profit", "10.624%"},
{"Sharpe Ratio", "7.1"},
{"Probabilistic Sharpe Ratio", "89.813%"},
{"Sharpe Ratio", "5.415"},
{"Probabilistic Sharpe Ratio", "88.697%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "2.84"},
{"Beta", "-0.227"},
{"Annual Standard Deviation", "0.398"},
{"Annual Variance", "0.159"},
{"Information Ratio", "6.298"},
{"Tracking Error", "0.44"},
{"Treynor Ratio", "-12.457"},
{"Alpha", "1.938"},
{"Beta", "-0.235"},
{"Annual Standard Deviation", "0.356"},
{"Annual Variance", "0.127"},
{"Information Ratio", "4.787"},
{"Tracking Error", "0.393"},
{"Treynor Ratio", "-8.187"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX 31KC0UJHC75TA|SPX 31"},
@@ -218,7 +218,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "f243341674cb1486d7cf009d74d4e6ff"}
{"OrderListHash", "77d9040316634cb6b9e8cd2e4e192fd5"}
};
}
}

View File

@@ -171,18 +171,18 @@ namespace QuantConnect.Algorithm.CSharp
{"Drawdown", "0.000%"},
{"Expectancy", "0"},
{"Net Profit", "0.350%"},
{"Sharpe Ratio", "3.573"},
{"Probabilistic Sharpe Ratio", "91.608%"},
{"Sharpe Ratio", "3.182"},
{"Probabilistic Sharpe Ratio", "90.575%"},
{"Loss Rate", "0%"},
{"Win Rate", "100%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.046"},
{"Alpha", "0.036"},
{"Beta", "-0.008"},
{"Annual Standard Deviation", "0.013"},
{"Annual Standard Deviation", "0.011"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.074"},
{"Tracking Error", "0.157"},
{"Treynor Ratio", "-5.727"},
{"Information Ratio", "-0.066"},
{"Tracking Error", "0.139"},
{"Treynor Ratio", "-4.733"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$0"},
{"Lowest Capacity Asset", "SPX 31KC0UJFONTBI|SPX 31"},
@@ -205,7 +205,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "636b79bb5bf3db20eeda02ccf1064d07"}
{"OrderListHash", "12861ef440f68994997aeb24c8027748"}
};
}
}

Some files were not shown because too many files have changed in this diff Show More