Class: Alpaca::Trade::Api::Position
- Inherits:
-
Object
- Object
- Alpaca::Trade::Api::Position
- Defined in:
- lib/alpaca/trade/api/position.rb
Instance Attribute Summary collapse
-
#asset_class ⇒ Object
readonly
Returns the value of attribute asset_class.
-
#asset_id ⇒ Object
readonly
Returns the value of attribute asset_id.
-
#avg_entry_price ⇒ Object
readonly
Returns the value of attribute avg_entry_price.
-
#change_today ⇒ Object
readonly
Returns the value of attribute change_today.
-
#cost_basis ⇒ Object
readonly
Returns the value of attribute cost_basis.
-
#current_price ⇒ Object
readonly
Returns the value of attribute current_price.
-
#exchange ⇒ Object
readonly
Returns the value of attribute exchange.
-
#lastday_price ⇒ Object
readonly
Returns the value of attribute lastday_price.
-
#market_value ⇒ Object
readonly
Returns the value of attribute market_value.
-
#qty ⇒ Object
readonly
Returns the value of attribute qty.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#unrealized_intraday_pl ⇒ Object
readonly
Returns the value of attribute unrealized_intraday_pl.
-
#unrealized_intraday_plpc ⇒ Object
readonly
Returns the value of attribute unrealized_intraday_plpc.
-
#unrealized_pl ⇒ Object
readonly
Returns the value of attribute unrealized_pl.
-
#unrealized_plpc ⇒ Object
readonly
Returns the value of attribute unrealized_plpc.
Instance Method Summary collapse
-
#initialize(json) ⇒ Position
constructor
A new instance of Position.
Constructor Details
#initialize(json) ⇒ Position
Returns a new instance of Position.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/alpaca/trade/api/position.rb', line 12 def initialize(json) @asset_id = json['asset_id'] @symbol = json['symbol'] @exchange = json['exchange'] @asset_class = json['asset_class'] @avg_entry_price = json['avg_entry_price'] @qty = json['qty'] @side = json['side'] @market_value = json['market_value'] @cost_basis = json['cost_basis'] @unrealized_pl = json['unrealized_pl'] @unrealized_plpc = json['unrealized_plpc'] @unrealized_intraday_pl = json['unrealized_intraday_pl'] @unrealized_intraday_plpc = json['unrealized_intraday_plpc'] @current_price = json['current_price'] @lastday_price = json['lastday_price'] @change_today = json['change_today'] end |
Instance Attribute Details
#asset_class ⇒ Object (readonly)
Returns the value of attribute asset_class.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def asset_class @asset_class end |
#asset_id ⇒ Object (readonly)
Returns the value of attribute asset_id.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def asset_id @asset_id end |
#avg_entry_price ⇒ Object (readonly)
Returns the value of attribute avg_entry_price.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def avg_entry_price @avg_entry_price end |
#change_today ⇒ Object (readonly)
Returns the value of attribute change_today.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def change_today @change_today end |
#cost_basis ⇒ Object (readonly)
Returns the value of attribute cost_basis.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def cost_basis @cost_basis end |
#current_price ⇒ Object (readonly)
Returns the value of attribute current_price.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def current_price @current_price end |
#exchange ⇒ Object (readonly)
Returns the value of attribute exchange.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def exchange @exchange end |
#lastday_price ⇒ Object (readonly)
Returns the value of attribute lastday_price.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def lastday_price @lastday_price end |
#market_value ⇒ Object (readonly)
Returns the value of attribute market_value.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def market_value @market_value end |
#qty ⇒ Object (readonly)
Returns the value of attribute qty.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def qty @qty end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def side @side end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def symbol @symbol end |
#unrealized_intraday_pl ⇒ Object (readonly)
Returns the value of attribute unrealized_intraday_pl.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def unrealized_intraday_pl @unrealized_intraday_pl end |
#unrealized_intraday_plpc ⇒ Object (readonly)
Returns the value of attribute unrealized_intraday_plpc.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def unrealized_intraday_plpc @unrealized_intraday_plpc end |
#unrealized_pl ⇒ Object (readonly)
Returns the value of attribute unrealized_pl.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def unrealized_pl @unrealized_pl end |
#unrealized_plpc ⇒ Object (readonly)
Returns the value of attribute unrealized_plpc.
7 8 9 |
# File 'lib/alpaca/trade/api/position.rb', line 7 def unrealized_plpc @unrealized_plpc end |