Class: IGMarkets::Instrument::OpeningHours

Inherits:
Model
  • Object
show all
Defined in:
lib/ig_markets/instrument.rb

Overview

Contains details on the opening hours for an instrument. Returned by #opening_hours.

Instance Attribute Summary

Attributes inherited from Model

#attributes

Class Method Summary collapse

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

Class Method Details

.adjusted_api_attributes(attributes) ⇒ Hash

This method is used by DealingPlatform#instantiate_models to work around a vagary in the IG API where there is a seemingly unnecessary hash for the :opening_hours value that contains a single ‘:market_times` key which is what holds the actual opening hours data.

Parameters:

  • attributes (Hash)

Returns:

  • (Hash)


42
43
44
# File 'lib/ig_markets/instrument.rb', line 42

def self.adjusted_api_attributes(attributes)
  attributes.keys == [:market_times] ? attributes[:market_times] : attributes
end

Instance Method Details

#close_timeObject

The close_time attribute.

Returns:



30
# File 'lib/ig_markets/instrument.rb', line 30

attribute :close_time

#open_timeObject

The open_time attribute.

Returns:



31
# File 'lib/ig_markets/instrument.rb', line 31

attribute :open_time