Class: IGMarkets::Watchlist
Overview
Contains details on a watchlist. Returned by DealingPlatform::WatchlistMethods#all and DealingPlatform::WatchlistMethods#[].
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#add_market(epic) ⇒ Object
Adds a market to this watchlist.
-
#default_system_watchlist ⇒ Boolean
The default_system_watchlist attribute.
-
#delete ⇒ Object
Deletes this watchlist.
-
#deleteable ⇒ Boolean
The deleteable attribute.
-
#editable ⇒ Boolean
The editable attribute.
-
#id ⇒ Object
The id attribute.
-
#markets ⇒ Array<MarketOverview>
Returns the markets for this watchlist.
-
#name ⇒ Object
The name attribute.
-
#remove_market(epic) ⇒ Object
Removes a market from this watchlist.
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
#add_market(epic) ⇒ Object
Adds a market to this watchlist.
28 29 30 |
# File 'lib/ig_markets/watchlist.rb', line 28 def add_market(epic) @dealing_platform.session.put "watchlists/#{id}", epic: epic end |
#default_system_watchlist ⇒ Boolean
The default_system_watchlist attribute.
5 |
# File 'lib/ig_markets/watchlist.rb', line 5 attribute :default_system_watchlist, Boolean |
#delete ⇒ Object
Deletes this watchlist.
21 22 23 |
# File 'lib/ig_markets/watchlist.rb', line 21 def delete @dealing_platform.session.delete "watchlists/#{id}" end |
#deleteable ⇒ Boolean
The deleteable attribute.
6 |
# File 'lib/ig_markets/watchlist.rb', line 6 attribute :deleteable, Boolean |
#editable ⇒ Boolean
The editable attribute.
7 |
# File 'lib/ig_markets/watchlist.rb', line 7 attribute :editable, Boolean |
#id ⇒ Object
The id attribute.
8 |
# File 'lib/ig_markets/watchlist.rb', line 8 attribute :id |
#markets ⇒ Array<MarketOverview>
Returns the markets for this watchlist.
14 15 16 17 18 |
# File 'lib/ig_markets/watchlist.rb', line 14 def markets result = @dealing_platform.session.get("watchlists/#{id}").fetch :markets @dealing_platform.instantiate_models MarketOverview, result end |
#name ⇒ Object
The name attribute.
9 |
# File 'lib/ig_markets/watchlist.rb', line 9 attribute :name |
#remove_market(epic) ⇒ Object
Removes a market from this watchlist.
35 36 37 |
# File 'lib/ig_markets/watchlist.rb', line 35 def remove_market(epic) @dealing_platform.session.delete "watchlists/#{id}/#{epic}" end |