Skip to content

PortfolioItem

Thiago W. Alves edited this page Mar 18, 2019 · 6 revisions

Constructors:

Member Functions:


PortfolioItem(symbol, long_shares, short_shares, long_price, short_price, realized_pl)

Parameters

  • symbol : str

    Symbol of the portfolio item.

  • long_shares : int

    Amount of long shares in the portfolio item.

  • short_shares : int

    Amount of short shares in the portfolio item.

  • long_price : float

    Average price of the long shares of the portfolio item.

  • short_price : float

    Average price of the short shares of the portfolio item.

  • realized_pl : float

    Realized P&L of the portfolio item.

Return Value

None


getSymbol()

This method returns the symbol of the portfolio item.

Parameters

NA

Return Value

str : Symbol of the portfolio item.


getShares()

This method returns the amount of shares one has in the portfolio item.

Parameters

NA

Return Value

int : Amount of shares in the portfolio item, summarized from both long and short shares.


getLongShares()

This method returns the amount of long shares one has in the portfolio item.

Parameters

NA

Return Value

int : Amount of long shares in the portfolio item.


getShortShares()

This method returns the amount of short shares one has in the portfolio item.

Parameters

NA

Return Value

int : Amount of short shares in the portfolio item.


getPrice()

This method returns the average price of the shares of the portfolio item.

Parameters

NA

Return Value

float : Average price of the shares of the portfolio item, summarized from both long and short shares.


getLongPrice()

This method returns the average price of the long shares of the portfolio item.

Parameters

NA

Return Value

float : Average price of the long shares of the portfolio item.


getShortPrice()

This method returns the average price of the short shares of the portfolio item.

Parameters

NA

Return Value

float : Average price of the short shares of the portfolio item.


getRealizedPL()

This method returns the realized P&L of the portfolio item.

Parameters

NA

Return Value

float : Realized P&L of the portfolio item.


getTimestamp()

This method returns the timestamp of when the portfolio item was last updated.

Parameters

NA

Return Value

datetime.datetime : Timestamp of when the portfolio item was last updated.

Clone this wiki locally