Class: IB::IncomingMessages::PortfolioValue
- Inherits:
-
AbstractMessage
- Object
- ExtremelyAbstractMessage
- AbstractMessage
- IB::IncomingMessages::PortfolioValue
- Defined in:
- lib/ib-ruby/messages.rb
Overview
AccountValue
Instance Attribute Summary collapse
-
#contract ⇒ Object
Returns the value of attribute contract.
Attributes inherited from AbstractMessage
Attributes inherited from ExtremelyAbstractMessage
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AbstractMessage
Constructor Details
This class inherits a constructor from IB::IncomingMessages::AbstractMessage
Instance Attribute Details
#contract ⇒ Object
Returns the value of attribute contract.
1152 1153 1154 |
# File 'lib/ib-ruby/messages.rb', line 1152 def contract @contract end |
Class Method Details
.message_id ⇒ Object
1154 1155 1156 |
# File 'lib/ib-ruby/messages.rb', line 1154 def self. 7 end |
Instance Method Details
#load ⇒ Object
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 |
# File 'lib/ib-ruby/messages.rb', line 1158 def load @contract = Datatypes::Contract.new autoload([:version, :int]) @contract.symbol = @socket.read_string @contract.sec_type = @socket.read_string @contract.expiry = @socket.read_string @contract.strike = @socket.read_decimal @contract.right = @socket.read_string @contract.currency = @socket.read_string @contract.local_symbol = @socket.read_string if @data[:version] >= 2 autoload([:position, :int], [:market_price, :decimal], [:market_value, :decimal]) version_load(3, [:average_cost, :decimal], [:unrealized_pnl, :decimal], [:realized_pnl, :decimal]) version_load(4, [:account_name, :string]) end |
#to_human ⇒ Object
1175 1176 1177 1178 1179 |
# File 'lib/ib-ruby/messages.rb', line 1175 def to_human "<PortfolioValue: update for #{@contract.to_human}: market price #{@data[:market_price].to_digits}; market value " + "#{@data[:market_value].to_digits}; position #{@data[:position]}; unrealized PnL #{@data[:unrealized_pnl].to_digits}; " + "realized PnL #{@data[:realized_pnl].to_digits}; account #{@data[:account_name]}>" end |