Class: IGMarkets::SprintMarketPosition
- Defined in:
- lib/ig_markets/sprint_market_position.rb
Overview
Contains details on a sprint market position. Returned by DealingPlatform::SprintMarketPositionMethods#all.
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#created_date ⇒ Time
The created_date attribute.
-
#currency ⇒ String
The currency attribute.
-
#deal_id ⇒ Object
The deal_id attribute.
-
#description ⇒ Object
The description attribute.
-
#direction ⇒ Symbol
The direction attribute.
-
#epic ⇒ String
The epic attribute.
-
#expired? ⇒ Boolean
Returns whether this sprint market position has expired.
-
#expiry_time ⇒ Time
The expiry_time attribute.
-
#instrument_name ⇒ Object
The instrument_name attribute.
-
#market_status ⇒ Symbol
The market_status attribute.
-
#payout_amount ⇒ Float
The payout_amount attribute.
-
#seconds_till_expiry ⇒ Integer
Returns the number of seconds till when this sprint market position expires.
-
#size ⇒ Float
The size attribute.
-
#strike_level ⇒ Float
The strike_level attribute.
Methods inherited from Model
#==, allowed_values, attribute, attribute_type, attribute_value_allowed?, defined_attribute_names, deprecated_attribute, #initialize, #initialize_copy, #inspect, #to_h, valid_attribute?
Constructor Details
This class inherits a constructor from IGMarkets::Model
Instance Method Details
#created_date ⇒ Time
The created_date attribute.
4 |
# File 'lib/ig_markets/sprint_market_position.rb', line 4 attribute :created_date, Time, format: '%FT%T' |
#currency ⇒ String
The currency attribute.
5 |
# File 'lib/ig_markets/sprint_market_position.rb', line 5 attribute :currency, String, regex: Regex::CURRENCY |
#deal_id ⇒ Object
The deal_id attribute.
6 |
# File 'lib/ig_markets/sprint_market_position.rb', line 6 attribute :deal_id |
#description ⇒ Object
The description attribute.
7 |
# File 'lib/ig_markets/sprint_market_position.rb', line 7 attribute :description |
#direction ⇒ Symbol
The direction attribute.
8 |
# File 'lib/ig_markets/sprint_market_position.rb', line 8 attribute :direction, Symbol, allowed_values: %i[buy sell] |
#epic ⇒ String
The epic attribute.
9 |
# File 'lib/ig_markets/sprint_market_position.rb', line 9 attribute :epic, String, regex: Regex::EPIC |
#expired? ⇒ Boolean
Returns whether this sprint market position has expired.
28 29 30 |
# File 'lib/ig_markets/sprint_market_position.rb', line 28 def expired? expiry_time < Time.now end |
#expiry_time ⇒ Time
The expiry_time attribute.
10 |
# File 'lib/ig_markets/sprint_market_position.rb', line 10 attribute :expiry_time, Time, format: '%FT%T' |
#instrument_name ⇒ Object
The instrument_name attribute.
11 |
# File 'lib/ig_markets/sprint_market_position.rb', line 11 attribute :instrument_name |
#market_status ⇒ Symbol
The market_status attribute.
12 |
# File 'lib/ig_markets/sprint_market_position.rb', line 12 attribute :market_status, Symbol, allowed_values: Market::Snapshot.allowed_values(:market_status) |
#payout_amount ⇒ Float
The payout_amount attribute.
13 |
# File 'lib/ig_markets/sprint_market_position.rb', line 13 attribute :payout_amount, Float |
#seconds_till_expiry ⇒ Integer
Returns the number of seconds till when this sprint market position expires. This will be a negative number if this sprint market position has expired.
21 22 23 |
# File 'lib/ig_markets/sprint_market_position.rb', line 21 def seconds_till_expiry (expiry_time - Time.now).to_i end |
#size ⇒ Float
The size attribute.
14 |
# File 'lib/ig_markets/sprint_market_position.rb', line 14 attribute :size, Float |
#strike_level ⇒ Float
The strike_level attribute.
15 |
# File 'lib/ig_markets/sprint_market_position.rb', line 15 attribute :strike_level, Float |