darwinex 1.0.0

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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +120 -0
  3. data/.rspec +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +6 -0
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +13 -0
  8. data/LICENSE +21 -0
  9. data/README.md +351 -0
  10. data/darwinex.gemspec +27 -0
  11. data/lib/darwinex/api/api.rb +83 -0
  12. data/lib/darwinex/api/error.rb +14 -0
  13. data/lib/darwinex/api/info_api.rb +142 -0
  14. data/lib/darwinex/api/invalid_credentials_error.rb +11 -0
  15. data/lib/darwinex/api/investor_account_info_api.rb +115 -0
  16. data/lib/darwinex/api/refresh_token_expired_error.rb +11 -0
  17. data/lib/darwinex/api/throttled_error.rb +11 -0
  18. data/lib/darwinex/api/token_api.rb +46 -0
  19. data/lib/darwinex/api/trading_api.rb +92 -0
  20. data/lib/darwinex/client.rb +107 -0
  21. data/lib/darwinex/config.rb +26 -0
  22. data/lib/darwinex/error.rb +9 -0
  23. data/lib/darwinex/investor_account.rb +100 -0
  24. data/lib/darwinex/product.rb +105 -0
  25. data/spec/darwinex/api/info_api_spec.rb +193 -0
  26. data/spec/darwinex/api/investor_account_info_api_spec.rb +73 -0
  27. data/spec/darwinex/api/trading_api_spec.rb +64 -0
  28. data/spec/darwinex/client_spec.rb +98 -0
  29. data/spec/darwinex/config_spec.rb +52 -0
  30. data/spec/darwinex/investor_account_spec.rb +305 -0
  31. data/spec/darwinex/product_spec.rb +200 -0
  32. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_badges/1_4_1.yml +3582 -0
  33. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_candles/when_optional_args_are_not_set/1_2_1_1.yml +41 -0
  34. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_candles/when_optional_args_are_set/1_2_2_1.yml +41 -0
  35. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_capacity/1_12_1.yml +2395 -0
  36. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_close_strategy/1_5_1.yml +1307 -0
  37. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_duration_consistency/1_6_1.yml +32223 -0
  38. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_dxscore/1_3_1.yml +41 -0
  39. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_experience/1_7_1.yml +800 -0
  40. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_losing_consistency/1_8_1.yml +16528 -0
  41. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_market_correlation/1_9_1.yml +205 -0
  42. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_monthly_divergence/1_19_1.yml +41 -0
  43. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_open_strategy/1_11_1.yml +1307 -0
  44. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_order_divergence/1_17_1.yml +123 -0
  45. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_performance/1_10_1.yml +11002 -0
  46. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_product_scores/1_21_1.yml +41 -0
  47. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_product_scores_badge/1_22_1.yml +41 -0
  48. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_product_status/1_20_1.yml +46 -0
  49. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_quotes/when_optional_args_are_not_set/1_13_1_1.yml +41 -0
  50. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_quotes/when_optional_args_are_set/1_13_2_1.yml +41 -0
  51. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_return_divergence/1_18_1.yml +654 -0
  52. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_risk_adjustment/1_14_1.yml +33330 -0
  53. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_risk_stability/1_15_1.yml +2215 -0
  54. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_get_winning_consistency/1_16_1.yml +16180 -0
  55. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_not_set/1_1_1_1.yml +41 -0
  56. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_not_set/1_1_1_2.yml +41 -0
  57. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_set/1_1_2_1.yml +41 -0
  58. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_set/1_1_2_2.yml +41 -0
  59. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_set/1_1_2_3.yml +41 -0
  60. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InfoApi/_list_products/when_optional_args_are_set/1_1_2_4.yml +41 -0
  61. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_get_investor_account/1_2_1.yml +55 -0
  62. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_get_investor_account/1_2_2.yml +55 -0
  63. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_get_performance_fees/1_8_1.yml +57 -0
  64. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_list_investor_accounts/1_1_1.yml +55 -0
  65. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_list_investor_accounts/1_1_2.yml +55 -0
  66. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_list_investor_accounts/1_1_3.yml +55 -0
  67. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_list_investor_accounts/1_1_4.yml +55 -0
  68. data/spec/fixtures/vcr_cassettes/Darwinex_Api_InvestorAccountInfoApi/_list_investor_accounts/1_1_5.yml +55 -0
  69. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_get_leverage/1_4_1.yml +43 -0
  70. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_get_leverage/1_4_2.yml +43 -0
  71. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_get_product_market_status/1_10_1.yml +43 -0
  72. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_get_product_market_status/1_10_2.yml +43 -0
  73. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_update_leverage/1_5_1.yml +43 -0
  74. data/spec/fixtures/vcr_cassettes/Darwinex_Api_TradingApi/_update_leverage/1_5_2.yml +43 -0
  75. data/spec/spec_helper.rb +109 -0
  76. metadata +223 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ac904b4f9186682cfffe024d341fe861e68c7265992ebfa8c91f59c670383e58
4
+ data.tar.gz: e996ae82564e322faaaf9d27748bf6a45d821a61a4bd77498705ce6ab0ff15d6
5
+ SHA512:
6
+ metadata.gz: 439479c7142d1bfc25954d62fd53ec3c055b654aa3be07e6d442b99f85e2b89e7a22b3708f462a5b3332690ce3b4c84f800d2c03399ec7419be1314fb097c3af
7
+ data.tar.gz: 208eb9f359cfd3439b131ba23303544b34695aefc52834e5cfbf85107515bd35de2ccc4c50fb6ffa406d9231497222a0ae50628943002aa715384fb89a492948
@@ -0,0 +1,120 @@
1
+
2
+ # Created by https://www.toptal.com/developers/gitignore/api/ruby,osx,macos,git
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=ruby,osx,macos,git
4
+
5
+ ### Git ###
6
+ # Created by git for backups. To disable backups in Git:
7
+ # $ git config --global mergetool.keepBackup false
8
+ *.orig
9
+
10
+ # Created by git when using merge tools for conflicts
11
+ *.BACKUP.*
12
+ *.BASE.*
13
+ *.LOCAL.*
14
+ *.REMOTE.*
15
+ *_BACKUP_*.txt
16
+ *_BASE_*.txt
17
+ *_LOCAL_*.txt
18
+ *_REMOTE_*.txt
19
+
20
+ ### macOS ###
21
+ # General
22
+ .DS_Store
23
+ .AppleDouble
24
+ .LSOverride
25
+
26
+ # Icon must end with two \r
27
+ Icon
28
+
29
+ # Thumbnails
30
+ ._*
31
+
32
+ # Files that might appear in the root of a volume
33
+ .DocumentRevisions-V100
34
+ .fseventsd
35
+ .Spotlight-V100
36
+ .TemporaryItems
37
+ .Trashes
38
+ .VolumeIcon.icns
39
+ .com.apple.timemachine.donotpresent
40
+
41
+ # Directories potentially created on remote AFP share
42
+ .AppleDB
43
+ .AppleDesktop
44
+ Network Trash Folder
45
+ Temporary Items
46
+ .apdisk
47
+
48
+ ### OSX ###
49
+ # General
50
+
51
+ # Icon must end with two \r
52
+
53
+ # Thumbnails
54
+
55
+ # Files that might appear in the root of a volume
56
+
57
+ # Directories potentially created on remote AFP share
58
+
59
+ ### Ruby ###
60
+ *.gem
61
+ *.rbc
62
+ /.config
63
+ /coverage/
64
+ /InstalledFiles
65
+ /pkg/
66
+ /spec/reports/
67
+ /spec/examples.txt
68
+ /test/tmp/
69
+ /test/version_tmp/
70
+ /tmp/
71
+
72
+ # Used by dotenv library to load environment variables.
73
+ # .env
74
+
75
+ # Ignore Byebug command history file.
76
+ .byebug_history
77
+
78
+ ## Specific to RubyMotion:
79
+ .dat*
80
+ .repl_history
81
+ build/
82
+ *.bridgesupport
83
+ build-iPhoneOS/
84
+ build-iPhoneSimulator/
85
+
86
+ ## Specific to RubyMotion (use of CocoaPods):
87
+ #
88
+ # We recommend against adding the Pods directory to your .gitignore. However
89
+ # you should judge for yourself, the pros and cons are mentioned at:
90
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
91
+ # vendor/Pods/
92
+
93
+ ## Documentation cache and generated files:
94
+ /.yardoc/
95
+ /_yardoc/
96
+ /doc/
97
+ /rdoc/
98
+
99
+ ## Environment normalization:
100
+ /.bundle/
101
+ /vendor/bundle
102
+ /lib/bundler/man/
103
+
104
+ # for a library or gem, you might want to ignore these files since the code is
105
+ # intended to run in multiple environments; otherwise, check them in:
106
+ Gemfile.lock
107
+ # .ruby-version
108
+ # .ruby-gemset
109
+
110
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
111
+ .rvmrc
112
+
113
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
114
+ # .rubocop-https?--*
115
+
116
+ ### Ruby Patch ###
117
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
118
+ # .rubocop-https?--*
119
+
120
+ # End of https://www.toptal.com/developers/gitignore/api/ruby,osx,macos,git
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5
4
+ - 2.6
5
+ - 2.7
6
+ script: bundle exec rspec
@@ -0,0 +1,5 @@
1
+ # Change Log
2
+
3
+ ## 1.0.0
4
+ #### 2020-09-01
5
+ - Initial release.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem 'httparty', '~> 0.18.1'
8
+
9
+ group :development, :test do
10
+ gem 'vcr', '~> 6.0'
11
+ gem 'webmock', '~> 3.8'
12
+ gem 'rspec', '~> 3.9'
13
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 James Frost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,351 @@
1
+ # Darwinex
2
+
3
+ [![Build Status](https://travis-ci.org/JamesFrost/darwinex.svg?branch=master)](https://travis-ci.org/JamesFrost/darwinex)
4
+
5
+ Ruby client for the Darwinex API.
6
+
7
+ ## Installation
8
+
9
+ ### Gemfile
10
+
11
+ ```ruby
12
+ gem 'darwinex'
13
+ ```
14
+
15
+ ### Install
16
+
17
+ ```bash
18
+ $ gem install darwinex
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Require the client:
24
+
25
+ ```ruby
26
+ require 'darwinex/client'
27
+ ```
28
+
29
+ Initialise the client:
30
+
31
+ ```ruby
32
+ client = Darwinex::Client.new(
33
+ consumer_key: "<consumer key>",
34
+ consumer_secret: "<consumer secret>"
35
+ )
36
+ ```
37
+
38
+ If you would like to use a custom logger:
39
+
40
+ ```ruby
41
+ client = Darwinex::Client.new(
42
+ consumer_key: "<consumer key>",
43
+ consumer_secret: "<consumer secret>",
44
+ logger: Logger.new(STDOUT)
45
+ )
46
+ ```
47
+
48
+ If you would like to configure the maximum number of API call retries:
49
+
50
+ ```ruby
51
+ client = Darwinex::Client.new(
52
+ consumer_key: "<consumer key>",
53
+ consumer_secret: "<consumer secret>",
54
+ max_retries: 10 # Default: 5
55
+ )
56
+ ```
57
+
58
+ Before you use the client, you must generate a new access token for the client to use:
59
+
60
+ ```ruby
61
+ resp = client.refresh_access_token("<refresh token>")
62
+
63
+ refresh_token = resp["refresh_token"]
64
+ ```
65
+
66
+ The client will now be ready for use.
67
+
68
+ You will need to persist the refresh token returned by `.refresh_access_token` - you will need it the next time you want to generate a new access token.
69
+
70
+ ## Examples
71
+
72
+ ### Investor Accounts
73
+
74
+ ```ruby
75
+ client.list_investor_accounts
76
+ ```
77
+
78
+ ```ruby
79
+ client.investor_account("<account id>")
80
+ ```
81
+
82
+ ```ruby
83
+ client.investor_account("<account id>").summary
84
+ ```
85
+
86
+ ```ruby
87
+ client.investor_account("<account id>").leverage
88
+ ```
89
+
90
+ ```ruby
91
+ client.investor_account("<account id>").update_leverage(3)
92
+ ```
93
+
94
+ ```ruby
95
+ buy_order = { long: "eurusd" }
96
+
97
+ client.investor_account("<account id>").create_buy_order(buy_order)
98
+ ```
99
+
100
+ ```ruby
101
+ sell_order = { long: "eurusd" }
102
+
103
+ client.investor_account("<account id>").create_sell_order(sell_order)
104
+ ```
105
+
106
+ ```ruby
107
+ # Will create a stopout for all products
108
+ client.investor_account("<account id>").create_stopout
109
+ ```
110
+
111
+ ```ruby
112
+ product_name = 'DWC.4.20'
113
+
114
+ client.investor_account("<account id>").create_stopout(product_name)
115
+ ```
116
+
117
+ ```ruby
118
+ order = {
119
+ 'amount' => 215.15,
120
+ 'productName' => 'DWC.4.20',
121
+ 'quote' => 20.23,
122
+ 'side' => 'BUY',
123
+ 'type' => 'LESS_THAN_EQUAL',
124
+ 'thresholdParameters' => {
125
+ 'quoteStopLoss' => 10.05,
126
+ 'quoteTakeProfit' => 250.1
127
+ }
128
+ }
129
+
130
+ client.investor_account("<account id>").create_conditional_order(order)
131
+ ```
132
+
133
+ ```ruby
134
+ order_id = 123
135
+
136
+ order = {
137
+ 'amount' => 215.15,
138
+ 'productName' => 'DWC.4.20',
139
+ 'quote' => 20.23,
140
+ 'side' => 'BUY',
141
+ 'type' => 'LESS_THAN_EQUAL',
142
+ 'thresholdParameters' => {
143
+ 'quoteStopLoss' => 10.05,
144
+ 'quoteTakeProfit' => 250.1
145
+ }
146
+ }
147
+
148
+ client.investor_account("<account id>").update_conditional_order(order_id, order)
149
+ ```
150
+
151
+ ```ruby
152
+ order_id = 123
153
+
154
+ client.investor_account("<account id>").delete_conditional_order(order_id)
155
+ ```
156
+
157
+ ```ruby
158
+ client.investor_account("<account id>").current_positions
159
+ ```
160
+
161
+ ```ruby
162
+ product_name = 'DWC.4.20'
163
+
164
+ client.investor_account("<account id>").current_positions(product_name)
165
+ ```
166
+
167
+ ```ruby
168
+ client.investor_account("<account id>").executed_orders
169
+ ```
170
+
171
+ ```ruby
172
+ options = {
173
+ product_name: 'DWC.4.20',
174
+ page: 2,
175
+ per_page: 10
176
+ }
177
+
178
+ client.investor_account("<account id>").executed_orders(options)
179
+ ```
180
+
181
+ ```ruby
182
+ order_id = 'DWC.4.20'
183
+
184
+ client.investor_account("<account id>").order(order_id)
185
+ ```
186
+
187
+ ```ruby
188
+ client.investor_account("<account id>").performance_fees
189
+ ```
190
+
191
+ ```ruby
192
+ options = {
193
+ page: 2,
194
+ per_page: 10
195
+ }
196
+
197
+ client.investor_account("<account id>").performance_fees(options)
198
+ ```
199
+
200
+ ```ruby
201
+ product_name = 'DWC.4.20'
202
+
203
+ client.investor_account("<account id>").product_performance_fees(product_name)
204
+ ```
205
+
206
+ ```ruby
207
+ trade_status = 'open'
208
+
209
+ client.investor_account("<account id>").trades(trade_status)
210
+ ```
211
+
212
+ ```ruby
213
+ trade_status = 'open'
214
+
215
+ options = {
216
+ product_name: 'DWC.4.20',
217
+ page: 2,
218
+ per_page: 10
219
+ }
220
+
221
+ client.investor_account("<account id>").trades(trade_status, options)
222
+ ```
223
+
224
+ ```ruby
225
+ trade_id = 'DWC.4.20'
226
+
227
+ client.investor_account("<account id>").trade(trade_id)
228
+ ```
229
+
230
+
231
+ ### Products
232
+
233
+ ```ruby
234
+ client.list_products
235
+ ```
236
+
237
+ ```ruby
238
+ client.product("<product name>")
239
+ ```
240
+
241
+ ```ruby
242
+ client.product("<product name>").candles(from: epoch_timestamp, to: epoch_timestamp)
243
+ ```
244
+
245
+ ```ruby
246
+ client.product("<product name>").candles(resolution: '1m', from: epoch_timestamp, to: epoch_timestamp)
247
+ ```
248
+
249
+ ```ruby
250
+ client.product("<product name>").dxscore
251
+ ```
252
+
253
+ ```ruby
254
+ client.product("<product name>").badges
255
+ ```
256
+
257
+ ```ruby
258
+ client.product("<product name>").close_strategy
259
+ ```
260
+
261
+ ```ruby
262
+ client.product("<product name>").duration_consistency
263
+ ```
264
+
265
+ ```ruby
266
+ client.product("<product name>").experience
267
+ ```
268
+
269
+ ```ruby
270
+ client.product("<product name>").losing_consistency
271
+ ```
272
+
273
+ ```ruby
274
+ client.product("<product name>").market_correlation
275
+ ```
276
+
277
+ ```ruby
278
+ client.product("<product name>").performance
279
+ ```
280
+
281
+ ```ruby
282
+ client.product("<product name>").open_strategy
283
+ ```
284
+
285
+ ```ruby
286
+ client.product("<product name>").capacity
287
+ ```
288
+
289
+ ```ruby
290
+ client.product("<product name>").quotes
291
+ ```
292
+
293
+ ```ruby
294
+ client.product("<product name>").quotes(from: epoch_timestamp, to: epoch_timestamp)
295
+ ```
296
+
297
+ ```ruby
298
+ client.product("<product name>").risk_stability
299
+ ```
300
+
301
+ ```ruby
302
+ client.product("<product name>").winning_consistency
303
+ ```
304
+
305
+ ```ruby
306
+ client.product("<product name>").order_divergence
307
+ ```
308
+
309
+ ```ruby
310
+ client.product("<product name>").return_divergence
311
+ ```
312
+
313
+ ```ruby
314
+ client.product("<product name>").monthly_divergence
315
+ ```
316
+
317
+ ```ruby
318
+ client.product("<product name>").status
319
+ ```
320
+
321
+ ```ruby
322
+ client.product("<product name>").scores
323
+ ```
324
+
325
+ ```ruby
326
+ badge = "EXPERIENCE"
327
+
328
+ client.product("<product name>").scores(badge)
329
+ ```
330
+
331
+ ## Exceptions
332
+
333
+ All exceptions extend the base exception class `Darwinex::Error`.
334
+
335
+ ### Invalid Credentials
336
+
337
+ Raised when the consumer key or secret passed to the client are not valid.
338
+
339
+ ### Throttled
340
+
341
+ Raised when you exceed the [API rate limit](https://help.darwinex.com/api-walkthrough#throttling).
342
+
343
+ The client will automatically back off and retry throttled API responses until the max retries limit is hit.
344
+
345
+ ### Refresh Token Expired
346
+
347
+ Raised when `Darwinex::Client#refresh_access_token` is called with a refresh token that has expired.
348
+
349
+ Refresh tokens are only valid for a short period of time, after which they expire. As such, it's important your application regularly refreshes the access tokens to stop them from expiring.
350
+
351
+ In order to resolve this issue, you must go to the Darwinex Web console and issue a new refresh token.