Class: IGMarkets::DealingPlatform::ClientSentimentMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/ig_markets/dealing_platform/client_sentiment_methods.rb

Overview

Provides methods for working with client sentiment. Returned by #client_sentiment.

Instance Method Summary collapse

Constructor Details

#initialize(dealing_platform) ⇒ ClientSentimentMethods

Initializes this helper class with the specified dealing platform.

Parameters:



8
9
10
# File 'lib/ig_markets/dealing_platform/client_sentiment_methods.rb', line 8

def initialize(dealing_platform)
  @dealing_platform = dealing_platform
end

Instance Method Details

#[](market_id) ⇒ ClientSentiment

Returns the client sentiment for a market.

Parameters:

  • market_id (String)

    The ID of the market to return client sentiment for.

Returns:



17
18
19
20
21
22
23
# File 'lib/ig_markets/dealing_platform/client_sentiment_methods.rb', line 17

def [](market_id)
  result = @dealing_platform.session.get "clientsentiment/#{market_id}", API_V1

  ClientSentiment.from(result).tap do |client_sentiment|
    client_sentiment.instance_variable_set :@dealing_platform, @dealing_platform
  end
end