Lean
$LEAN_TAG$
|
Provides an implementation of IBrokerageModel that wraps a PyObject object More...
Public Member Functions | |
BrokerageModelPythonWrapper (PyObject model) | |
Constructor for initialising the BrokerageModelPythonWrapper class with wrapped PyObject object More... | |
void | ApplySplit (List< OrderTicket > tickets, Split split) |
Applies the split to the specified order ticket More... | |
bool | CanExecuteOrder (Security security, Order order) |
Returns true if the brokerage would be able to execute this order at this time assuming market prices are sufficient for the fill to take place. This is used to emulate the brokerage fills in backtesting and paper trading. For example some brokerages may not perform executions during extended market hours. This is not intended to be checking whether or not the exchange is open, that is handled in the Security.Exchange property. More... | |
bool | CanSubmitOrder (Security security, Order order, out BrokerageMessageEvent message) |
Returns true if the brokerage could accept this order. This takes into account order type, security type, and order size limits. More... | |
bool | CanUpdateOrder (Security security, Order order, UpdateOrderRequest request, out BrokerageMessageEvent message) |
Returns true if the brokerage would allow updating the order as specified by the request More... | |
IBenchmark | GetBenchmark (SecurityManager securities) |
Get the benchmark for this model More... | |
IFeeModel | GetFeeModel (Security security) |
Gets a new fee model that represents this brokerage's fee structure More... | |
IFillModel | GetFillModel (Security security) |
Gets a new fill model that represents this brokerage's fill behavior More... | |
decimal | GetLeverage (Security security) |
Gets the brokerage's leverage for the specified security More... | |
ISettlementModel | GetSettlementModel (Security security) |
Gets a new settlement model for the security More... | |
ISettlementModel | GetSettlementModel (Security security, AccountType accountType) |
Gets a new settlement model for the security More... | |
ISlippageModel | GetSlippageModel (Security security) |
Gets a new slippage model that represents this brokerage's fill slippage behavior More... | |
bool | Shortable (IAlgorithm algorithm, Symbol symbol, decimal quantity) |
Determine if this symbol is shortable More... | |
IBuyingPowerModel | GetBuyingPowerModel (Security security) |
Gets a new buying power model for the security, returning the default model with the security's configured leverage. For cash accounts, leverage = 1 is used. More... | |
IBuyingPowerModel | GetBuyingPowerModel (Security security, AccountType accountType) |
Gets a new buying power model for the security More... | |
IShortableProvider | GetShortableProvider (Security security) |
Gets the shortable provider More... | |
IBrokerageModel | GetModel () |
Convenience method to get the underlying IBrokerageModel object from the wrapper. More... | |
IMarginInterestRateModel | GetMarginInterestRateModel (Security security) |
Gets a new margin interest rate model for the security More... | |
Public Member Functions inherited from QuantConnect.Python.BasePythonWrapper< IBrokerageModel > | |
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... | |
void | InvokeVoidMethod (string methodName, params object[] args) |
Invokes the specified method with the specified arguments without returning a value More... | |
IEnumerable< T > | InvokeMethodAndEnumerate< T > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments and iterates over the returned values More... | |
Dictionary< TKey, TValue > | InvokeMethodAndGetDictionary< TKey, TValue > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments and iterates over the returned values More... | |
T | InvokeMethodWithOutParameters< T > (string methodName, Type[] outParametersTypes, out object[] outParameters, params object[] args) |
Invokes the specified method with the specified arguments and out parameters More... | |
T | InvokeMethodAndWrapResult< T > (string methodName, Func< PyObject, T > wrapResult, params object[] args) |
Invokes the specified method with the specified arguments and wraps the result by calling the given function if the result is not a C# object More... | |
virtual bool | Equals (BasePythonWrapper< TInterface > other) |
Determines whether the specified instance wraps the same Python object reference as this instance, which would indicate that they are equal. More... | |
override bool | Equals (object obj) |
Determines whether the specified object is an instance of BasePythonWrapper<TInterface> and wraps the same Python object reference as this instance, which would indicate that they are equal. More... | |
override int | GetHashCode () |
Gets the hash code for the current instance More... | |
Properties | |
AccountType | AccountType [get] |
Gets or sets the account type used by this model More... | |
decimal | RequiredFreeBuyingPowerPercent [get] |
Gets the brokerages model percentage factor used to determine the required unused buying power for the account. From 1 to 0. Example: 0 means no unused buying power is required. 0.5 means 50% of the buying power should be left unused. More... | |
IReadOnlyDictionary< SecurityType, string > | DefaultMarkets [get] |
Gets a map of the default markets to be used for each security type More... | |
Properties inherited from QuantConnect.Brokerages.IBrokerageModel | |
AccountType | AccountType [get] |
Gets the account type used by this model More... | |
decimal | RequiredFreeBuyingPowerPercent [get] |
Gets the brokerages model percentage factor used to determine the required unused buying power for the account. From 1 to 0. Example: 0 means no unused buying power is required. 0.5 means 50% of the buying power should be left unused. More... | |
IReadOnlyDictionary< SecurityType, string > | DefaultMarkets [get] |
Gets a map of the default markets to be used for each security type More... | |
Additional Inherited Members | |
Protected Attributes inherited from QuantConnect.Python.BasePythonWrapper< IBrokerageModel > | |
PyObject | Instance |
Gets the underlying python instance More... | |
Provides an implementation of IBrokerageModel that wraps a PyObject object
Definition at line 35 of file BrokerageModelPythonWrapper.cs.
QuantConnect.Python.BrokerageModelPythonWrapper.BrokerageModelPythonWrapper | ( | PyObject | model | ) |
Constructor for initialising the BrokerageModelPythonWrapper class with wrapped PyObject object
model | Models brokerage transactions, fees, and order |
Definition at line 41 of file BrokerageModelPythonWrapper.cs.
void QuantConnect.Python.BrokerageModelPythonWrapper.ApplySplit | ( | List< OrderTicket > | tickets, |
Split | split | ||
) |
Applies the split to the specified order ticket
tickets | The open tickets matching the split event |
split | The split event data |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 103 of file BrokerageModelPythonWrapper.cs.
bool QuantConnect.Python.BrokerageModelPythonWrapper.CanExecuteOrder | ( | Security | security, |
Order | order | ||
) |
Returns true if the brokerage would be able to execute this order at this time assuming market prices are sufficient for the fill to take place. This is used to emulate the brokerage fills in backtesting and paper trading. For example some brokerages may not perform executions during extended market hours. This is not intended to be checking whether or not the exchange is open, that is handled in the Security.Exchange property.
security | The security being ordered |
order | The order to test for execution |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 118 of file BrokerageModelPythonWrapper.cs.
bool QuantConnect.Python.BrokerageModelPythonWrapper.CanSubmitOrder | ( | Security | security, |
Order | order, | ||
out BrokerageMessageEvent | message | ||
) |
Returns true if the brokerage could accept this order. This takes into account order type, security type, and order size limits.
For example, a brokerage may have no connectivity at certain times, or an order rate/size limit
security | The security being ordered |
order | The order to be processed |
message | If this function returns false, a brokerage message detailing why the order may not be submitted |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 134 of file BrokerageModelPythonWrapper.cs.
bool QuantConnect.Python.BrokerageModelPythonWrapper.CanUpdateOrder | ( | Security | security, |
Order | order, | ||
UpdateOrderRequest | request, | ||
out BrokerageMessageEvent | message | ||
) |
Returns true if the brokerage would allow updating the order as specified by the request
security | The security of the order |
order | The order to be updated |
request | The requested updated to be made to the order |
message | If this function returns false, a brokerage message detailing why the order may not be updated |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 152 of file BrokerageModelPythonWrapper.cs.
IBenchmark QuantConnect.Python.BrokerageModelPythonWrapper.GetBenchmark | ( | SecurityManager | securities | ) |
Get the benchmark for this model
securities | SecurityService to create the security with if needed |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 167 of file BrokerageModelPythonWrapper.cs.
Gets a new fee model that represents this brokerage's fee structure
security | The security to get a fee model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 177 of file BrokerageModelPythonWrapper.cs.
IFillModel QuantConnect.Python.BrokerageModelPythonWrapper.GetFillModel | ( | Security | security | ) |
Gets a new fill model that represents this brokerage's fill behavior
security | The security to get fill model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 187 of file BrokerageModelPythonWrapper.cs.
decimal QuantConnect.Python.BrokerageModelPythonWrapper.GetLeverage | ( | Security | security | ) |
Gets the brokerage's leverage for the specified security
security | The security's whose leverage we seek |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 197 of file BrokerageModelPythonWrapper.cs.
ISettlementModel QuantConnect.Python.BrokerageModelPythonWrapper.GetSettlementModel | ( | Security | security | ) |
Gets a new settlement model for the security
security | The security to get a settlement model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 207 of file BrokerageModelPythonWrapper.cs.
ISettlementModel QuantConnect.Python.BrokerageModelPythonWrapper.GetSettlementModel | ( | Security | security, |
AccountType | accountType | ||
) |
Gets a new settlement model for the security
security | The security to get a settlement model for |
accountType | The account type |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 220 of file BrokerageModelPythonWrapper.cs.
ISlippageModel QuantConnect.Python.BrokerageModelPythonWrapper.GetSlippageModel | ( | Security | security | ) |
Gets a new slippage model that represents this brokerage's fill slippage behavior
security | The security to get a slippage model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 230 of file BrokerageModelPythonWrapper.cs.
bool QuantConnect.Python.BrokerageModelPythonWrapper.Shortable | ( | IAlgorithm | algorithm, |
Symbol | symbol, | ||
decimal | quantity | ||
) |
Determine if this symbol is shortable
algorithm | The algorithm running |
symbol | The symbol to short |
quantity | The amount to short |
Definition at line 243 of file BrokerageModelPythonWrapper.cs.
IBuyingPowerModel QuantConnect.Python.BrokerageModelPythonWrapper.GetBuyingPowerModel | ( | Security | security | ) |
Gets a new buying power model for the security, returning the default model with the security's configured leverage. For cash accounts, leverage = 1 is used.
security | The security to get a buying power model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 254 of file BrokerageModelPythonWrapper.cs.
IBuyingPowerModel QuantConnect.Python.BrokerageModelPythonWrapper.GetBuyingPowerModel | ( | Security | security, |
AccountType | accountType | ||
) |
Gets a new buying power model for the security
security | The security to get a buying power model for |
accountType | The account type |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 267 of file BrokerageModelPythonWrapper.cs.
IShortableProvider QuantConnect.Python.BrokerageModelPythonWrapper.GetShortableProvider | ( | Security | security | ) |
Gets the shortable provider
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 276 of file BrokerageModelPythonWrapper.cs.
IBrokerageModel QuantConnect.Python.BrokerageModelPythonWrapper.GetModel | ( | ) |
Convenience method to get the underlying IBrokerageModel object from the wrapper.
Definition at line 286 of file BrokerageModelPythonWrapper.cs.
IMarginInterestRateModel QuantConnect.Python.BrokerageModelPythonWrapper.GetMarginInterestRateModel | ( | Security | security | ) |
Gets a new margin interest rate model for the security
security | The security to get a margin interest rate model for |
Implements QuantConnect.Brokerages.IBrokerageModel.
Definition at line 299 of file BrokerageModelPythonWrapper.cs.
|
get |
Gets or sets the account type used by this model
Definition at line 50 of file BrokerageModelPythonWrapper.cs.
|
get |
Gets the brokerages model percentage factor used to determine the required unused buying power for the account. From 1 to 0. Example: 0 means no unused buying power is required. 0.5 means 50% of the buying power should be left unused.
Definition at line 62 of file BrokerageModelPythonWrapper.cs.
|
get |
Gets a map of the default markets to be used for each security type
Definition at line 73 of file BrokerageModelPythonWrapper.cs.