Class: IGMarkets::SprintMarketPosition

Inherits:
Model
  • Object
show all
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

#attributes

Instance Method Summary collapse

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_dateTime

The created_date attribute.

Returns:

  • (Time)

4
# File 'lib/ig_markets/sprint_market_position.rb', line 4

attribute :created_date, Time, format: '%FT%T'

#currencyString

The currency attribute.

Returns:

  • (String)

5
# File 'lib/ig_markets/sprint_market_position.rb', line 5

attribute :currency, String, regex: Regex::CURRENCY

#deal_idObject

The deal_id attribute.

Returns:

  • []


6
# File 'lib/ig_markets/sprint_market_position.rb', line 6

attribute :deal_id

#descriptionObject

The description attribute.

Returns:

  • []


7
# File 'lib/ig_markets/sprint_market_position.rb', line 7

attribute :description

#directionSymbol

The direction attribute.

Returns:

  • (Symbol)

8
# File 'lib/ig_markets/sprint_market_position.rb', line 8

attribute :direction, Symbol, allowed_values: %i[buy sell]

#epicString

The epic attribute.

Returns:

  • (String)

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.

Returns:


28
29
30
# File 'lib/ig_markets/sprint_market_position.rb', line 28

def expired?
  expiry_time < Time.now
end

#expiry_timeTime

The expiry_time attribute.

Returns:

  • (Time)

10
# File 'lib/ig_markets/sprint_market_position.rb', line 10

attribute :expiry_time, Time, format: '%FT%T'

#instrument_nameObject

The instrument_name attribute.

Returns:

  • []


11
# File 'lib/ig_markets/sprint_market_position.rb', line 11

attribute :instrument_name

#market_statusSymbol

The market_status attribute.

Returns:

  • (Symbol)

12
# File 'lib/ig_markets/sprint_market_position.rb', line 12

attribute :market_status, Symbol, allowed_values: Market::Snapshot.allowed_values(:market_status)

#payout_amountFloat

The payout_amount attribute.

Returns:

  • (Float)

13
# File 'lib/ig_markets/sprint_market_position.rb', line 13

attribute :payout_amount, Float

#seconds_till_expiryInteger

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.

Returns:

  • (Integer)

21
22
23
# File 'lib/ig_markets/sprint_market_position.rb', line 21

def seconds_till_expiry
  (expiry_time - Time.now).to_i
end

#sizeFloat

The size attribute.

Returns:

  • (Float)

14
# File 'lib/ig_markets/sprint_market_position.rb', line 14

attribute :size, Float

#strike_levelFloat

The strike_level attribute.

Returns:

  • (Float)

15
# File 'lib/ig_markets/sprint_market_position.rb', line 15

attribute :strike_level, Float