Lean
$LEAN_TAG$
|
Creates and wraps the algorithm written in python. More...
Public Member Functions | |
AlgorithmPythonWrapper (string moduleName) | |
AlgorithmPythonWrapper constructor. Creates and wraps the algorithm written in python. More... | |
void | SetStatus (AlgorithmStatus status) |
Set the state of a live deployment More... | |
void | SetAvailableDataTypes (Dictionary< SecurityType, List< TickType >> availableDataTypes) |
Set the available TickType supported by each SecurityType in SecurityManager More... | |
void | SetOptionChainProvider (IOptionChainProvider optionChainProvider) |
Sets the option chain provider, used to get the list of option contracts for an underlying symbol More... | |
void | SetFutureChainProvider (IFutureChainProvider futureChainProvider) |
Sets the future chain provider, used to get the list of future contracts for an underlying symbol More... | |
void | SetStatisticsService (IStatisticsService statisticsService) |
Sets the statistics service instance to be used by the algorithm More... | |
Security | AddSecurity (SecurityType securityType, string symbol, Resolution? resolution, string market, bool fillForward, decimal leverage, bool extendedMarketHours, DataMappingMode? dataMappingMode=null, DataNormalizationMode? dataNormalizationMode=null) |
Set a required SecurityType-symbol and resolution for algorithm More... | |
Security | AddSecurity (Symbol symbol, Resolution? resolution=null, bool fillForward=true, decimal leverage=Security.NullLeverage, bool extendedMarketHours=false, DataMappingMode? dataMappingMode=null, DataNormalizationMode? dataNormalizationMode=null, int contractDepthOffset=0) |
Set a required SecurityType-symbol and resolution for algorithm More... | |
Future | AddFutureContract (Symbol symbol, Resolution? resolution=null, bool fillForward=true, decimal leverage=0m, bool extendedMarketHours=false) |
Creates and adds a new single Future contract to the algorithm More... | |
Option | AddOptionContract (Symbol symbol, Resolution? resolution=null, bool fillForward=true, decimal leverage=0m, bool extendedMarketHours=false) |
Creates and adds a new single Option contract to the algorithm More... | |
void | OnEndOfTimeStep () |
Invoked at the end of every time step. This allows the algorithm to process events before advancing to the next time step. More... | |
void | Debug (string message) |
Send debug message More... | |
void | Error (string message) |
Send an error message for the algorithm More... | |
void | AddChart (Chart chart) |
Add a Chart object to algorithm collection More... | |
IEnumerable< Chart > | GetChartUpdates (bool clearChartData=false) |
Get the chart updates since the last request: More... | |
bool | GetLocked () |
Gets whether or not this algorithm has been locked and fully initialized More... | |
IReadOnlyDictionary< string, string > | GetParameters () |
Gets a read-only dictionary with all current parameters More... | |
string | GetParameter (string name, string defaultValue=null) |
Gets the parameter with the specified name. If a parameter with the specified name does not exist, the given default value is returned if any, else null More... | |
int | GetParameter (string name, int defaultValue) |
Gets the parameter with the specified name parsed as an integer. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned More... | |
double | GetParameter (string name, double defaultValue) |
Gets the parameter with the specified name parsed as a double. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned More... | |
decimal | GetParameter (string name, decimal defaultValue) |
Gets the parameter with the specified name parsed as a decimal. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned More... | |
void | Initialize () |
Initialise the Algorithm and Prepare Required Data: More... | |
List< int > | Liquidate (Symbol symbolToLiquidate=null, string tag="Liquidated") |
Liquidate your portfolio holdings: More... | |
void | Log (string message) |
Save entry to the Log More... | |
void | OnBrokerageDisconnect () |
Brokerage disconnected event handler. This method is called when the brokerage connection is lost. More... | |
void | OnBrokerageMessage (BrokerageMessageEvent messageEvent) |
Brokerage message event handler. This method is called for all types of brokerage messages. More... | |
void | OnBrokerageReconnect () |
Brokerage reconnected event handler. This method is called when the brokerage connection is restored after a disconnection. More... | |
void | OnData (Slice slice) |
v3.0 Handler for all data types More... | |
void | OnFrameworkData (Slice slice) |
Used to send data updates to algorithm framework models More... | |
void | OnSplits (Splits splits) |
Event handler to be called when there's been a split event More... | |
void | OnDividends (Dividends dividends) |
Event handler to be called when there's been a dividend event More... | |
void | OnDelistings (Delistings delistings) |
Event handler to be called when there's been a delistings event More... | |
void | OnSymbolChangedEvents (SymbolChangedEvents symbolsChanged) |
Event handler to be called when there's been a symbol changed event More... | |
void | OnEndOfAlgorithm () |
Call this event at the end of the algorithm running. More... | |
void | OnEndOfDay () |
End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets). More... | |
void | OnEndOfDay (Symbol symbol) |
End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets). More... | |
void | OnMarginCall (List< SubmitOrderRequest > requests) |
Margin call event handler. This method is called right before the margin call orders are placed in the market. More... | |
void | OnMarginCallWarning () |
Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue More... | |
void | OnOrderEvent (OrderEvent newEvent) |
EXPERTS ONLY:: [-!-Async Code-!-] New order event handler: on order status changes (filled, partially filled, cancelled etc). More... | |
OrderTicket | SubmitOrderRequest (SubmitOrderRequest request) |
Will submit an order request to the algorithm More... | |
void | OnAssignmentOrderEvent (OrderEvent assignmentEvent) |
Option assignment event handler. On an option assignment event for short legs the resulting information is passed to this method. More... | |
void | OnSecuritiesChanged (SecurityChanges changes) |
Event fired each time the we add/remove securities from the data feed More... | |
void | OnFrameworkSecuritiesChanged (SecurityChanges changes) |
Used to send security changes to algorithm framework models More... | |
void | PostInitialize () |
Called by setup handlers after Initialize and allows the algorithm a chance to organize the data gather in the Initialize method More... | |
void | OnWarmupFinished () |
Called when the algorithm has completed initialization and warm up. More... | |
bool | RemoveSecurity (Symbol symbol) |
Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings More... | |
void | SetAlgorithmId (string algorithmId) |
Set the algorithm Id for this backtest or live run. This can be used to identify the order and equity records. More... | |
void | SetBrokerageMessageHandler (IBrokerageMessageHandler handler) |
Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a BrokerageMessageType.Error occurs, the algorithm is stopped. More... | |
void | SetBrokerageModel (IBrokerageModel brokerageModel) |
Sets the brokerage model used to resolve transaction models, settlement models, and brokerage specified ordering behaviors. More... | |
void | SetAccountCurrency (string accountCurrency, decimal? startingCash=null) |
Sets the account currency cash symbol this algorithm is to manage, as well as the starting cash in this currency if given More... | |
void | SetCash (decimal startingCash) |
Set the starting capital for the strategy More... | |
void | SetCash (string symbol, decimal startingCash, decimal conversionRate=0) |
Set the cash for the specified symbol More... | |
void | SetDateTime (DateTime time) |
Set the DateTime Frontier: This is the master time and is More... | |
void | SetStartDate (DateTime start) |
Set the start date for the backtest More... | |
void | SetEndDate (DateTime end) |
Set the end date for a backtest. More... | |
BaseData | GetLastKnownPrice (Security security) |
Get the last known price using the history provider. Useful for seeding securities with the correct price More... | |
void | SetRunTimeError (Exception exception) |
Set the runtime error More... | |
void | SetFinishedWarmingUp () |
Sets IsWarmingUp to false to indicate this algorithm has finished its warm up More... | |
void | SetHistoryProvider (IHistoryProvider historyProvider) |
Set the historical data provider More... | |
void | SetLiveMode (bool live) |
Set live mode state of the algorithm run: Public setter for the algorithm property LiveMode. More... | |
void | SetAlgorithmMode (AlgorithmMode algorithmMode) |
Sets the algorithm running mode More... | |
void | SetDeploymentTarget (DeploymentTarget deploymentTarget) |
Sets the algorithm deployment target More... | |
void | SetLocked () |
Set the algorithm as initialized and locked. No more cash or security changes. More... | |
void | SetMaximumOrders (int max) |
Set the maximum number of orders the algorithm is allowed to process. More... | |
void | SetParameters (Dictionary< string, string > parameters) |
Sets the parameters from the dictionary More... | |
override string | ToString () |
Returns a string that represents the current AlgorithmPythonWrapper object. More... | |
void | SetCurrentSlice (Slice slice) |
Sets the current slice More... | |
void | SetApi (IApi api) |
Provide the API for the algorithm. More... | |
void | SetObjectStore (IObjectStore objectStore) |
Sets the object store More... | |
bool | Shortable (Symbol symbol, decimal shortQuantity, int? updateOrderId=null) |
Determines if the Symbol is shortable at the brokerage More... | |
long | ShortableQuantity (Symbol symbol) |
Gets the quantity shortable for the given asset More... | |
Symbol | Symbol (string ticker) |
Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm More... | |
string | Ticker (Symbol symbol) |
For the given symbol will resolve the ticker it used at the current algorithm date More... | |
void | SetName (string name) |
Sets name to the currently running backtest More... | |
void | AddTag (string tag) |
Adds a tag to the algorithm More... | |
void | SetTags (HashSet< string > tags) |
Sets the tags for the algorithm More... | |
Public Member Functions inherited from QuantConnect.Python.BasePythonWrapper< IAlgorithm > | |
BasePythonWrapper (bool validateInterface=true) | |
Creates a new instance of the BasePythonWrapper<TInterface> class More... | |
BasePythonWrapper (PyObject instance, bool validateInterface=true) | |
Creates a new instance of the BasePythonWrapper<TInterface> class with the specified instance More... | |
void | SetPythonInstance (PyObject instance) |
Sets the python instance More... | |
T | GetProperty< T > (string propertyName) |
Gets the Python instance property with the specified name More... | |
PyObject | GetProperty (string propertyName) |
Gets the Python instance property with the specified name More... | |
void | SetProperty (string propertyName, object value) |
Sets the Python instance property with the specified name More... | |
dynamic | GetEvent (string name) |
Gets the Python instance event with the specified name More... | |
bool | HasAttr (string name) |
Determines whether the Python instance has the specified attribute More... | |
PyObject | GetMethod (string methodName) |
Gets the Python instances method with the specified name and caches it More... | |
T | InvokeMethod< T > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments More... | |
PyObject | InvokeMethod (string methodName, params object[] args) |
Invokes the specified method with the specified arguments More... | |
Public Attributes | |
string | AlgorithmId => _baseAlgorithm.AlgorithmId |
AlgorithmId for the backtest More... | |
IBenchmark | Benchmark => _baseAlgorithm.Benchmark |
Gets the function used to define the benchmark. This function will return the value of the benchmark at a requested date/time More... | |
IBrokerageModel | BrokerageModel => _baseAlgorithm.BrokerageModel |
Gets the brokerage model used to emulate a real brokerage More... | |
BrokerageName | BrokerageName => _baseAlgorithm.BrokerageName |
Gets the brokerage name. More... | |
IRiskFreeInterestRateModel | RiskFreeInterestRateModel => _baseAlgorithm.RiskFreeInterestRateModel |
Gets the risk free interest rate model used to get the interest rates More... | |
ConcurrentQueue< string > | DebugMessages => _baseAlgorithm.DebugMessages |
Debug messages from the strategy: More... | |
DateTime | EndDate => _baseAlgorithm.EndDate |
Get Requested Backtest End Date More... | |
ConcurrentQueue< string > | ErrorMessages => _baseAlgorithm.ErrorMessages |
Error messages from the strategy: More... | |
bool | IsWarmingUp => _baseAlgorithm.IsWarmingUp |
Gets whether or not this algorithm is still warming up More... | |
bool | LiveMode => _baseAlgorithm.LiveMode |
Algorithm is running on a live server. More... | |
AlgorithmMode | AlgorithmMode => _baseAlgorithm.AlgorithmMode |
Algorithm running mode. More... | |
DeploymentTarget | DeploymentTarget => _baseAlgorithm.DeploymentTarget |
Deployment target, either local or cloud. More... | |
ConcurrentQueue< string > | LogMessages => _baseAlgorithm.LogMessages |
Log messages from the strategy: More... | |
NotificationManager | Notify => _baseAlgorithm.Notify |
Notification manager for storing and processing live event messages More... | |
SecurityPortfolioManager | Portfolio => _baseAlgorithm.Portfolio |
Security portfolio management class provides wrapper and helper methods for the Security.Holdings class such as IsLong, IsShort, TotalProfit More... | |
ConcurrentDictionary< string, string > | RuntimeStatistics => _baseAlgorithm.RuntimeStatistics |
Customizable dynamic statistics displayed during live trading: More... | |
ScheduleManager | Schedule => _baseAlgorithm.Schedule |
Gets schedule manager for adding/removing scheduled events More... | |
SecurityManager | Securities => _baseAlgorithm.Securities |
Security object collection class stores an array of objects representing representing each security/asset we have a subscription for. More... | |
ISecurityInitializer | SecurityInitializer => _baseAlgorithm.SecurityInitializer |
Gets an instance that is to be used to initialize newly created securities. More... | |
ITradeBuilder | TradeBuilder => _baseAlgorithm.TradeBuilder |
Gets the Trade Builder to generate trades from executions More... | |
IAlgorithmSettings | Settings => _baseAlgorithm.Settings |
Gets the user settings for the algorithm More... | |
IOptionChainProvider | OptionChainProvider => _baseAlgorithm.OptionChainProvider |
Gets the option chain provider, used to get the list of option contracts for an underlying symbol More... | |
IFutureChainProvider | FutureChainProvider => _baseAlgorithm.FutureChainProvider |
Gets the future chain provider, used to get the list of future contracts for an underlying symbol More... | |
ObjectStore | ObjectStore => _baseAlgorithm.ObjectStore |
Gets the object store, used for persistence More... | |
Slice | CurrentSlice => _baseAlgorithm.CurrentSlice |
Returns the current Slice object More... | |
DateTime | StartDate => _baseAlgorithm.StartDate |
Algorithm start date for backtesting, set by the SetStartDate methods. More... | |
ITimeKeeper | TimeKeeper => _baseAlgorithm.TimeKeeper |
Gets the time keeper instance More... | |
SubscriptionManager | SubscriptionManager => _baseAlgorithm.SubscriptionManager |
Data subscription manager controls the information and subscriptions the algorithms recieves. Subscription configurations can be added through the Subscription Manager. More... | |
DateTime | Time => _baseAlgorithm.Time |
Current date/time in the algorithm's local time zone More... | |
DateTimeZone | TimeZone => _baseAlgorithm.TimeZone |
Gets the time zone of the algorithm More... | |
SecurityTransactionManager | Transactions => _baseAlgorithm.Transactions |
Security transaction manager class controls the store and processing of orders. More... | |
UniverseManager | UniverseManager => _baseAlgorithm.UniverseManager |
Gets the collection of universes for the algorithm More... | |
UniverseSettings | UniverseSettings => _baseAlgorithm.UniverseSettings |
Gets the subscription settings to be used when adding securities via universe selection More... | |
DateTime | UtcTime => _baseAlgorithm.UtcTime |
Current date/time in UTC. More... | |
string | AccountCurrency => _baseAlgorithm.AccountCurrency |
Gets the account currency More... | |
InsightManager | Insights => _baseAlgorithm.Insights |
Gets the insight manager More... | |
StatisticsResults | Statistics => _baseAlgorithm.Statistics |
The current statistics for the running algorithm. More... | |
Properties | |
bool | IsOnEndOfDayImplemented [get] |
True if the underlying python algorithm implements "OnEndOfDay" More... | |
bool | IsOnEndOfDaySymbolImplemented [get] |
True if the underlying python algorithm implements "OnEndOfDay(symbol)" More... | |
IBrokerageMessageHandler | BrokerageMessageHandler [get, set] |
Gets the brokerage message handler used to decide what to do with each message sent from the brokerage More... | |
IHistoryProvider | HistoryProvider [get, set] |
Gets or sets the history provider for the algorithm More... | |
string | Name [get, set] |
Public name for the algorithm. More... | |
HashSet< string > | Tags [get, set] |
A list of tags associated with the algorithm or the backtest, useful for categorization More... | |
AlgorithmEvent< string > | NameUpdated |
Event fired algorithm's name is changed More... | |
AlgorithmEvent< HashSet< string > > | TagsUpdated |
Event fired when the tag collection is updated More... | |
Exception | RunTimeError [get, set] |
Gets the run time error from the algorithm, or null if none was encountered. More... | |
AlgorithmStatus | Status [get, set] |
Gets or sets the current status of the algorithm More... | |
AlgorithmEvent< GeneratedInsightsCollection > | InsightsGenerated |
Event fired when an algorithm generates a insight More... | |
int | ProjectId [get, set] |
The project id associated with this algorithm if any More... | |
Properties inherited from QuantConnect.Interfaces.IAlgorithm | |
ITimeKeeper | TimeKeeper [get] |
Gets the time keeper instance More... | |
SubscriptionManager | SubscriptionManager [get] |
Data subscription manager controls the information and subscriptions the algorithms recieves. Subscription configurations can be added through the Subscription Manager. More... | |
int | ProjectId [get, set] |
The project id associated with this algorithm if any More... | |
SecurityManager | Securities [get] |
Security object collection class stores an array of objects representing representing each security/asset we have a subscription for. More... | |
UniverseManager | UniverseManager [get] |
Gets the collection of universes for the algorithm More... | |
SecurityPortfolioManager | Portfolio [get] |
Security portfolio management class provides wrapper and helper methods for the Security.Holdings class such as IsLong, IsShort, TotalProfit More... | |
SecurityTransactionManager | Transactions [get] |
Security transaction manager class controls the store and processing of orders. More... | |
IBrokerageModel | BrokerageModel [get] |
Gets the brokerage model used to emulate a real brokerage More... | |
BrokerageName | BrokerageName [get] |
Gets the brokerage name. More... | |
IRiskFreeInterestRateModel | RiskFreeInterestRateModel [get] |
Gets the risk free interest rate model used to get the interest rates More... | |
IBrokerageMessageHandler | BrokerageMessageHandler [get, set] |
Gets the brokerage message handler used to decide what to do with each message sent from the brokerage More... | |
NotificationManager | Notify [get] |
Notification manager for storing and processing live event messages More... | |
ScheduleManager | Schedule [get] |
Gets schedule manager for adding/removing scheduled events More... | |
IHistoryProvider | HistoryProvider [get, set] |
Gets or sets the history provider for the algorithm More... | |
AlgorithmStatus | Status [get, set] |
Gets or sets the current status of the algorithm More... | |
bool | IsWarmingUp [get] |
Gets whether or not this algorithm is still warming up More... | |
string | Name [get, set] |
Public name for the algorithm. More... | |
HashSet< string > | Tags [get, set] |
A list of tags associated with the algorithm or the backtest, useful for categorization More... | |
DateTime | Time [get] |
Current date/time in the algorithm's local time zone More... | |
DateTimeZone | TimeZone [get] |
Gets the time zone of the algorithm More... | |
DateTime | UtcTime [get] |
Current date/time in UTC. More... | |
DateTime | StartDate [get] |
Algorithm start date for backtesting, set by the SetStartDate methods. More... | |
DateTime | EndDate [get] |
Get Requested Backtest End Date More... | |
string | AlgorithmId [get] |
AlgorithmId for the backtest More... | |
bool | LiveMode [get] |
Algorithm is running on a live server. More... | |
AlgorithmMode | AlgorithmMode [get] |
Algorithm running mode. More... | |
DeploymentTarget | DeploymentTarget [get] |
Deployment target, either local or cloud. More... | |
UniverseSettings | UniverseSettings [get] |
Gets the subscription settings to be used when adding securities via universe selection More... | |
ConcurrentQueue< string > | DebugMessages [get] |
Debug messages from the strategy: More... | |
ConcurrentQueue< string > | ErrorMessages [get] |
Error messages from the strategy: More... | |
ConcurrentQueue< string > | LogMessages [get] |
Log messages from the strategy: More... | |
Exception | RunTimeError [get, set] |
Gets the run time error from the algorithm, or null if none was encountered. More... | |
ConcurrentDictionary< string, string > | RuntimeStatistics [get] |
Customizable dynamic statistics displayed during live trading: More... | |
StatisticsResults | Statistics [get] |
The current algorithm statistics for the running algorithm. More... | |
IBenchmark | Benchmark [get] |
Gets the function used to define the benchmark. This function will return the value of the benchmark at a requested date/time More... | |
ITradeBuilder | TradeBuilder [get] |
Gets the Trade Builder to generate trades from executions More... | |
IAlgorithmSettings | Settings [get] |
Gets the user settings for the algorithm More... | |
IOptionChainProvider | OptionChainProvider [get] |
Gets the option chain provider, used to get the list of option contracts for an underlying symbol More... | |
IFutureChainProvider | FutureChainProvider [get] |
Gets the future chain provider, used to get the list of future contracts for an underlying symbol More... | |
InsightManager | Insights [get] |
Gets the insight manager More... | |
ObjectStore | ObjectStore [get] |
Gets the object store, used for persistence More... | |
Slice | CurrentSlice [get] |
Returns the current Slice object More... | |
Properties inherited from QuantConnect.Interfaces.ISecurityInitializerProvider | |
ISecurityInitializer | SecurityInitializer [get] |
Gets an instance that is to be used to initialize newly created securities. More... | |
Properties inherited from QuantConnect.Interfaces.IAccountCurrencyProvider | |
string | AccountCurrency [get] |
Gets the account currency More... | |
Additional Inherited Members | |
Protected Attributes inherited from QuantConnect.Python.BasePythonWrapper< IAlgorithm > | |
PyObject | Instance |
Gets the underlying python instance More... | |
Events inherited from QuantConnect.Interfaces.IAlgorithm | |
AlgorithmEvent< GeneratedInsightsCollection > | InsightsGenerated |
Event fired when an algorithm generates a insight More... | |
AlgorithmEvent< string > | NameUpdated |
Event fired algorithm's name is changed More... | |
AlgorithmEvent< HashSet< string > > | TagsUpdated |
Event fired when the tag collection is updated More... | |
Creates and wraps the algorithm written in python.
Definition at line 46 of file AlgorithmPythonWrapper.cs.
QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AlgorithmPythonWrapper | ( | string | moduleName | ) |
AlgorithmPythonWrapper constructor. Creates and wraps the algorithm written in python.
moduleName | Name of the module that can be found in the PYTHONPATH |
Definition at line 84 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetStatus | ( | AlgorithmStatus | status | ) |
Set the state of a live deployment
status | Live deployment status |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetAvailableDataTypes | ( | Dictionary< SecurityType, List< TickType >> | availableDataTypes | ) |
Set the available TickType supported by each SecurityType in SecurityManager
availableDataTypes | >The different TickType each Security supports |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetOptionChainProvider | ( | IOptionChainProvider | optionChainProvider | ) |
Sets the option chain provider, used to get the list of option contracts for an underlying symbol
optionChainProvider | The option chain provider |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetFutureChainProvider | ( | IFutureChainProvider | futureChainProvider | ) |
Sets the future chain provider, used to get the list of future contracts for an underlying symbol
futureChainProvider | The future chain provider |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetStatisticsService | ( | IStatisticsService | statisticsService | ) |
Sets the statistics service instance to be used by the algorithm
statisticsService | The statistics service instance |
Implements QuantConnect.Interfaces.IAlgorithm.
Security QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddSecurity | ( | SecurityType | securityType, |
string | symbol, | ||
Resolution? | resolution, | ||
string | market, | ||
bool | fillForward, | ||
decimal | leverage, | ||
bool | extendedMarketHours, | ||
DataMappingMode? | dataMappingMode = null , |
||
DataNormalizationMode? | dataNormalizationMode = null |
||
) |
Set a required SecurityType-symbol and resolution for algorithm
securityType | SecurityType Enum: Equity, Commodity, FOREX or Future |
symbol | Symbol Representation of the MarketType, e.g. AAPL |
resolution | The Resolution of market data, Tick, Second, Minute, Hour, or Daily. |
market | The market the requested security belongs to, such as 'usa' or 'fxcm' |
fillForward | If true, returns the last available data even if none in that timeslice. |
leverage | leverage for this security |
extendedMarketHours | Use extended market hours data |
dataMappingMode | The contract mapping mode to use for the security |
dataNormalizationMode | The price scaling mode to use for the security |
Implements QuantConnect.Interfaces.IAlgorithm.
Security QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddSecurity | ( | Symbol | symbol, |
Resolution? | resolution = null , |
||
bool | fillForward = true , |
||
decimal | leverage = Security.NullLeverage , |
||
bool | extendedMarketHours = false , |
||
DataMappingMode? | dataMappingMode = null , |
||
DataNormalizationMode? | dataNormalizationMode = null , |
||
int | contractDepthOffset = 0 |
||
) |
Set a required SecurityType-symbol and resolution for algorithm
symbol | The security Symbol |
resolution | Resolution of the MarketType required: MarketData, Second or Minute |
fillForward | If true, returns the last available data even if none in that timeslice. |
leverage | leverage for this security |
extendedMarketHours | Use extended market hours data |
dataMappingMode | The contract mapping mode to use for the security |
dataNormalizationMode | The price scaling mode to use for the security |
contractDepthOffset | The continuous contract desired offset from the current front month. For example, 0 (default) will use the front month, 1 will use the back month contract |
Implements QuantConnect.Interfaces.IAlgorithm.
Future QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddFutureContract | ( | Symbol | symbol, |
Resolution? | resolution = null , |
||
bool | fillForward = true , |
||
decimal | leverage = 0m , |
||
bool | extendedMarketHours = false |
||
) |
Creates and adds a new single Future contract to the algorithm
symbol | The futures contract symbol |
resolution | The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.Minute |
fillForward | If true, returns the last available data even if none in that timeslice. Default is |
true
leverage | The requested leverage for this equity. Default is set by SecurityInitializer |
extendedMarketHours | Use extended market hours data |
Implements QuantConnect.Interfaces.IAlgorithm.
Option QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddOptionContract | ( | Symbol | symbol, |
Resolution? | resolution = null , |
||
bool | fillForward = true , |
||
decimal | leverage = 0m , |
||
bool | extendedMarketHours = false |
||
) |
Creates and adds a new single Option contract to the algorithm
symbol | The option contract symbol |
resolution | The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.Minute |
fillForward | If true, returns the last available data even if none in that timeslice. Default is |
true
leverage | The requested leverage for this equity. Default is set by SecurityInitializer |
extendedMarketHours | Use extended market hours data |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnEndOfTimeStep | ( | ) |
Invoked at the end of every time step. This allows the algorithm to process events before advancing to the next time step.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 627 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Debug | ( | string | message | ) |
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Error | ( | string | message | ) |
Send an error message for the algorithm
message | String message |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddChart | ( | Chart | chart | ) |
Add a Chart object to algorithm collection
chart | Chart object to add to collection. |
Implements QuantConnect.Interfaces.IAlgorithm.
IEnumerable<Chart> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetChartUpdates | ( | bool | clearChartData = false | ) |
Get the chart updates since the last request:
clearChartData |
Implements QuantConnect.Interfaces.IAlgorithm.
bool QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetLocked | ( | ) |
Gets whether or not this algorithm has been locked and fully initialized
Implements QuantConnect.Interfaces.IAlgorithm.
IReadOnlyDictionary<string, string> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetParameters | ( | ) |
Gets a read-only dictionary with all current parameters
Implements QuantConnect.Interfaces.IAlgorithm.
string QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetParameter | ( | string | name, |
string | defaultValue = null |
||
) |
Gets the parameter with the specified name. If a parameter with the specified name does not exist, the given default value is returned if any, else null
name | The name of the parameter to get |
defaultValue | The default value to return |
Implements QuantConnect.Interfaces.IAlgorithm.
int QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetParameter | ( | string | name, |
int | defaultValue | ||
) |
Gets the parameter with the specified name parsed as an integer. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned
name | The name of the parameter to get |
defaultValue | The default value to return |
Implements QuantConnect.Interfaces.IAlgorithm.
double QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetParameter | ( | string | name, |
double | defaultValue | ||
) |
Gets the parameter with the specified name parsed as a double. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned
name | The name of the parameter to get |
defaultValue | The default value to return |
Implements QuantConnect.Interfaces.IAlgorithm.
decimal QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetParameter | ( | string | name, |
decimal | defaultValue | ||
) |
Gets the parameter with the specified name parsed as a decimal. If a parameter with the specified name does not exist, or the conversion is not possible, the given default value is returned
name | The name of the parameter to get |
defaultValue | The default value to return |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Initialize | ( | ) |
Initialise the Algorithm and Prepare Required Data:
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 706 of file AlgorithmPythonWrapper.cs.
List<int> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Liquidate | ( | Symbol | symbolToLiquidate = null , |
string | tag = "Liquidated" |
||
) |
Liquidate your portfolio holdings:
symbolToLiquidate | Specific asset to liquidate, defaults to all. |
tag | Custom tag to know who is calling this. |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Log | ( | string | message | ) |
Save entry to the Log
message | String message |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnBrokerageDisconnect | ( | ) |
Brokerage disconnected event handler. This method is called when the brokerage connection is lost.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 728 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnBrokerageMessage | ( | BrokerageMessageEvent | messageEvent | ) |
Brokerage message event handler. This method is called for all types of brokerage messages.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 736 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnBrokerageReconnect | ( | ) |
Brokerage reconnected event handler. This method is called when the brokerage connection is restored after a disconnection.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 744 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnData | ( | Slice | slice | ) |
v3.0 Handler for all data types
slice | The current slice of data |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 753 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnFrameworkData | ( | Slice | slice | ) |
Used to send data updates to algorithm framework models
slice | The current data slice |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 768 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnSplits | ( | Splits | splits | ) |
Event handler to be called when there's been a split event
splits | The current time slice splits |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 777 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnDividends | ( | Dividends | dividends | ) |
Event handler to be called when there's been a dividend event
dividends | The current time slice dividends |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 786 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnDelistings | ( | Delistings | delistings | ) |
Event handler to be called when there's been a delistings event
delistings | The current time slice delistings |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 795 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnSymbolChangedEvents | ( | SymbolChangedEvents | symbolsChanged | ) |
Event handler to be called when there's been a symbol changed event
symbolsChanged | The current time slice symbol changed events |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 804 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnEndOfAlgorithm | ( | ) |
Call this event at the end of the algorithm running.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 812 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnEndOfDay | ( | ) |
End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).
Method is called 10 minutes before closing to allow user to close out position.
Deprecated because different assets have different market close times, and because Python does not support two methods with the same name
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 824 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnEndOfDay | ( | Symbol | symbol | ) |
End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).
This method is left for backwards compatibility and is invoked via OnEndOfDay(Symbol), if that method is override then this method will not be called without a called to base.OnEndOfDay(string)
symbol | Asset symbol for this end of day event. Forex and equities have different closing hours. |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 849 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnMarginCall | ( | List< SubmitOrderRequest > | requests | ) |
Margin call event handler. This method is called right before the margin call orders are placed in the market.
requests | The orders to be executed to bring this algorithm within margin limits |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 870 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnMarginCallWarning | ( | ) |
Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 909 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnOrderEvent | ( | OrderEvent | newEvent | ) |
EXPERTS ONLY:: [-!-Async Code-!-] New order event handler: on order status changes (filled, partially filled, cancelled etc).
newEvent | Event information |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 919 of file AlgorithmPythonWrapper.cs.
OrderTicket QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SubmitOrderRequest | ( | SubmitOrderRequest | request | ) |
Will submit an order request to the algorithm
request | The request to submit |
Will run order prechecks, which include making sure the algorithm is not warming up, security is added and has data among others
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 930 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnAssignmentOrderEvent | ( | OrderEvent | assignmentEvent | ) |
Option assignment event handler. On an option assignment event for short legs the resulting information is passed to this method.
assignmentEvent | Option exercise event details containing details of the assignment |
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
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 940 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnSecuritiesChanged | ( | SecurityChanges | changes | ) |
Event fired each time the we add/remove securities from the data feed
changes | Security additions/removals for this time step |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 949 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnFrameworkSecuritiesChanged | ( | SecurityChanges | changes | ) |
Used to send security changes to algorithm framework models
changes | Security additions/removals for this time step |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 958 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.PostInitialize | ( | ) |
Called by setup handlers after Initialize and allows the algorithm a chance to organize the data gather in the Initialize method
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 967 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnWarmupFinished | ( | ) |
Called when the algorithm has completed initialization and warm up.
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 975 of file AlgorithmPythonWrapper.cs.
bool QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.RemoveSecurity | ( | Symbol | symbol | ) |
Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings
symbol | The symbol of the security to be removed |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetAlgorithmId | ( | string | algorithmId | ) |
Set the algorithm Id for this backtest or live run. This can be used to identify the order and equity records.
algorithmId | unique 32 character identifier for backtest or live server |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetBrokerageMessageHandler | ( | IBrokerageMessageHandler | handler | ) |
Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a BrokerageMessageType.Error occurs, the algorithm is stopped.
handler | The message handler to use |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetBrokerageModel | ( | IBrokerageModel | brokerageModel | ) |
Sets the brokerage model used to resolve transaction models, settlement models, and brokerage specified ordering behaviors.
brokerageModel | The brokerage model used to emulate the real brokerage |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetAccountCurrency | ( | string | accountCurrency, |
decimal? | startingCash = null |
||
) |
Sets the account currency cash symbol this algorithm is to manage, as well as the starting cash in this currency if given
Has to be called during Initialize before calling SetCash(decimal) or adding any Security
accountCurrency | The account currency cash symbol to set |
startingCash | The account currency starting cash to set |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetCash | ( | decimal | startingCash | ) |
Set the starting capital for the strategy
startingCash | decimal starting capital, default $100,000 |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetCash | ( | string | symbol, |
decimal | startingCash, | ||
decimal | conversionRate = 0 |
||
) |
Set the cash for the specified symbol
symbol | The cash symbol to set |
startingCash | Decimal cash value of portfolio |
conversionRate | The current conversion rate for the |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetDateTime | ( | DateTime | time | ) |
Set the DateTime Frontier: This is the master time and is
time |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetStartDate | ( | DateTime | start | ) |
Set the start date for the backtest
start | Datetime Start date for backtest |
Must be less than end date and within data available
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetEndDate | ( | DateTime | end | ) |
Set the end date for a backtest.
end | Datetime value for end date |
Must be greater than the start date
Implements QuantConnect.Interfaces.IAlgorithm.
BaseData QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.GetLastKnownPrice | ( | Security | security | ) |
Get the last known price using the history provider. Useful for seeding securities with the correct price
security | Security object for which to retrieve historical data |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetRunTimeError | ( | Exception | exception | ) |
Set the runtime error
exception | Represents error that occur during execution |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetFinishedWarmingUp | ( | ) |
Sets IsWarmingUp to false to indicate this algorithm has finished its warm up
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1071 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetHistoryProvider | ( | IHistoryProvider | historyProvider | ) |
Set the historical data provider
historyProvider | Historical data provider |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetLiveMode | ( | bool | live | ) |
Set live mode state of the algorithm run: Public setter for the algorithm property LiveMode.
live | Bool live mode flag |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetAlgorithmMode | ( | AlgorithmMode | algorithmMode | ) |
Sets the algorithm running mode
algorithmMode | Algorithm mode |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetDeploymentTarget | ( | DeploymentTarget | deploymentTarget | ) |
Sets the algorithm deployment target
deploymentTarget | Deployment target |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetLocked | ( | ) |
Set the algorithm as initialized and locked. No more cash or security changes.
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetMaximumOrders | ( | int | max | ) |
Set the maximum number of orders the algorithm is allowed to process.
max | Maximum order count int |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetParameters | ( | Dictionary< string, string > | parameters | ) |
Sets the parameters from the dictionary
parameters | Dictionary containing the parameter names to values |
Implements QuantConnect.Interfaces.IAlgorithm.
override string QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.ToString | ( | ) |
Returns a string that represents the current AlgorithmPythonWrapper object.
Definition at line 1144 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetCurrentSlice | ( | Slice | slice | ) |
Sets the current slice
slice | The Slice object |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1160 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetApi | ( | IApi | api | ) |
Provide the API for the algorithm.
api | Initiated API |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetObjectStore | ( | IObjectStore | objectStore | ) |
Sets the object store
objectStore | The object store |
Implements QuantConnect.Interfaces.IAlgorithm.
bool QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Shortable | ( | Symbol | symbol, |
decimal | shortQuantity, | ||
int? | updateOrderId = null |
||
) |
Determines if the Symbol is shortable at the brokerage
symbol | Symbol to check if shortable |
shortQuantity | Order's quantity to check if it is currently shortable, taking into account current holdings and open orders |
updateOrderId | Optionally the id of the order being updated. When updating an order we want to ignore it's submitted short quantity and use the new provided quantity to determine if we can perform the update |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1186 of file AlgorithmPythonWrapper.cs.
long QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.ShortableQuantity | ( | Symbol | symbol | ) |
Gets the quantity shortable for the given asset
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1198 of file AlgorithmPythonWrapper.cs.
Symbol QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Symbol | ( | string | ticker | ) |
Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm
ticker | The ticker symbol. This should be the ticker symbol as it was added to the algorithm |
Implements QuantConnect.Interfaces.IAlgorithm.
string QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Ticker | ( | Symbol | symbol | ) |
For the given symbol will resolve the ticker it used at the current algorithm date
symbol | The symbol to get the ticker for |
Implements QuantConnect.Interfaces.IAlgorithm.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetName | ( | string | name | ) |
Sets name to the currently running backtest
name | The name for the backtest |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1223 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AddTag | ( | string | tag | ) |
Adds a tag to the algorithm
tag | The tag to add |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1232 of file AlgorithmPythonWrapper.cs.
void QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SetTags | ( | HashSet< string > | tags | ) |
Sets the tags for the algorithm
tags | The tags |
Implements QuantConnect.Interfaces.IAlgorithm.
Definition at line 1241 of file AlgorithmPythonWrapper.cs.
string QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AlgorithmId => _baseAlgorithm.AlgorithmId |
AlgorithmId for the backtest
Definition at line 186 of file AlgorithmPythonWrapper.cs.
IBenchmark QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Benchmark => _baseAlgorithm.Benchmark |
Gets the function used to define the benchmark. This function will return the value of the benchmark at a requested date/time
Definition at line 192 of file AlgorithmPythonWrapper.cs.
IBrokerageModel QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.BrokerageModel => _baseAlgorithm.BrokerageModel |
Gets the brokerage model used to emulate a real brokerage
Definition at line 214 of file AlgorithmPythonWrapper.cs.
BrokerageName QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.BrokerageName => _baseAlgorithm.BrokerageName |
Gets the brokerage name.
Definition at line 219 of file AlgorithmPythonWrapper.cs.
IRiskFreeInterestRateModel QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.RiskFreeInterestRateModel => _baseAlgorithm.RiskFreeInterestRateModel |
Gets the risk free interest rate model used to get the interest rates
Definition at line 224 of file AlgorithmPythonWrapper.cs.
ConcurrentQueue<string> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.DebugMessages => _baseAlgorithm.DebugMessages |
Debug messages from the strategy:
Definition at line 229 of file AlgorithmPythonWrapper.cs.
DateTime QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.EndDate => _baseAlgorithm.EndDate |
Get Requested Backtest End Date
Definition at line 234 of file AlgorithmPythonWrapper.cs.
ConcurrentQueue<string> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.ErrorMessages => _baseAlgorithm.ErrorMessages |
Error messages from the strategy:
Definition at line 239 of file AlgorithmPythonWrapper.cs.
bool QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.IsWarmingUp => _baseAlgorithm.IsWarmingUp |
Gets whether or not this algorithm is still warming up
Definition at line 260 of file AlgorithmPythonWrapper.cs.
bool QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.LiveMode => _baseAlgorithm.LiveMode |
Algorithm is running on a live server.
Definition at line 265 of file AlgorithmPythonWrapper.cs.
AlgorithmMode QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AlgorithmMode => _baseAlgorithm.AlgorithmMode |
Algorithm running mode.
Definition at line 270 of file AlgorithmPythonWrapper.cs.
DeploymentTarget QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.DeploymentTarget => _baseAlgorithm.DeploymentTarget |
Deployment target, either local or cloud.
Definition at line 275 of file AlgorithmPythonWrapper.cs.
ConcurrentQueue<string> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.LogMessages => _baseAlgorithm.LogMessages |
Log messages from the strategy:
Definition at line 280 of file AlgorithmPythonWrapper.cs.
NotificationManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Notify => _baseAlgorithm.Notify |
Notification manager for storing and processing live event messages
Definition at line 348 of file AlgorithmPythonWrapper.cs.
SecurityPortfolioManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Portfolio => _baseAlgorithm.Portfolio |
Security portfolio management class provides wrapper and helper methods for the Security.Holdings class such as IsLong, IsShort, TotalProfit
Portfolio is a wrapper and helper class encapsulating the Securities[].Holdings objects
Definition at line 355 of file AlgorithmPythonWrapper.cs.
ConcurrentDictionary<string, string> QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.RuntimeStatistics => _baseAlgorithm.RuntimeStatistics |
Customizable dynamic statistics displayed during live trading:
Definition at line 376 of file AlgorithmPythonWrapper.cs.
ScheduleManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Schedule => _baseAlgorithm.Schedule |
Gets schedule manager for adding/removing scheduled events
Definition at line 381 of file AlgorithmPythonWrapper.cs.
SecurityManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Securities => _baseAlgorithm.Securities |
Security object collection class stores an array of objects representing representing each security/asset we have a subscription for.
It is an IDictionary implementation and can be indexed by symbol
Definition at line 388 of file AlgorithmPythonWrapper.cs.
ISecurityInitializer QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SecurityInitializer => _baseAlgorithm.SecurityInitializer |
Gets an instance that is to be used to initialize newly created securities.
Definition at line 393 of file AlgorithmPythonWrapper.cs.
ITradeBuilder QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.TradeBuilder => _baseAlgorithm.TradeBuilder |
Gets the Trade Builder to generate trades from executions
Definition at line 398 of file AlgorithmPythonWrapper.cs.
IAlgorithmSettings QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Settings => _baseAlgorithm.Settings |
Gets the user settings for the algorithm
Definition at line 403 of file AlgorithmPythonWrapper.cs.
IOptionChainProvider QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OptionChainProvider => _baseAlgorithm.OptionChainProvider |
Gets the option chain provider, used to get the list of option contracts for an underlying symbol
Definition at line 408 of file AlgorithmPythonWrapper.cs.
IFutureChainProvider QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.FutureChainProvider => _baseAlgorithm.FutureChainProvider |
Gets the future chain provider, used to get the list of future contracts for an underlying symbol
Definition at line 413 of file AlgorithmPythonWrapper.cs.
ObjectStore QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.ObjectStore => _baseAlgorithm.ObjectStore |
Gets the object store, used for persistence
Definition at line 418 of file AlgorithmPythonWrapper.cs.
Slice QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.CurrentSlice => _baseAlgorithm.CurrentSlice |
Returns the current Slice object
Definition at line 423 of file AlgorithmPythonWrapper.cs.
DateTime QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.StartDate => _baseAlgorithm.StartDate |
Algorithm start date for backtesting, set by the SetStartDate methods.
Definition at line 428 of file AlgorithmPythonWrapper.cs.
ITimeKeeper QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.TimeKeeper => _baseAlgorithm.TimeKeeper |
Gets the time keeper instance
Definition at line 489 of file AlgorithmPythonWrapper.cs.
SubscriptionManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.SubscriptionManager => _baseAlgorithm.SubscriptionManager |
Data subscription manager controls the information and subscriptions the algorithms recieves. Subscription configurations can be added through the Subscription Manager.
Definition at line 495 of file AlgorithmPythonWrapper.cs.
DateTime QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Time => _baseAlgorithm.Time |
Current date/time in the algorithm's local time zone
Definition at line 515 of file AlgorithmPythonWrapper.cs.
DateTimeZone QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.TimeZone => _baseAlgorithm.TimeZone |
Gets the time zone of the algorithm
Definition at line 520 of file AlgorithmPythonWrapper.cs.
SecurityTransactionManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Transactions => _baseAlgorithm.Transactions |
Security transaction manager class controls the store and processing of orders.
The orders and their associated events are accessible here. When a new OrderEvent is recieved the algorithm portfolio is updated.
Definition at line 526 of file AlgorithmPythonWrapper.cs.
UniverseManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.UniverseManager => _baseAlgorithm.UniverseManager |
Gets the collection of universes for the algorithm
Definition at line 531 of file AlgorithmPythonWrapper.cs.
UniverseSettings QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.UniverseSettings => _baseAlgorithm.UniverseSettings |
Gets the subscription settings to be used when adding securities via universe selection
Definition at line 536 of file AlgorithmPythonWrapper.cs.
DateTime QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.UtcTime => _baseAlgorithm.UtcTime |
Current date/time in UTC.
Definition at line 541 of file AlgorithmPythonWrapper.cs.
string QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.AccountCurrency => _baseAlgorithm.AccountCurrency |
Gets the account currency
Definition at line 546 of file AlgorithmPythonWrapper.cs.
InsightManager QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Insights => _baseAlgorithm.Insights |
Gets the insight manager
Definition at line 551 of file AlgorithmPythonWrapper.cs.
StatisticsResults QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Statistics => _baseAlgorithm.Statistics |
The current statistics for the running algorithm.
Definition at line 562 of file AlgorithmPythonWrapper.cs.
|
get |
True if the underlying python algorithm implements "OnEndOfDay"
Definition at line 72 of file AlgorithmPythonWrapper.cs.
|
get |
True if the underlying python algorithm implements "OnEndOfDay(symbol)"
Definition at line 77 of file AlgorithmPythonWrapper.cs.
|
getset |
Gets the brokerage message handler used to decide what to do with each message sent from the brokerage
Definition at line 199 of file AlgorithmPythonWrapper.cs.
|
getset |
Gets or sets the history provider for the algorithm
Definition at line 245 of file AlgorithmPythonWrapper.cs.
|
getset |
Public name for the algorithm.
Not currently used but preserved for API integrity
Definition at line 287 of file AlgorithmPythonWrapper.cs.
|
getset |
A list of tags associated with the algorithm or the backtest, useful for categorization
Definition at line 302 of file AlgorithmPythonWrapper.cs.
|
addremove |
Event fired algorithm's name is changed
Definition at line 317 of file AlgorithmPythonWrapper.cs.
|
addremove |
Event fired when the tag collection is updated
Definition at line 333 of file AlgorithmPythonWrapper.cs.
|
getset |
Gets the run time error from the algorithm, or null if none was encountered.
Definition at line 361 of file AlgorithmPythonWrapper.cs.
|
getset |
Gets or sets the current status of the algorithm
Definition at line 434 of file AlgorithmPythonWrapper.cs.
|
addremove |
Event fired when an algorithm generates a insight
Definition at line 474 of file AlgorithmPythonWrapper.cs.
|
getset |
The project id associated with this algorithm if any
Definition at line 501 of file AlgorithmPythonWrapper.cs.