Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringclasses
1 value
input
stringlengths
81
758
output
stringlengths
420
23.9k
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm illustrating how to manually set market hours and symbol properties database entries to be picked up by the algorithm's securities. This specific case illustrates how to do it for CFDs to match InteractiveBrokers brokerage, which has different market...
```python from AlgorithmImports import * import Newtonsoft.Json as json class ManuallySetMarketHoursAndSymbolPropertiesDatabaseEntriesAlgorithm(QCAlgorithm): ''' Algorithm illustrating how to manually set market hours and symbol properties database entries to be picked up by the algorithm's securities. ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm is a regression test for issue #2018 and PR #2038.
```python from AlgorithmImports import * class OptionDataNullReferenceRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2016, 12, 1) self.set_end_date(2017, 1, 1) self.set_cash(500000) self.add_equity("DUST") option = self.add_option("DUST") ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm demonstrates using the history provider to retrieve data to warm up indicators before data is received.
```python from AlgorithmImports import * class WarmupHistoryAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2014,5,2) #Set Start Da...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : The demonstration algorithm shows some of the most common order methods when working with FutureOption assets.
```python from AlgorithmImports import * class BasicTemplateFutureOptionAlgorithm(QCAlgorithm): def initialize(self): '''initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2022, 1, 1) ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This example demonstrates how to execute a Call Butterfly option equity strategy It adds options for a given underlying equity security, and shows how you can prefilter contracts easily based on strikes and expirations
```python from AlgorithmImports import * class BasicTemplateOptionEquityStrategyAlgorithm(QCAlgorithm): underlying_ticker = "GOOG" def initialize(self) -> None: self.set_start_date(2015, 12, 24) self.set_end_date(2015, 12, 24) equity = self.add_equity(self.underlying_ticker) ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example of custom fill model for security to only fill bars of data obtained after the order was placed. This is to encourage more pessimistic fill models and eliminate the possibility to fill on old market data that may not be relevant.
```python from AlgorithmImports import * class ForwardDataOnlyFillModelAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013,10,1) self.set_end_date(2013,10,31) self.security = self.add_equity("SPY", Resolution.HOUR) self.security.set_fill_model(ForwardDataOnlyFi...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration on how to access order tickets right after placing an order.
```python from datetime import timedelta from AlgorithmImports import * class OrderTicketAssignmentDemoAlgorithm(QCAlgorithm): '''Demonstration on how to access order tickets right after placing an order.''' def initialize(self): self.set_start_date(2013, 10, 7) self.set_end_date(2013, 10, 11...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration of using custom fee, slippage, fill, and buying power models for modeling transactions in backtesting. QuantConnect allows you to model all orders as deeply and accurately as you need. This example illustrates how Lean exports its API to Python c...
```python from AlgorithmImports import * import random class CustomModelsPEP8Algorithm(QCAlgorithm): '''Demonstration of using custom fee, slippage, fill, and buying power models for modeling transactions in backtesting. QuantConnect allows you to model all orders as deeply and accurately as you need.''' ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration of how to define a universe as a combination of use the coarse fundamental data and fine fundamental data
```python from AlgorithmImports import * class CoarseFineFundamentalRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2014,3,24) #Set Start Date self.set_end_date(2014,4,7) #Set End Date self.set_cash(50000) #Set Strategy Cash self.uni...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm tests the functionality of the CompositeIndicator using either a lambda expression or a method reference.
```python from AlgorithmImports import * class CompositeIndicatorWorksAsExpectedRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013, 10, 4) self.set_end_date(2013, 10, 5) self.add_equity("SPY", Resolution.MINUTE) close = self.identity("SPY", Resolutio...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example algorithm giving an introduction into using IDataConsolidators. This is an advanced QC concept and requires a certain level of comfort using C# and its event system. What is an IDataConsolidator? IDataConsolidator is a plugin point that can be used to...
```python from AlgorithmImports import * class DataConsolidationAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013, 10, 7) #Set St...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.OptionChain(Symbol)"/> method to get a future option chain.
```python from AlgorithmImports import * class FutureOptionChainFullDataRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2020, 1, 6) self.set_end_date(2020, 1, 6) future_contract = self.add_future_contract( Symbol.create_future(Futures.Indices.SP_5...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : The regression algorithm showcases the utilization of a custom data source with the Sort flag set to true. This means that the source initially provides data in descending order, which is then organized into ascending order and returned in the 'on_data' functi...
```python from AlgorithmImports import * class DescendingCustomDataObjectStoreRegressionAlgorithm(QCAlgorithm): descending_custom_data = [ "2024-10-03 19:00:00,173.5,176.0,172.0,175.2,120195681,4882.29", "2024-10-02 18:00:00,174.0,177.0,173.0,175.8,116275729,4641.97", "2024-10-01 17:00:0...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Basic Continuous Futures Template Algorithm
```python from AlgorithmImports import * class BasicTemplateContinuousFutureAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorit...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm sends portfolio targets to CrunchDAO API once a week.
```python from AlgorithmImports import * class CrunchDAOSignalExportDemonstrationAlgorithm(QCAlgorithm): crunch_universe = [] def initialize(self) -> None: self.set_start_date(2023, 5, 22) self.set_end_date(2023, 5, 26) self.set_cash(1_000_000) # Disable automatic exports a...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example and regression algorithm asserting the behavior of registering and unregistering an indicator from the engine
```python from AlgorithmImports import * class UnregisterIndicatorRegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013,10, 7)...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm testing GH feature 3790, using SetHoldings with a collection of targets which will be ordered by margin impact before being executed, with the objective of avoiding any margin errors
```python from AlgorithmImports import * class SetHoldingsMultipleTargetsRegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(201...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm demonstrating the portfolio target tags usage
```python from AlgorithmImports import * class PortfolioTargetTagsRegressionAlgorithm(QCAlgorithm): '''Algorithm demonstrating the portfolio target tags usage''' def initialize(self): self.set_start_date(2013,10,7) #Set Start Date self.set_end_date(2013,10,11) #Set End Date self...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration of using the Delisting event in your algorithm. Assets are delisted on their last day of trading, or when their contract expires. This data is not included in the open source project.
```python from AlgorithmImports import * class DelistingEventsAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2007, 5, 15) #Set Star...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration algorithm showing how to easily convert an old algorithm into the framework. 1. When making orders, also create insights for the correct direction (up/down/flat), can also set insight prediction period/magnitude/direction 2. Emit insights befo...
```python from AlgorithmImports import * class ConvertToFrameworkAlgorithm(QCAlgorithm): '''Demonstration algorithm showing how to easily convert an old algorithm into the framework.''' fast_ema_period = 12 slow_ema_period = 26 def initialize(self): '''Initialise the data and resolution req...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm asserting that consolidated bars are of type `QuoteBar` when `QCAlgorithm.consolidate()` is called with `tick_type=TickType.QUOTE`
```python from AlgorithmImports import * class CorrectConsolidatedBarTypeForTickTypesAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013, 10, 7) self.set_end_date(2013, 10, 7) symbol = self.add_equity("SPY", Resolution.TICK).symbol self.consolidate(symbol, tim...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration of the Scheduled Events features available in QuantConnect.
```python from AlgorithmImports import * class ScheduledEventsAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013,10,7) #Set Start...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Show example of how to use the TrailingStopRiskManagementModel
```python from AlgorithmImports import * from BaseFrameworkRegressionAlgorithm import BaseFrameworkRegressionAlgorithm from Risk.TrailingStopRiskManagementModel import TrailingStopRiskManagementModel class TrailingStopRiskFrameworkRegressionAlgorithm(BaseFrameworkRegressionAlgorithm): '''Show example of how to u...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example algorithm showing how to use QCAlgorithm.train method
```python from AlgorithmImports import * from time import sleep class TrainingExampleAlgorithm(QCAlgorithm): '''Example algorithm showing how to use QCAlgorithm.train method''' def initialize(self): self.set_start_date(2013, 10, 7) self.set_end_date(2013, 10, 14) self.add_equity("S...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm asserting that the option chain APIs return consistent values for index options. See QCAlgorithm.OptionChain(Symbol) and QCAlgorithm.OptionChainProvider
```python from datetime import datetime from AlgorithmImports import * from OptionChainApisConsistencyRegressionAlgorithm import OptionChainApisConsistencyRegressionAlgorithm class IndexOptionChainApisConsistencyRegressionAlgorithm(OptionChainApisConsistencyRegressionAlgorithm): def get_test_date(self) -> date...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.OptionChains(IEnumerable{Symbol})"/> method to get multiple option chains, which contains additional data besides the symbols, including prices, implied volatility and greeks. It also sh...
```python from AlgorithmImports import * from datetime import timedelta class OptionChainsMultipleFullDataRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2015, 12, 24) self.set_end_date(2015, 12, 24) self.set_cash(100000) goog = self.add_equity("GOOG"...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : In this algorithm we demonstrate how to use the UniverseSettings to define the data normalization mode (raw)
```python from AlgorithmImports import * class RawPricesUniverseRegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' # what resolution should the da...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm asserting that closed orders can be updated with a new tag
```python from AlgorithmImports import * class CompleteOrderTagUpdateAlgorithm(QCAlgorithm): _tag_after_fill = "This is the tag set after order was filled." _tag_after_canceled = "This is the tag set after order was canceled." def initialize(self) -> None: self.set_start_date(2013,10, 7) ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm for the StandardDeviationExecutionModel. This algorithm shows how the execution model works to split up orders and submit them only when the price is 2 standard deviations from the 60min mean (default model settings).
```python from AlgorithmImports import * from Alphas.RsiAlphaModel import RsiAlphaModel from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel from Execution.StandardDeviationExecutionModel import StandardDeviationExecutionModel class StandardDeviationExecutionModelRe...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example algorithm of the Identity indicator with the filtering enhancement. Filtering is used to check the output of the indicator before returning it.
```python from AlgorithmImports import * class FilteredIdentityAlgorithm(QCAlgorithm): ''' Example algorithm of the Identity indicator with the filtering enhancement ''' def initialize(self): self.set_start_date(2014,5,2) # Set Start Date self.set_end_date(self.start_date)...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm asserts we can consolidate Tick data with different tick types
```python from AlgorithmImports import * class ConsolidateDifferentTickTypesRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013, 10, 6) self.set_end_date(2013, 10, 7) self.set_cash(1000000) equity = self.add_equity("SPY", Resolution.TICK, Market.USA)...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm demonstrating the option universe filter by greeks and other options data feature
```python from AlgorithmImports import * class OptionUniverseFilterGreeksRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2015, 12, 24) self.set_end_date(2015, 12, 24) self.set_cash(100000) underlying_ticker = "GOOG" self.add_equity(underlying_...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This regression algorithm asserts the consolidated US equity daily bars from the hour bars exactly matches the daily bars returned from the database
```python from AlgorithmImports import * class ConsolidateHourBarsIntoDailyBarsRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2020, 5, 1) self.set_end_date(2020, 6, 5) self.spy = self.add_equity("SPY", Resolution.HOUR).symbol # We will use these two ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm testing the SetHolding trading API precision
```python from AlgorithmImports import * class SetHoldingsRegressionAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' asynchronous_orders = False def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-e...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm shows how to grab symbols from an external api each day and load data using the universe selection feature. In this example we define a custom data type for the NYSE top gainers and then short the top 2 gainers each day
```python from AlgorithmImports import * class CustomDataUniverseAlgorithm(QCAlgorithm): def initialize(self): # Data ADDED via universe selection is added with Daily resolution. self.universe_settings.resolution = Resolution.DAILY self.set_start_date(2015,1,5) self.set_end_dat...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm used for regression tests purposes
```python from AlgorithmImports import * class RegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013,10,7) #Set Start Date...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This regression algorithm tests In The Money (ITM) index option expiry for calls. We test to make sure that index options have greeks enabled, same as equity options.
```python from AlgorithmImports import * class IndexOptionCallITMGreeksExpiryRegressionAlgorithm(QCAlgorithm): def initialize(self): self.on_data_calls = 0 self.invested = False self.set_start_date(2021, 1, 4) self.set_end_date(2021, 1, 31) spx = self.add_index("SPX", Re...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression test illustrating how history from custom data sources can be requested. The <see cref="QCAlgorithm.history"/> method used in this example also allows to specify other parameters than just the resolution, such as the data normalization mode, the dat...
```python from AlgorithmImports import * class HistoryWithCustomDataSourceRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2014, 6, 5) self.set_end_date(2014, 6, 6) self.aapl = self.add_data(CustomData, "AAPL", Resolution.MINUTE).symbol self.spy = self....
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm which tests that a two leg currency conversion happens correctly
```python from AlgorithmImports import * class TwoLegCurrencyConversionRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2018, 4, 4) self.set_end_date(2018, 4, 4) self.set_brokerage_model(BrokerageName.GDAX, AccountType.CASH) # GDAX doesn't have LTCETH or...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Test algorithm verifying OnEndOfDay callbacks are called as expected. See GH issue 2865.
```python from AlgorithmImports import * class OnEndOfDayRegressionAlgorithm(QCAlgorithm): '''Test algorithm verifying OnEndOfDay callbacks are called as expected. See GH issue 2865.''' def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for y...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm illustrating how to request history data for different data normalization modes.
```python from AlgorithmImports import * class HistoryWithDifferentDataNormalizationModeRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013, 10, 7) self.set_end_date(2014, 1, 1) self.aapl_equity_symbol = self.add_equity("AAPL", Resolution.DAILY).symbol ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Tests delistings for Futures and Futures Options to ensure that they are delisted at the expected times.
```python from AlgorithmImports import * class FuturesAndFutures_optionsExpiryTimeAndLiquidationRegressionAlgorithm(QCAlgorithm): def initialize(self): self.invested = False self.liquidated = 0 self.delistings_received = 0 self.expected_expiry_warning_time = datetime(2020, 6, 19...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm asserting a default symbol is created using equity market when scheduling if none found
```python from AlgorithmImports import * class DefaultSchedulingSymbolRegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013, 1...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm to assert the behavior of <see cref="MaximumDrawdownPercentPerSecurity"/>.
```python from AlgorithmImports import * from BaseFrameworkRegressionAlgorithm import BaseFrameworkRegressionAlgorithm from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity class MaximumDrawdownPercentPerSecurityFrameworkRegressionAlgorithm(BaseFrameworkRegressionAlgorithm): def i...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This regression algorithm tests In The Money (ITM) future option expiry for calls. We expect 3 orders from the algorithm, which are: * Initial entry, buy ES Call Option (expiring ITM) * Option exercise, receiving ES future contracts * Future contract li...
```python from AlgorithmImports import * class FutureOptionCallITMExpiryRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2020, 1, 5) self.set_end_date(2020, 6, 30) self.es19m20 = self.add_future_contract( Symbol.create_future( Futur...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm asserting that universe symbols selection can be done by returning the symbol IDs in the selection function
```python from AlgorithmImports import * class SelectUniverseSymbolsFromIDRegressionAlgorithm(QCAlgorithm): ''' Regression algorithm asserting that universe symbols selection can be done by returning the symbol IDs in the selection function ''' def initialize(self): self.set_start_date(2014,...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm asserting that the consolidators are removed from the SubscriptionManager. This makes sure that we don't lose references to python consolidators when they are wrapped in a DataConsolidatorPythonWrapper.
```python from AlgorithmImports import * class ManuallyRemovedConsolidatorsAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2013, 10, 7) self.set_end_date(2013, 10, 11) self.consolidators = [] self.spy = self.add_equity("SPY").symbol # Case 1: ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : def initialize(self) -> None:
```python from AlgorithmImports import * from collections import deque from math import isclose class CustomIndicatorWithExtensionAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2013, 10, 9) self.set_end_date(2013, 10, 9) self._spy = self.add_equity("SPY", Reso...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example of custom volatility model
```python from AlgorithmImports import * class CustomVolatilityModelAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013,10,7) #Set Start Date self.set_end_date(2015,7,15) #Set End Date self.set_cash(100000) #Set Strategy Cash # Find more symbols...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Demonstration of how to estimate constituents of QC500 index based on the company fundamentals The algorithm creates a default tradable and liquid universe containing 500 US equities which are chosen at the first trading day of each month.
```python from AlgorithmImports import * class ConstituentsQC500GeneratorAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.universe_settings.resolution...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Algorithm illustrating how to get a security's industry-standard identifier from its `Symbol`
```python from AlgorithmImports import * class IndustryStandardSecurityIdentifiersRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2014, 6, 5) self.set_end_date(2014, 6, 5) equity = self.add_equity("AAPL").symbol cusip = equity.cusip composite...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This algorithm shows how you can handle universe selection in anyway you like, at any time you like. This algorithm has a list of 10 stocks that it rotates through every hour.
```python from AlgorithmImports import * class UserDefinedUniverseAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_cash(100000) self.set_start_date(2015, 1, 1) self.set_end_date(2015, 12, 1) self._symbols = ["SPY", "GOOG", "IBM", "AAPL", "MSFT", "CSCO", "ADBE", "WMT"] self.universe_setting...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm to assert the behavior of <see cref="HistoricalReturnsAlphaModel"/>.
```python from AlgorithmImports import * from BaseFrameworkRegressionAlgorithm import BaseFrameworkRegressionAlgorithm from Alphas.HistoricalReturnsAlphaModel import HistoricalReturnsAlphaModel class HistoricalReturnsAlphaModelFrameworkRegressionAlgorithm(BaseFrameworkRegressionAlgorithm): def initialize(self):...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Test algorithm using 'QCAlgorithm.add_alpha_model()'
```python from AlgorithmImports import * class AddAlphaModelAlgorithm(QCAlgorithm): def initialize(self): ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013,10,7) #Set Start D...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Test algorithm using 'ConfidenceWeightedPortfolioConstructionModel' and 'ConstantAlphaModel' generating a constant 'Insight' with a 0.25 confidence
```python from AlgorithmImports import * class ConfidenceWeightedFrameworkAlgorithm(QCAlgorithm): def initialize(self): ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' # Set requested data resolution...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Custom Consolidator Regression Algorithm shows some examples of how to build custom
```python from AlgorithmImports import * class CustomConsolidatorRegressionAlgorithm(QCAlgorithm): '''Custom Consolidator Regression Algorithm shows some examples of how to build custom consolidators in Python.''' def initialize(self): self.set_start_date(2013,10,4) self.set_end_date(...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regression algorithm which tests a fine fundamental filtered universe, related to GH issue 4127
```python from AlgorithmImports import * class FineFundamentalFilteredUniverseRegressionAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_dat...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : The demonstration algorithm shows some of the most common order methods when working with Crypto assets.
```python from AlgorithmImports import * class BasicTemplateCryptoAlgorithm(QCAlgorithm): def initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2018, 4, 4) #Set S...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Framework algorithm that uses the PearsonCorrelationPairsTradingAlphaModel. This model extendes BasePairsTradingAlphaModel and uses Pearson correlation to rank the pairs trading candidates and use the best candidate to trade.
```python from AlgorithmImports import * from Alphas.PearsonCorrelationPairsTradingAlphaModel import PearsonCorrelationPairsTradingAlphaModel class PearsonCorrelationPairsTradingAlphaModelFrameworkAlgorithm(QCAlgorithm): '''Framework algorithm that uses the PearsonCorrelationPairsTradingAlphaModel. This mode...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This regression algorithm tests In The Money (ITM) future option expiry for short calls. We expect 3 orders from the algorithm, which are: * Initial entry, sell ES Call Option (expiring ITM) * Option assignment, sell 1 contract of the underlying (ES) * ...
```python from AlgorithmImports import * class FutureOptionShortCallITMExpiryRegressionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2020, 1, 5) self.set_end_date(2020, 6, 30) self.es19m20 = self.add_future_contract( Symbol.create_future( ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : This example demonstrates how to add futures with daily resolution.
```python from AlgorithmImports import * class BasicTemplateFuturesDailyAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2013, 10, 8) self.set_end_date(2014, 10, 10) self.set_cash(1000000) resolution = self.get_resolution() extended_market_hours = self.ge...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Regrssion algorithm to assert we can update indicators that inherit from IndicatorBase<TradeBar> with RenkoBar's
```python from AlgorithmImports import * class IndicatorWithRenkoBarsRegressionAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2013, 10, 7) self.set_end_date(2013, 10, 9) self.add_equity("SPY") self.add_equity("AIG") spy_renko_consolidator = Re...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Test algorithm using 'QCAlgorithm.add_universe_selection(IUniverseSelectionModel)'
```python from AlgorithmImports import * class AddUniverseSelectionModelAlgorithm(QCAlgorithm): def initialize(self): ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.set_start_date(2013,10,8) ...
You are a quantive developer and need to generate code for use in QuantConnect's LEAN algorithm framework.
Generate a LEAN Algorithm that can be described like this : Example algorithm demonstrating the usage of the RSI indicator in combination with ETF constituents data to replicate the weighting of the ETF's assets in our own account.
```python from AlgorithmImports import * class ETFConstituentUniverseRSIAlphaModelAlgorithm(QCAlgorithm): ### <summary> ### Initialize the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. ### </summary> def initialize(self): ...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6