Skip to content

📦 SQA::Portfolio::Position

Description

Represents a single position in the portfolio

Source Information

Defined in: lib/sqa/portfolio.rb:11

Inherits from: Struct

🔨 Instance Methods

#ticker=(value)

Sets the attribute ticker

Parameters

Name Type Description
value Object the value to set the attribute ticker to.

Returns

Type: Object

the newly set value

Source Location

lib/sqa/portfolio.rb:11


#ticker()

Returns the value of attribute ticker

Returns

Type: Object

the current value of ticker

Source Location

lib/sqa/portfolio.rb:11


#shares=(value)

Sets the attribute shares

Parameters

Name Type Description
value Object the value to set the attribute shares to.

Returns

Type: Object

the newly set value

Source Location

lib/sqa/portfolio.rb:11


#shares()

Returns the value of attribute shares

Returns

Type: Object

the current value of shares

Source Location

lib/sqa/portfolio.rb:11


#avg_cost=(value)

Sets the attribute avg_cost

Parameters

Name Type Description
value Object the value to set the attribute avg_cost to.

Returns

Type: Object

the newly set value

Source Location

lib/sqa/portfolio.rb:11


#avg_cost()

Returns the value of attribute avg_cost

Returns

Type: Object

the current value of avg_cost

Source Location

lib/sqa/portfolio.rb:11


#total_cost=(value)

Sets the attribute total_cost

Parameters

Name Type Description
value Object the value to set the attribute total_cost to.

Returns

Type: Object

the newly set value

Source Location

lib/sqa/portfolio.rb:11


#total_cost()

Returns the value of attribute total_cost

Returns

Type: Object

the current value of total_cost

Source Location

lib/sqa/portfolio.rb:11


#value(current_price)

Source Location

lib/sqa/portfolio.rb:12


#profit_loss(current_price)

Source Location

lib/sqa/portfolio.rb:16


#profit_loss_percent(current_price)

Source Location

lib/sqa/portfolio.rb:20


📝 Attributes

🔄 ticker read/write

Returns the value of attribute ticker

🔄 shares read/write

Returns the value of attribute shares

🔄 avg_cost read/write

Returns the value of attribute avg_cost

🔄 total_cost read/write

Returns the value of attribute total_cost