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.

Returns:



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

attribute :account_alias

#account_idObject

The account_id attribute.

Returns:



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

attribute :account_id

#account_nameObject

The account_name attribute.

Returns:



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

attribute :account_name

#account_typeSymbol

The account_type attribute.

Returns:

  • (Symbol)


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

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

#balanceBalance

The balance attribute.

Returns:



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

attribute :balance, Balance

#can_transfer_fromBoolean

The can_transfer_from attribute.

Returns:



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

attribute :can_transfer_from, Boolean

#can_transfer_toBoolean

The can_transfer_to attribute.

Returns:



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

attribute :can_transfer_to, Boolean

#currencyString

The currency attribute.

Returns:

  • (String)


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

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

#preferredBoolean

The preferred attribute.

Returns:



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.

Returns:

  • (Symbol)


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

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