Class: SchwabRb::DataObjects::Asset
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::Asset
- Defined in:
- lib/schwab_rb/data_objects/instrument.rb
Instance Attribute Summary collapse
-
#active_contract ⇒ Object
readonly
Returns the value of attribute active_contract.
-
#asset_type ⇒ Object
readonly
Returns the value of attribute asset_type.
-
#closing_price ⇒ Object
readonly
Returns the value of attribute closing_price.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#expiration_date ⇒ Object
readonly
Returns the value of attribute expiration_date.
-
#future_type ⇒ Object
readonly
Returns the value of attribute future_type.
-
#instrument_id ⇒ Object
readonly
Returns the value of attribute instrument_id.
-
#last_trading_date ⇒ Object
readonly
Returns the value of attribute last_trading_date.
-
#multiplier ⇒ Object
readonly
Returns the value of attribute multiplier.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(asset_type: nil, status: nil, symbol: nil, instrument_id: nil, closing_price: nil, type: nil, description: nil, active_contract: nil, expiration_date: nil, last_trading_date: nil, multiplier: nil, future_type: nil) ⇒ Asset
constructor
A new instance of Asset.
- #to_h ⇒ Object
Constructor Details
#initialize(asset_type: nil, status: nil, symbol: nil, instrument_id: nil, closing_price: nil, type: nil, description: nil, active_contract: nil, expiration_date: nil, last_trading_date: nil, multiplier: nil, future_type: nil) ⇒ Asset
Returns a new instance of Asset.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 26 def initialize( asset_type: nil, status: nil, symbol: nil, instrument_id: nil, closing_price: nil, type: nil, description: nil, active_contract: nil, expiration_date: nil, last_trading_date: nil, multiplier: nil, future_type: nil ) @asset_type = asset_type @status = status @symbol = symbol @instrument_id = instrument_id @closing_price = closing_price @type = type @description = description @active_contract = active_contract @expiration_date = expiration_date @last_trading_date = last_trading_date @multiplier = multiplier @future_type = future_type end |
Instance Attribute Details
#active_contract ⇒ Object (readonly)
Returns the value of attribute active_contract.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def active_contract @active_contract end |
#asset_type ⇒ Object (readonly)
Returns the value of attribute asset_type.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def asset_type @asset_type end |
#closing_price ⇒ Object (readonly)
Returns the value of attribute closing_price.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def closing_price @closing_price end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def description @description end |
#expiration_date ⇒ Object (readonly)
Returns the value of attribute expiration_date.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def expiration_date @expiration_date end |
#future_type ⇒ Object (readonly)
Returns the value of attribute future_type.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def future_type @future_type end |
#instrument_id ⇒ Object (readonly)
Returns the value of attribute instrument_id.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def instrument_id @instrument_id end |
#last_trading_date ⇒ Object (readonly)
Returns the value of attribute last_trading_date.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def last_trading_date @last_trading_date end |
#multiplier ⇒ Object (readonly)
Returns the value of attribute multiplier.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def multiplier @multiplier end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def status @status end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def symbol @symbol end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 6 def type @type end |
Class Method Details
.build(data) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 9 def self.build(data) new( asset_type: data.fetch(:assetType, nil), status: data.fetch(:status, nil), symbol: data.fetch(:symbol, nil), instrument_id: data.fetch(:instrumentId, nil), closing_price: data.fetch(:closingPrice, nil), type: data.fetch(:type, nil), description: data.fetch(:description, nil), active_contract: data.fetch(:activeContract, nil), expiration_date: data.fetch(:expirationDate, nil), last_trading_date: data.fetch(:lastTradingDate, nil), multiplier: data.fetch(:multiplier, nil), future_type: data.fetch(:futureType, nil) ) end |
Instance Method Details
#to_h ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/schwab_rb/data_objects/instrument.rb', line 43 def to_h { assetType: @asset_type, status: @status, symbol: @symbol, instrumentId: @instrument_id, closingPrice: @closing_price, type: @type, description: @description, activeContract: @active_contract, expirationDate: @expiration_date, lastTradingDate: @last_trading_date, multiplier: @multiplier, futureType: @future_type }.compact end |