Class: IGMarkets::ClientSentiment
- 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
Instance Method Summary collapse
-
#long_position_percentage ⇒ Float
The long_position_percentage attribute.
-
#market_id ⇒ Object
The market_id attribute.
-
#related_sentiments ⇒ Array<ClientSentiment>
Returns client sentiments for markets that are related to this one.
-
#reload ⇒ Object
Reloads this client sentiment’s attributes by re-querying the IG Markets API.
-
#short_position_percentage ⇒ Float
The short_position_percentage 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
#long_position_percentage ⇒ Float
The long_position_percentage attribute.
5 |
# File 'lib/ig_markets/client_sentiment.rb', line 5 attribute :long_position_percentage, Float |
#market_id ⇒ Object
The market_id attribute.
6 |
# File 'lib/ig_markets/client_sentiment.rb', line 6 attribute :market_id |
#related_sentiments ⇒ Array<ClientSentiment>
Returns client sentiments for markets that are related to this one.
17 18 19 20 21 |
# File 'lib/ig_markets/client_sentiment.rb', line 17 def result = @dealing_platform.session.get("clientsentiment/related/#{market_id}").fetch :client_sentiments @dealing_platform.instantiate_models ClientSentiment, result end |
#reload ⇒ Object
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_percentage ⇒ Float
The short_position_percentage attribute.
7 |
# File 'lib/ig_markets/client_sentiment.rb', line 7 attribute :short_position_percentage, Float |