Class: IGMarkets::ClientSentiment

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

Overview

Contains details on client sentiment for a single market. Returned by DealingPlatform::ClientSentimentMethods#[] and #related_sentiments.

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

#long_position_percentageFloat

The long_position_percentage attribute.

Returns:

  • (Float)

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

attribute :long_position_percentage, Float

#market_idObject

The market_id attribute.

Returns:

  • []


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

attribute :market_id

Returns client sentiments for markets that are related to this one.

Returns:


17
18
19
20
21
# File 'lib/ig_markets/client_sentiment.rb', line 17

def related_sentiments
  result = @dealing_platform.session.get("clientsentiment/related/#{market_id}").fetch :client_sentiments

  @dealing_platform.instantiate_models ClientSentiment, result
end

#reloadObject

Reloads this client sentiment's attributes by re-querying the IG Markets API.


10
11
12
# File 'lib/ig_markets/client_sentiment.rb', line 10

def reload
  self.attributes = @dealing_platform.client_sentiment[market_id].attributes
end

#short_position_percentageFloat

The short_position_percentage attribute.

Returns:

  • (Float)

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

attribute :short_position_percentage, Float