Lean
$LEAN_TAG$
|
SecurityHolding is a base class for purchasing and holding a market item which manages the asset portfolio More...
Public Member Functions | |
SecurityHolding (Security security, ICurrencyConverter currencyConverter) | |
Create a new holding class instance setting the initial properties to $0. More... | |
void | AddNewFee (decimal newFee) |
Adds a fee to the running total of total fees in units of the account's currency. More... | |
void | AddNewProfit (decimal profitLoss) |
Adds a profit record to the running total of profit in units of the account's currency. More... | |
void | AddNewSale (decimal saleValue) |
Adds a new sale value to the running total trading volume in units of the account's currency. More... | |
void | AddNewDividend (decimal dividend) |
Adds a new dividend payment to the running total dividend in units of the account's currency. More... | |
void | SetLastTradeProfit (decimal lastTradeProfit) |
Set the last trade profit for this security from a Portfolio.ProcessFill call in units of the account's currency. More... | |
virtual void | SetHoldings (decimal averagePrice, int quantity) |
Set the quantity of holdings and their average price after processing a portfolio fill. More... | |
virtual void | SetHoldings (decimal averagePrice, decimal quantity) |
Set the quantity of holdings and their average price after processing a portfolio fill. More... | |
virtual void | UpdateMarketPrice (decimal closingPrice) |
Update local copy of closing price value. More... | |
virtual ConvertibleCashAmount | GetQuantityValue (decimal quantity) |
Gets the total value of the specified quantity of shares of this security in the account currency More... | |
virtual ConvertibleCashAmount | GetQuantityValue (decimal quantity, decimal price) |
Gets the total value of the specified quantity of shares of this security in the account currency More... | |
virtual decimal | TotalCloseProfit (bool includeFees=true, decimal? exitPrice=null, decimal? entryPrice=null, decimal? quantity=null) |
Profit if we closed the holdings right now including the approximate fees in units of the account's currency. More... | |
override string | ToString () |
Writes out the properties of this instance to string More... | |
Public Attributes | |
virtual bool | HoldStock => _invested |
Boolean flag indicating if we hold any of the security More... | |
virtual bool | Invested => _invested |
Boolean flag indicating if we hold any of the security More... | |
Protected Member Functions | |
SecurityHolding (SecurityHolding holding) | |
Create a new holding class instance copying the initial properties More... | |
virtual void | OnQuantityChanged (decimal previousAveragePrice, decimal previousQuantity) |
Event invocator for the QuantityChanged event More... | |
Properties | |
Security | Security [get] |
The security being held More... | |
IPortfolioTarget | Target [get, set] |
Gets the current target holdings for this security More... | |
decimal | AveragePrice [get, protected set] |
Average price of the security holdings. More... | |
decimal | Quantity [get, protected set] |
Quantity of the security held. More... | |
Symbol | Symbol [get] |
Symbol identifier of the underlying security. More... | |
SecurityType | Type [get] |
The security type of the symbol More... | |
virtual decimal | Leverage [get] |
Leverage of the underlying security. More... | |
virtual decimal | HoldingsCost [get] |
Acquisition cost of the security total holdings in units of the account's currency. More... | |
virtual decimal | UnleveredHoldingsCost [get] |
Unlevered Acquisition cost of the security total holdings in units of the account's currency. More... | |
virtual decimal | Price [get, protected set] |
Current market price of the security. More... | |
virtual decimal | AbsoluteHoldingsCost [get] |
Absolute holdings cost for current holdings in units of the account's currency. More... | |
virtual decimal | UnleveredAbsoluteHoldingsCost [get] |
Unlevered absolute acquisition cost of the security total holdings in units of the account's currency. More... | |
virtual decimal | HoldingsValue [get] |
Market value of our holdings in units of the account's currency. More... | |
virtual decimal | AbsoluteHoldingsValue [get] |
Absolute of the market value of our holdings in units of the account's currency. More... | |
virtual decimal | TotalSaleVolume [get] |
The total transaction volume for this security since the algorithm started in units of the account's currency. More... | |
virtual decimal | TotalFees [get] |
Total fees for this company since the algorithm started in units of the account's currency. More... | |
virtual decimal | TotalDividends [get] |
Total dividends for this company since the algorithm started in units of the account's currency. More... | |
virtual bool | IsLong [get] |
Boolean flag indicating we have a net positive holding of the security. More... | |
virtual bool | IsShort [get] |
BBoolean flag indicating we have a net negative holding of the security. More... | |
virtual decimal | AbsoluteQuantity [get] |
Absolute quantity of holdings of this security More... | |
virtual decimal | LastTradeProfit [get] |
Record of the closing profit from the last trade conducted in units of the account's currency. More... | |
virtual decimal | Profit [get] |
Calculate the total profit for this security in units of the account's currency. More... | |
virtual decimal | NetProfit [get] |
Return the net for this company measured by the profit less fees in units of the account's currency. More... | |
virtual decimal | UnrealizedProfitPercent [get] |
Gets the unrealized profit as a percentage of holdings cost More... | |
virtual decimal | UnrealizedProfit [get] |
Unrealized profit of this security when absolute quantity held is more than zero in units of the account's currency. More... | |
Events | |
EventHandler< SecurityHoldingQuantityChangedEventArgs > | QuantityChanged |
Event raised each time the holdings quantity is changed. More... | |
SecurityHolding is a base class for purchasing and holding a market item which manages the asset portfolio
Definition at line 26 of file SecurityHolding.cs.
QuantConnect.Securities.SecurityHolding.SecurityHolding | ( | Security | security, |
ICurrencyConverter | currencyConverter | ||
) |
Create a new holding class instance setting the initial properties to $0.
security | The security being held |
currencyConverter | A currency converter instance |
Definition at line 51 of file SecurityHolding.cs.
|
protected |
Create a new holding class instance copying the initial properties
holding | The security being held |
Definition at line 64 of file SecurityHolding.cs.
void QuantConnect.Securities.SecurityHolding.AddNewFee | ( | decimal | newFee | ) |
Adds a fee to the running total of total fees in units of the account's currency.
newFee |
Definition at line 379 of file SecurityHolding.cs.
void QuantConnect.Securities.SecurityHolding.AddNewProfit | ( | decimal | profitLoss | ) |
Adds a profit record to the running total of profit in units of the account's currency.
profitLoss | The cash change in portfolio from closing a position |
Definition at line 388 of file SecurityHolding.cs.
void QuantConnect.Securities.SecurityHolding.AddNewSale | ( | decimal | saleValue | ) |
Adds a new sale value to the running total trading volume in units of the account's currency.
saleValue |
Definition at line 397 of file SecurityHolding.cs.
void QuantConnect.Securities.SecurityHolding.AddNewDividend | ( | decimal | dividend | ) |
Adds a new dividend payment to the running total dividend in units of the account's currency.
dividend |
Definition at line 406 of file SecurityHolding.cs.
void QuantConnect.Securities.SecurityHolding.SetLastTradeProfit | ( | decimal | lastTradeProfit | ) |
Set the last trade profit for this security from a Portfolio.ProcessFill call in units of the account's currency.
lastTradeProfit | Value of the last trade profit |
Definition at line 415 of file SecurityHolding.cs.
|
virtual |
Set the quantity of holdings and their average price after processing a portfolio fill.
Definition at line 423 of file SecurityHolding.cs.
|
virtual |
Set the quantity of holdings and their average price after processing a portfolio fill.
Definition at line 431 of file SecurityHolding.cs.
|
virtual |
Update local copy of closing price value.
closingPrice | Price of the underlying asset to be used for calculating market price / portfolio value |
Definition at line 446 of file SecurityHolding.cs.
|
virtual |
Gets the total value of the specified quantity of shares of this security in the account currency
quantity | The quantity of shares |
Definition at line 457 of file SecurityHolding.cs.
|
virtual |
Gets the total value of the specified quantity of shares of this security in the account currency
quantity | The quantity of shares |
price | The current price |
Reimplemented in QuantConnect.Securities.CryptoFuture.CryptoFutureHolding.
Definition at line 469 of file SecurityHolding.cs.
|
virtual |
Profit if we closed the holdings right now including the approximate fees in units of the account's currency.
Does not use the transaction model for market fills but should.
Definition at line 479 of file SecurityHolding.cs.
override string QuantConnect.Securities.SecurityHolding.ToString | ( | ) |
Writes out the properties of this instance to string
Definition at line 512 of file SecurityHolding.cs.
|
protectedvirtual |
Event invocator for the QuantityChanged event
Definition at line 520 of file SecurityHolding.cs.
virtual bool QuantConnect.Securities.SecurityHolding.HoldStock => _invested |
Boolean flag indicating if we hold any of the security
Definition at line 253 of file SecurityHolding.cs.
virtual bool QuantConnect.Securities.SecurityHolding.Invested => _invested |
Boolean flag indicating if we hold any of the security
Alias of HoldStock
Definition at line 260 of file SecurityHolding.cs.
|
getprotected |
The security being held
Definition at line 81 of file SecurityHolding.cs.
|
getset |
Gets the current target holdings for this security
Definition at line 92 of file SecurityHolding.cs.
|
getprotected set |
Average price of the security holdings.
Definition at line 100 of file SecurityHolding.cs.
|
getprotected set |
Quantity of the security held.
Positive indicates long holdings, negative quantity indicates a short holding
Definition at line 117 of file SecurityHolding.cs.
|
get |
Symbol identifier of the underlying security.
Definition at line 135 of file SecurityHolding.cs.
|
get |
The security type of the symbol
Definition at line 146 of file SecurityHolding.cs.
|
get |
Leverage of the underlying security.
Definition at line 157 of file SecurityHolding.cs.
|
get |
Acquisition cost of the security total holdings in units of the account's currency.
Definition at line 168 of file SecurityHolding.cs.
|
get |
Unlevered Acquisition cost of the security total holdings in units of the account's currency.
Definition at line 183 of file SecurityHolding.cs.
|
getprotected set |
Current market price of the security.
Definition at line 191 of file SecurityHolding.cs.
|
get |
Absolute holdings cost for current holdings in units of the account's currency.
Definition at line 207 of file SecurityHolding.cs.
|
get |
Unlevered absolute acquisition cost of the security total holdings in units of the account's currency.
Definition at line 218 of file SecurityHolding.cs.
|
get |
Market value of our holdings in units of the account's currency.
Definition at line 229 of file SecurityHolding.cs.
|
get |
Absolute of the market value of our holdings in units of the account's currency.
Definition at line 246 of file SecurityHolding.cs.
|
get |
The total transaction volume for this security since the algorithm started in units of the account's currency.
Definition at line 266 of file SecurityHolding.cs.
|
get |
Total fees for this company since the algorithm started in units of the account's currency.
Definition at line 274 of file SecurityHolding.cs.
|
get |
Total dividends for this company since the algorithm started in units of the account's currency.
Definition at line 282 of file SecurityHolding.cs.
|
get |
Boolean flag indicating we have a net positive holding of the security.
Definition at line 291 of file SecurityHolding.cs.
|
get |
BBoolean flag indicating we have a net negative holding of the security.
Definition at line 303 of file SecurityHolding.cs.
|
get |
Absolute quantity of holdings of this security
Definition at line 315 of file SecurityHolding.cs.
|
get |
Record of the closing profit from the last trade conducted in units of the account's currency.
Definition at line 326 of file SecurityHolding.cs.
|
get |
Calculate the total profit for this security in units of the account's currency.
Definition at line 338 of file SecurityHolding.cs.
|
get |
Return the net for this company measured by the profit less fees in units of the account's currency.
Definition at line 348 of file SecurityHolding.cs.
|
get |
Gets the unrealized profit as a percentage of holdings cost
Definition at line 359 of file SecurityHolding.cs.
|
get |
Unrealized profit of this security when absolute quantity held is more than zero in units of the account's currency.
Definition at line 371 of file SecurityHolding.cs.
EventHandler<SecurityHoldingQuantityChangedEventArgs> QuantConnect.Securities.SecurityHolding.QuantityChanged |
Event raised each time the holdings quantity is changed.
Definition at line 31 of file SecurityHolding.cs.