Lean  $LEAN_TAG$
QuantConnect.Statistics.TradeBuilder Class Reference

The TradeBuilder class generates trades from executions and market price updates More...

Inheritance diagram for QuantConnect.Statistics.TradeBuilder:
[legend]

Public Member Functions

 TradeBuilder (FillGroupingMethod groupingMethod, FillMatchingMethod matchingMethod)
 Initializes a new instance of the TradeBuilder class More...
 
void SetLiveMode (bool live)
 Sets the live mode flag More...
 
void SetSecurityManager (SecurityManager securities)
 Sets the security manager instance More...
 
bool HasOpenPosition (Symbol symbol)
 Returns true if there is an open position for the symbol More...
 
void SetMarketPrice (Symbol symbol, decimal price)
 Sets the current market price for the symbol More...
 
void ApplySplit (Split split, bool liveMode, DataNormalizationMode dataNormalizationMode)
 Applies a split to the trade builder More...
 
void ProcessFill (OrderEvent fill, decimal securityConversionRate, decimal feeInAccountCurrency, decimal multiplier=1.0m)
 Processes a new fill, eventually creating new trades More...
 

Properties

List< TradeClosedTrades [get]
 The list of closed trades More...
 
- Properties inherited from QuantConnect.Interfaces.ITradeBuilder
List< TradeClosedTrades [get]
 The list of closed trades More...
 

Detailed Description

The TradeBuilder class generates trades from executions and market price updates

Definition at line 30 of file TradeBuilder.cs.

Constructor & Destructor Documentation

◆ TradeBuilder()

QuantConnect.Statistics.TradeBuilder.TradeBuilder ( FillGroupingMethod  groupingMethod,
FillMatchingMethod  matchingMethod 
)

Initializes a new instance of the TradeBuilder class

Definition at line 65 of file TradeBuilder.cs.

Member Function Documentation

◆ SetLiveMode()

void QuantConnect.Statistics.TradeBuilder.SetLiveMode ( bool  live)

Sets the live mode flag

Parameters
liveThe live mode flag

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 75 of file TradeBuilder.cs.

Here is the caller graph for this function:

◆ SetSecurityManager()

void QuantConnect.Statistics.TradeBuilder.SetSecurityManager ( SecurityManager  securities)

Sets the security manager instance

Parameters
securitiesThe security manager

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 84 of file TradeBuilder.cs.

Here is the caller graph for this function:

◆ HasOpenPosition()

bool QuantConnect.Statistics.TradeBuilder.HasOpenPosition ( Symbol  symbol)

Returns true if there is an open position for the symbol

Parameters
symbolThe symbol
Returns
true if there is an open position for the symbol

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 108 of file TradeBuilder.cs.

◆ SetMarketPrice()

void QuantConnect.Statistics.TradeBuilder.SetMarketPrice ( Symbol  symbol,
decimal  price 
)

Sets the current market price for the symbol

Parameters
symbol
price

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 124 of file TradeBuilder.cs.

◆ ApplySplit()

void QuantConnect.Statistics.TradeBuilder.ApplySplit ( Split  split,
bool  liveMode,
DataNormalizationMode  dataNormalizationMode 
)

Applies a split to the trade builder

Parameters
splitThe split to be applied
liveModeTrue if live mode, false for backtest
dataNormalizationModeThe DataNormalizationMode for this security

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 141 of file TradeBuilder.cs.

◆ ProcessFill()

void QuantConnect.Statistics.TradeBuilder.ProcessFill ( OrderEvent  fill,
decimal  securityConversionRate,
decimal  feeInAccountCurrency,
decimal  multiplier = 1.0m 
)

Processes a new fill, eventually creating new trades

Parameters
fillThe new fill order event
securityConversionRateThe current security market conversion rate into the account currency
feeInAccountCurrencyThe current order fee in the account currency
multiplierThe contract multiplier

Implements QuantConnect.Interfaces.ITradeBuilder.

Definition at line 188 of file TradeBuilder.cs.

Here is the call graph for this function:

Property Documentation

◆ ClosedTrades

List<Trade> QuantConnect.Statistics.TradeBuilder.ClosedTrades
get

The list of closed trades

Definition at line 93 of file TradeBuilder.cs.


The documentation for this class was generated from the following file: