Class: IGMarkets::Account

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

Overview

Contains details on an IG Markets account. Returned by DealingPlatform::AccountMethods#all.

Defined Under Namespace

Classes: Balance

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

#account_aliasObject

The account_alias attribute.


12
# File 'lib/ig_markets/account.rb', line 12

attribute :account_alias

#account_idObject

The account_id attribute.


13
# File 'lib/ig_markets/account.rb', line 13

attribute :account_id

#account_nameObject

The account_name attribute.


14
# File 'lib/ig_markets/account.rb', line 14

attribute :account_name

#account_typeSymbol

The account_type attribute.


15
# File 'lib/ig_markets/account.rb', line 15

attribute :account_type, Symbol, allowed_values: %i[cfd physical spreadbet]

#balanceBalance

The balance attribute.


16
# File 'lib/ig_markets/account.rb', line 16

attribute :balance, Balance

#can_transfer_fromBoolean

The can_transfer_from attribute.


17
# File 'lib/ig_markets/account.rb', line 17

attribute :can_transfer_from, Boolean

#can_transfer_toBoolean

The can_transfer_to attribute.


18
# File 'lib/ig_markets/account.rb', line 18

attribute :can_transfer_to, Boolean

#currencyString

The currency attribute.


19
# File 'lib/ig_markets/account.rb', line 19

attribute :currency, String, regex: Regex::CURRENCY

#preferredBoolean

The preferred attribute.


20
# File 'lib/ig_markets/account.rb', line 20

attribute :preferred, Boolean

#reloadObject

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


24
25
26
# File 'lib/ig_markets/account.rb', line 24

def reload
  self.attributes = @dealing_platform..all.detect { |a| a. ==  }.attributes
end

#statusSymbol

The status attribute.


21
# File 'lib/ig_markets/account.rb', line 21

attribute :status, Symbol, allowed_values: %i[disabled enabled suspended_from_dealing]