ig_markets 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +15 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +2 -0
  6. data/.travis.yml +10 -0
  7. data/.yardopts +4 -0
  8. data/Gemfile +2 -0
  9. data/LICENSE.md +25 -0
  10. data/README.md +134 -0
  11. data/ig_markets.gemspec +28 -0
  12. data/lib/ig_markets.rb +42 -0
  13. data/lib/ig_markets/account.rb +23 -0
  14. data/lib/ig_markets/account_activity.rb +24 -0
  15. data/lib/ig_markets/account_transaction.rb +49 -0
  16. data/lib/ig_markets/api_versions.rb +10 -0
  17. data/lib/ig_markets/application.rb +22 -0
  18. data/lib/ig_markets/boolean.rb +5 -0
  19. data/lib/ig_markets/client_sentiment.rb +16 -0
  20. data/lib/ig_markets/deal_confirmation.rb +41 -0
  21. data/lib/ig_markets/dealing_platform.rb +105 -0
  22. data/lib/ig_markets/dealing_platform/account_methods.rb +92 -0
  23. data/lib/ig_markets/dealing_platform/client_sentiment_methods.rb +26 -0
  24. data/lib/ig_markets/dealing_platform/market_methods.rb +59 -0
  25. data/lib/ig_markets/dealing_platform/position_methods.rb +164 -0
  26. data/lib/ig_markets/dealing_platform/sprint_market_position_methods.rb +46 -0
  27. data/lib/ig_markets/dealing_platform/watchlist_methods.rb +42 -0
  28. data/lib/ig_markets/dealing_platform/working_order_methods.rb +115 -0
  29. data/lib/ig_markets/historical_price_result.rb +33 -0
  30. data/lib/ig_markets/instrument.rb +89 -0
  31. data/lib/ig_markets/market.rb +99 -0
  32. data/lib/ig_markets/market_hierarchy_result.rb +13 -0
  33. data/lib/ig_markets/market_overview.rb +24 -0
  34. data/lib/ig_markets/model.rb +185 -0
  35. data/lib/ig_markets/password_encryptor.rb +31 -0
  36. data/lib/ig_markets/payload_formatter.rb +38 -0
  37. data/lib/ig_markets/position.rb +191 -0
  38. data/lib/ig_markets/regex.rb +10 -0
  39. data/lib/ig_markets/request_failed_error.rb +21 -0
  40. data/lib/ig_markets/response_parser.rb +35 -0
  41. data/lib/ig_markets/session.rb +186 -0
  42. data/lib/ig_markets/sprint_market_position.rb +17 -0
  43. data/lib/ig_markets/version.rb +4 -0
  44. data/lib/ig_markets/watchlist.rb +37 -0
  45. data/lib/ig_markets/working_order.rb +68 -0
  46. data/spec/factories/ig_markets/account.rb +14 -0
  47. data/spec/factories/ig_markets/account_activity.rb +21 -0
  48. data/spec/factories/ig_markets/account_balance.rb +8 -0
  49. data/spec/factories/ig_markets/account_transaction.rb +15 -0
  50. data/spec/factories/ig_markets/application.rb +21 -0
  51. data/spec/factories/ig_markets/client_sentiment.rb +7 -0
  52. data/spec/factories/ig_markets/deal_confirmation.rb +20 -0
  53. data/spec/factories/ig_markets/historical_price_result.rb +7 -0
  54. data/spec/factories/ig_markets/historical_price_result_data_allowance.rb +7 -0
  55. data/spec/factories/ig_markets/historical_price_result_price.rb +7 -0
  56. data/spec/factories/ig_markets/historical_price_result_snapshot.rb +10 -0
  57. data/spec/factories/ig_markets/instrument.rb +32 -0
  58. data/spec/factories/ig_markets/instrument_currency.rb +9 -0
  59. data/spec/factories/ig_markets/instrument_expiry_details.rb +6 -0
  60. data/spec/factories/ig_markets/instrument_margin_deposit_band.rb +8 -0
  61. data/spec/factories/ig_markets/instrument_opening_hours.rb +6 -0
  62. data/spec/factories/ig_markets/instrument_rollover_details.rb +6 -0
  63. data/spec/factories/ig_markets/instrument_slippage_factor.rb +6 -0
  64. data/spec/factories/ig_markets/market.rb +7 -0
  65. data/spec/factories/ig_markets/market_dealing_rules.rb +11 -0
  66. data/spec/factories/ig_markets/market_dealing_rules_rule_details.rb +6 -0
  67. data/spec/factories/ig_markets/market_hierarchy_result.rb +6 -0
  68. data/spec/factories/ig_markets/market_hierarchy_result_hierarchy_node.rb +6 -0
  69. data/spec/factories/ig_markets/market_overview.rb +22 -0
  70. data/spec/factories/ig_markets/market_snapshot.rb +17 -0
  71. data/spec/factories/ig_markets/position.rb +19 -0
  72. data/spec/factories/ig_markets/sprint_market_position.rb +16 -0
  73. data/spec/factories/ig_markets/watchlist.rb +9 -0
  74. data/spec/factories/ig_markets/working_order.rb +21 -0
  75. data/spec/ig_markets/account_transaction_spec.rb +30 -0
  76. data/spec/ig_markets/dealing_platform/account_methods_spec.rb +58 -0
  77. data/spec/ig_markets/dealing_platform/client_sentiment_methods_spec.rb +29 -0
  78. data/spec/ig_markets/dealing_platform/market_methods_spec.rb +80 -0
  79. data/spec/ig_markets/dealing_platform/position_methods_spec.rb +137 -0
  80. data/spec/ig_markets/dealing_platform/sprint_market_position_methods_spec.rb +39 -0
  81. data/spec/ig_markets/dealing_platform/watchlist_methods_spec.rb +89 -0
  82. data/spec/ig_markets/dealing_platform/working_order_methods_spec.rb +120 -0
  83. data/spec/ig_markets/dealing_platform_spec.rb +40 -0
  84. data/spec/ig_markets/model_spec.rb +127 -0
  85. data/spec/ig_markets/password_encryptor_spec.rb +23 -0
  86. data/spec/ig_markets/payload_formatter_spec.rb +19 -0
  87. data/spec/ig_markets/position_spec.rb +37 -0
  88. data/spec/ig_markets/response_parser_spec.rb +13 -0
  89. data/spec/ig_markets/session_spec.rb +134 -0
  90. data/spec/spec_helper.rb +14 -0
  91. data/spec/support/factory_girl.rb +7 -0
  92. data/spec/support/random_test_order.rb +3 -0
  93. metadata +261 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f4523bb2bdfdecccd336489d894f6ea218e78624
4
+ data.tar.gz: c8b898a21868963278e30fc66cc680c167b4e2f7
5
+ SHA512:
6
+ metadata.gz: 369d69e66d370dcbd5ce69727ecd78d8b44e106de52bca60c68dedf30e0ef266d3a6d37021cae85553c2c4089a740743d07f50da7273ea211078d877e134efab
7
+ data.tar.gz: ce58fbf4ac2a67fbe02235a0d41484cca37280bf2a0082711cf70e07bf72872a80442096c6402e8e4da73fe6bfa86228030d8bb4dbbcd4d03971873a745aca78
data/.codeclimate.yml ADDED
@@ -0,0 +1,15 @@
1
+ engines:
2
+ duplication:
3
+ enabled: true
4
+ config:
5
+ languages:
6
+ - ruby
7
+ fixme:
8
+ enabled: true
9
+ rubocop:
10
+ enabled: true
11
+ ratings:
12
+ paths:
13
+ - "**.rb"
14
+ exclude_paths:
15
+ - spec/**/*
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /*.gem
2
+ *.rbc
3
+ /.bundle
4
+ /.yardoc
5
+ /coverage
6
+ /doc
7
+ /Gemfile.lock
8
+ /tmp
9
+ /vendor
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ Metrics/LineLength:
2
+ Max: 120
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+ - 2.3.0
7
+ script: bundle exec rspec
8
+ addons:
9
+ code_climate:
10
+ repo_token: 9c6f0528b1bec40e8d0426f750c9402dab6e763f7a12b7fcae343f57ccb20a33
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ --markup-provider redcarpet
3
+ --no-private
4
+ --title "IG Markets Gem"
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright © 2015-2016 Richard Viney
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the “Software”), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # Ruby IG Markets Dealing Platform Gem
2
+
3
+ [![Gem][gem-badge]][gem-link]
4
+ [![Build Status][travis-ci-badge]][travis-ci-link]
5
+ [![Test Coverage][test-coverage-badge]][test-coverage-link]
6
+ [![Code Climate][code-climate-badge]][code-climate-link]
7
+ [![Dependencies][dependencies-badge]][dependencies-link]
8
+ [![Documentation][documentation-badge]][documentation-link]
9
+ [![License][license-badge]][license-link]
10
+
11
+ Easily access the IG Markets Dealing Platform from Ruby with this gem. Written against the
12
+ [official REST API](http://labs.ig.com/rest-trading-api-reference).
13
+
14
+ Includes support for:
15
+
16
+ * Activity and transaction history
17
+ * Positions
18
+ * Sprint market positions
19
+ * Working orders
20
+ * Market navigation, searches and snapshots
21
+ * Historical prices
22
+ * Watchlists
23
+ * Client sentiment
24
+
25
+ An IG Markets production or demo trading account is needed in order to use this gem.
26
+
27
+ ## License
28
+
29
+ Licensed under the MIT license. You must read and agree to its terms to use this software.
30
+
31
+ ## Requirements
32
+
33
+ Ruby 2.0 or later.
34
+
35
+ ## Installation
36
+
37
+ Add the following to your `Gemfile`
38
+
39
+ ```ruby
40
+ gem 'ig_markets', git: 'https://github.com/rviney/ig_markets.git'
41
+ ```
42
+
43
+ Then run
44
+
45
+ ```ruby
46
+ bundle install
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ```ruby
52
+ ig = IGMarkets::DealingPlatform.new
53
+
54
+ # Session
55
+ ig.sign_in 'username', 'password', 'api_key', :demo
56
+ ig.sign_out
57
+
58
+ # Account
59
+ ig.account.all
60
+ ig.account.recent_activities 24 * 60 * 60
61
+ ig.account.recent_transactions 24 * 60 * 60
62
+ ig.account.activities_in_date_range Date.today.prev_month(2), Date.today.prev_month(1)
63
+ ig.account.transactions_in_date_range Date.today.prev_month(2), Date.today.prev_month(1)
64
+
65
+ # Dealing
66
+ ig.deal_confirmation 'deal_reference'
67
+
68
+ # Positions
69
+ ig.positions.all
70
+ ig.positions.create currency_code: 'USD', direction: :buy, epic: 'CS.D.EURUSD.CFD.IP', size: 2
71
+ ig.positions['deal_id']
72
+ ig.positions['deal_id'].profit_loss
73
+ ig.positions['deal_id'].update limit_level: 1.2, stop_level: 1.1
74
+ ig.positions['deal_id'].close
75
+
76
+ # Sprint market positions
77
+ ig.sprint_market_positions.all
78
+ ig.sprint_market_positions.create direction: :buy, epic: 'FM.D.EURUSD24.EURUSD24.IP',
79
+ expiry_period: :one_minute, size: 100
80
+
81
+ # Working orders
82
+ ig.working_orders.all
83
+ ig.working_orders.create currency_code: 'USD', direction: :buy, epic: 'CS.D.EURUSD.CFD.IP', level: 0.99,
84
+ size: 1, time_in_force: :good_till_cancelled, type: :limit
85
+ ig.working_orders['deal_id']
86
+ ig.working_orders['deal_id'].update level: 1.25, limit_distance: 50, stop_distance: 0.02
87
+ ig.working_orders['deal_id'].delete
88
+
89
+ # Markets
90
+ ig.markets.hierarchy
91
+ ig.markets.search 'EURUSD'
92
+ ig.markets['CS.D.EURUSD.CFD.IP']
93
+ ig.markets['CS.D.EURUSD.CFD.IP'].recent_prices :day, 10
94
+ ig.markets['CS.D.EURUSD.CFD.IP'].prices_in_date_range :day, Date.today.prev_month(2), Date.today.prev_month(1)
95
+
96
+ # Watchlists
97
+ ig.watchlists.all
98
+ ig.watchlists.create 'New Watchlist', 'CS.D.EURUSD.CFD.IP', 'UA.D.AAPL.CASH.IP'
99
+ ig.watchlists['watchlist_id']
100
+ ig.watchlists['watchlist_id'].markets
101
+ ig.watchlists['watchlist_id'].add_market 'CS.D.EURUSD.CFD.IP'
102
+ ig.watchlists['watchlist_id'].remove_market 'CS.D.EURUSD.CFD.IP'
103
+ ig.watchlists['watchlist_id'].delete
104
+
105
+ # Client sentiment
106
+ ig.client_sentiment['EURUSD']
107
+ ig.client_sentiment['EURUSD'].related_sentiments
108
+
109
+ # Miscellaneous
110
+ ig.applications
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ API documentation is available [here](http://www.rubydoc.info/github/rviney/ig_markets/master).
116
+
117
+ ## Contributors
118
+
119
+ Gem created by Richard Viney. All contributions welcome.
120
+
121
+ [gem-link]: https://rubygems.org/gems/ig_markets
122
+ [gem-badge]: https://badge.fury.io/rb/ig_markets.svg
123
+ [travis-ci-link]: http://travis-ci.org/rviney/ig_markets
124
+ [travis-ci-badge]: https://travis-ci.org/rviney/ig_markets.svg?branch=master
125
+ [test-coverage-link]: https://codeclimate.com/github/rviney/ig_markets/coverage
126
+ [test-coverage-badge]: https://codeclimate.com/github/rviney/ig_markets/badges/coverage.svg
127
+ [code-climate-link]: https://codeclimate.com/github/rviney/ig_markets
128
+ [code-climate-badge]: https://codeclimate.com/github/rviney/ig_markets/badges/gpa.svg
129
+ [dependencies-link]: https://gemnasium.com/rviney/ig_markets
130
+ [dependencies-badge]: https://gemnasium.com/rviney/ig_markets.svg
131
+ [documentation-link]: https://inch-ci.org/github/rviney/ig_markets
132
+ [documentation-badge]: https://inch-ci.org/github/rviney/ig_markets.svg?branch=master
133
+ [license-link]: https://github.com/rviney/ig_markets/blob/master/LICENSE.md
134
+ [license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
@@ -0,0 +1,28 @@
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'ig_markets/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'ig_markets'
6
+ s.version = IGMarkets::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.license = 'MIT'
9
+ s.summary = 'Ruby client for the IG Markets dealing platform.'
10
+ s.description = 'Ruby client for the IG Markets dealing platform.'
11
+ s.homepage = 'https://github.com/rviney/ig_markets'
12
+ s.author = 'Richard Viney'
13
+ s.email = 'richard.viney@gmail.com'
14
+ s.files = `git ls-files`.split("\n")
15
+
16
+ s.required_ruby_version = '>= 2.0'
17
+
18
+ s.add_runtime_dependency 'rest-client', '~> 1.8'
19
+
20
+ s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
21
+ s.add_development_dependency 'factory_girl', '~> 4.7'
22
+ s.add_development_dependency 'github-markup', '~> 1.4'
23
+ s.add_development_dependency 'redcarpet', '~> 3.3'
24
+ s.add_development_dependency 'rspec', '~> 3.4'
25
+ s.add_development_dependency 'rspec-mocks', '~> 3.4'
26
+ s.add_development_dependency 'rubocop', '~> 0.39'
27
+ s.add_development_dependency 'yard', '~> 0.8'
28
+ end
data/lib/ig_markets.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'base64'
2
+ require 'rest-client'
3
+
4
+ require 'ig_markets/boolean'
5
+ require 'ig_markets/model'
6
+ require 'ig_markets/regex'
7
+
8
+ require 'ig_markets/account'
9
+ require 'ig_markets/account_activity'
10
+ require 'ig_markets/account_transaction'
11
+ require 'ig_markets/api_versions'
12
+ require 'ig_markets/application'
13
+ require 'ig_markets/client_sentiment'
14
+ require 'ig_markets/deal_confirmation'
15
+ require 'ig_markets/dealing_platform'
16
+ require 'ig_markets/dealing_platform/account_methods'
17
+ require 'ig_markets/dealing_platform/client_sentiment_methods'
18
+ require 'ig_markets/dealing_platform/market_methods'
19
+ require 'ig_markets/dealing_platform/position_methods'
20
+ require 'ig_markets/dealing_platform/sprint_market_position_methods'
21
+ require 'ig_markets/dealing_platform/watchlist_methods'
22
+ require 'ig_markets/dealing_platform/working_order_methods'
23
+ require 'ig_markets/instrument'
24
+ require 'ig_markets/historical_price_result'
25
+ require 'ig_markets/market'
26
+ require 'ig_markets/market_overview'
27
+ require 'ig_markets/market_hierarchy_result'
28
+ require 'ig_markets/password_encryptor'
29
+ require 'ig_markets/payload_formatter'
30
+ require 'ig_markets/position'
31
+ require 'ig_markets/request_failed_error'
32
+ require 'ig_markets/response_parser'
33
+ require 'ig_markets/session'
34
+ require 'ig_markets/sprint_market_position'
35
+ require 'ig_markets/version'
36
+ require 'ig_markets/watchlist'
37
+ require 'ig_markets/working_order'
38
+
39
+ # This module contains all the code for the IG Markets gem. See `README.md` and the {DealingPlatform} class to get
40
+ # started with using this gem.
41
+ module IGMarkets
42
+ end
@@ -0,0 +1,23 @@
1
+ module IGMarkets
2
+ # Contains details on an IG Markets account. Returned by {DealingPlatform::AccountMethods#all}.
3
+ class Account < Model
4
+ # Contains details on the balance of an {Account}, used by {Account#balance}.
5
+ class Balance < Model
6
+ attribute :available, Float
7
+ attribute :balance, Float
8
+ attribute :deposit, Float
9
+ attribute :profit_loss, Float
10
+ end
11
+
12
+ attribute :account_alias
13
+ attribute :account_id
14
+ attribute :account_name
15
+ attribute :account_type, Symbol, allowed_values: [:cfd, :physical, :spreadbet]
16
+ attribute :balance, Balance
17
+ attribute :can_transfer_from, Boolean
18
+ attribute :can_transfer_to, Boolean
19
+ attribute :currency, String, regex: Regex::CURRENCY
20
+ attribute :preferred, Boolean
21
+ attribute :status, Symbol, allowed_values: [:disabled, :enabled, :suspended_from_dealing]
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ module IGMarkets
2
+ # Contains details on a single activity that occurred on an IG Markets account. Returned by
3
+ # {DealingPlatform::AccountMethods#activities_in_date_range} and
4
+ # {DealingPlatform::AccountMethods#recent_activities}.
5
+ class AccountActivity < Model
6
+ attribute :action_status, Symbol, allowed_values: [:accept, :reject, :manual, :not_set]
7
+ attribute :activity
8
+ attribute :activity_history_id
9
+ attribute :channel
10
+ attribute :currency
11
+ attribute :date, DateTime, format: '%d/%m/%y'
12
+ attribute :deal_id
13
+ attribute :epic, String, regex: Regex::EPIC
14
+ attribute :level, Float
15
+ attribute :limit, Float, nil_if: '-'
16
+ attribute :market_name
17
+ attribute :period, String, nil_if: '-'
18
+ attribute :result
19
+ attribute :size
20
+ attribute :stop, String, nil_if: '-'
21
+ attribute :stop_type, String, nil_if: '-', allowed_values: %w(G N T(50))
22
+ attribute :time
23
+ end
24
+ end
@@ -0,0 +1,49 @@
1
+ module IGMarkets
2
+ # Contains details on a single transaction that occurred on an IG Markets account. Returned by
3
+ # {DealingPlatform::AccountMethods#transactions_in_date_range} and
4
+ # {DealingPlatform::AccountMethods#recent_transactions}.
5
+ class AccountTransaction < Model
6
+ attribute :cash_transaction, Boolean
7
+ attribute :close_level
8
+ attribute :currency
9
+ attribute :date, DateTime, format: '%d/%m/%y'
10
+ attribute :instrument_name
11
+ attribute :open_level, String, nil_if: '-'
12
+ attribute :period, String, nil_if: '-'
13
+ attribute :profit_and_loss
14
+ attribute :reference
15
+ attribute :size, String, nil_if: '-'
16
+ attribute :transaction_type, Symbol, allowed_values: [:deal, :depo, :dividend, :exchange, :with]
17
+
18
+ # Returns whether or not this transaction was an interest payment. Interest payments can be either deposits or
19
+ # withdrawals depending on the underlying instrument and currencies involved. Interest payments are identified by
20
+ # the presence of the word `interest` in {#instrument_name}.
21
+ #
22
+ # @return [Boolean]
23
+ def interest?
24
+ [:depo, :with].include?(transaction_type) && !(instrument_name.downcase =~ /(^|[^a-z])interest([^a-z]|$)/).nil?
25
+ end
26
+
27
+ # Returns this transaction's {#profit_and_loss} as a `Float`, denominated in this transaction's {#currency}.
28
+ #
29
+ # @return [Float]
30
+ def profit_and_loss_amount
31
+ raise 'profit_and_loss does not start with the expected currency' unless profit_and_loss.start_with? currency
32
+
33
+ profit_and_loss[currency.length..-1].delete(',').to_f
34
+ end
35
+
36
+ # Returns this transaction's {#transaction_type} as a human-readable string.
37
+ #
38
+ # @return [String]
39
+ def formatted_transaction_type
40
+ {
41
+ deal: 'Deal',
42
+ depo: 'Deposit',
43
+ dividend: 'Dividend',
44
+ exchange: 'Exchange',
45
+ with: 'Withdrawal'
46
+ }.fetch transaction_type
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ module IGMarkets
2
+ # Named constant used to target version 1 of the IG Markets API.
3
+ API_V1 = 1
4
+
5
+ # Named constant used to target version 2 of the IG Markets API.
6
+ API_V2 = 2
7
+
8
+ # Named constant used to target version 3 of the IG Markets API.
9
+ API_V3 = 3
10
+ end
@@ -0,0 +1,22 @@
1
+ module IGMarkets
2
+ # Contains details on an IG Markets application configuration. Returned by {DealingPlatform#applications}.
3
+ class Application < Model
4
+ attribute :allow_equities, Boolean
5
+ attribute :allow_quote_orders, Boolean
6
+ attribute :allowance_account_historical_data, Fixnum
7
+ attribute :allowance_account_overall, Fixnum
8
+ attribute :allowance_account_trading, Fixnum
9
+ attribute :allowance_application_overall, Fixnum
10
+ attribute :api_key
11
+ attribute :client_id
12
+ attribute :concurrent_subscriptions_limit, Fixnum
13
+ attribute :created_date, DateTime, format: '%Q'
14
+ attribute :fast_markets_settlement_price_enabled, Boolean
15
+ attribute :id
16
+ attribute :name
17
+ attribute :restricted_to_self, Boolean
18
+ attribute :status, Symbol, allowed_values: [:disabled, :enabled, :revoked]
19
+ attribute :terms_accepted_date, DateTime, format: '%Q'
20
+ attribute :tier
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module IGMarkets
2
+ # Placeholder class for specifying a boolean type.
3
+ class Boolean
4
+ end
5
+ end