cryptomarket-sdk 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b00c37cd577d6d79dd8e65c6333a5122d28728fa3023f24aa7ca0b13eab2bf6
4
- data.tar.gz: a2523b57da4464aed4a0c655fe7316c4445b57cfa622d85425c583e70b424303
3
+ metadata.gz: 57f75bd527cd0e65734a08b244ca66c9b7911fdf23209f0e6521a52046fb91ce
4
+ data.tar.gz: 7a05fe882f6aa4de73229565b409b11b347997fd45b317e9e2613903c72f0e70
5
5
  SHA512:
6
- metadata.gz: f6f0bf8e26c38b44f686d36b5103ee56eeca2319ab30aa4552c180e8f4535a3aabd8d5b86b38b6c6e05d256cf85f4a9208d9e2877e04cd6ceaa9b42b97545d36
7
- data.tar.gz: b859df27e046ecb43e678c4b2e9ca0b3dc03007dbc259c7d56ac23f79fa16b7850f6cfaa1ca7502aa7b477a9833974616b352e874a460d4c0f6c84a0b5da5f07
6
+ metadata.gz: 15a1b8b5cb5f2b10a49b99de60e47c65a44d298139695ed38abbaa49d81ba9cd310f13f1d77fecada5515536dca0385a373a5c55d4cb5a480c82f9afaa30e640
7
+ data.tar.gz: aa3a6f24469f5ec11484df474b576500e8271c843a83710c922da9ce61f1a53d0f7c2e086ef62179b7989517c495b6f7af4f5015c9a6dcddea8e00368f9c783c
@@ -39,6 +39,37 @@ module Cryptomarket
39
39
  @http_manager.make_request(method: 'delete', endpoint: endpoint, params: params)
40
40
  end
41
41
 
42
+ ###########
43
+ # aliases #
44
+ ###########
45
+
46
+ # market data
47
+
48
+ # alias of get ticker
49
+ alias get_ticker_by_symbol get_ticker
50
+ alias get_ticker_of_symbol get_ticker
51
+ alias get_ticker_price_by_symbol get_ticker_price
52
+ alias get_ticker_price_of_symbol get_ticker_price
53
+ alias get_trades_of_symbol get_trades_by_symbol
54
+ alias get_orderbook_by_symbol get_orderbook
55
+ alias get_orderbook_of_symbol get_orderbook
56
+ alias get_orderbook_volume_by_symbol get_orderbook_volume
57
+ alias get_orderbook_volume_of_symbol get_orderbook_volume
58
+ alias get_candles_of_symbol get_candles_by_symbol
59
+ alias get_converted_candles_of_symbol get_converted_candles_by_symbol
60
+ # spot trading
61
+ alias get_spot_trading_balance_of_currency get_spot_trading_balance
62
+ alias get_spot_trading_balance_by_currency get_spot_trading_balance
63
+ alias get_all_trading_commissions get_all_trading_commission
64
+ alias get_trading_commission get_all_trading_commission
65
+ alias get_trading_commission_of_symbol get_trading_commission
66
+ alias get_trading_commission_by_symbol get_trading_commission
67
+ # wallet management
68
+ alias get_wallet_balance_of_currency get_wallet_balance
69
+ alias get_wallet_balance_by_currency get_wallet_balance
70
+ alias get_deposit_crypto_address_of_cyrrency get_deposit_crypto_address
71
+ alias get_deposit_crypto_address_by_cyrrency get_deposit_crypto_address
72
+
42
73
  ################
43
74
  # public calls #
44
75
  ################
@@ -154,7 +185,7 @@ module Cryptomarket
154
185
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
155
186
  # +String+ +since+:: Optional. Initial value of the queried interval
156
187
  # +String+ +until+:: Optional. Last value of the queried interval
157
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 1. Min is 1. Max is 1000
188
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 1. Min is 1. Max is 1_000
158
189
 
159
190
  def get_price_history(to:, from: nil, till: nil, since: nil, limit: nil, period: nil, sort: nil) # rubocop:disable Metrics/ParameterLists
160
191
  public_get(
@@ -202,7 +233,7 @@ module Cryptomarket
202
233
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
203
234
  # +String+ +since+:: Optional. Initial value of the queried interval
204
235
  # +String+ +until+:: Optional. Last value of the queried interval
205
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
236
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000
206
237
 
207
238
  def get_trades(symbols: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
208
239
  public_get(
@@ -224,8 +255,8 @@ module Cryptomarket
224
255
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
225
256
  # +String+ +since+:: Optional. Initial value of the queried interval
226
257
  # +String+ +until+:: Optional. Last value of the queried interval
227
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
228
- # +Integer+ +offset+:: Optional. Default is 0. Min is 0. Max is 100000
258
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000
259
+ # +Integer+ +offset+:: Optional. Default is 0. Min is 0. Max is 100_000
229
260
 
230
261
  def get_trades_by_symbol(symbol: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
231
262
  public_get(
@@ -280,7 +311,7 @@ module Cryptomarket
280
311
  end
281
312
 
282
313
  # Get a Hash of candles for all symbols or for specified symbols
283
- # Candels are used for OHLC representation
314
+ # Candles are used for OHLC representation
284
315
  # The result contains candles with non-zero volume only (no trades = no candles)
285
316
  #
286
317
  # Requires no API key Access Rights
@@ -293,7 +324,7 @@ module Cryptomarket
293
324
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
294
325
  # +String+ +from+:: Optional. Initial value of the queried interval. As DateTime
295
326
  # +String+ +till+:: Optional. Last value of the queried interval. As DateTime
296
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
327
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000
297
328
 
298
329
  def get_candles(symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
299
330
  public_get(
@@ -303,7 +334,7 @@ module Cryptomarket
303
334
  end
304
335
 
305
336
  # Get candles of a symbol
306
- # Candels are used for OHLC representation
337
+ # Candles are used for OHLC representation
307
338
  # The result contains candles with non-zero volume only (no trades = no candles)
308
339
  #
309
340
  # Requires no API key Access Rights
@@ -316,8 +347,8 @@ module Cryptomarket
316
347
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
317
348
  # +String+ +from+:: Optional. Initial value of the queried interval. As DateTime
318
349
  # +String+ +till+:: Optional. Last value of the queried interval. As DateTime
319
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1000
320
- # +Integer+ +offset+:: Optional. Default is 0. Min is 0. Max is 100000
350
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000
351
+ # +Integer+ +offset+:: Optional. Default is 0. Min is 0. Max is 100_000
321
352
 
322
353
  def get_candles_by_symbol(symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
323
354
  public_get(
@@ -326,6 +357,61 @@ module Cryptomarket
326
357
  )
327
358
  end
328
359
 
360
+ # Gets OHLCV data regarding the last price converted to the target currency for all symbols or for the specified symbols
361
+ #
362
+ # Candles are used for OHLC representation
363
+ #
364
+ # The result contains candles with non-zero volume only (no trades = no candles)
365
+ #
366
+ # Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid or ask price, the last price is returned.
367
+ #
368
+ # Requires no API key Access Rights
369
+ #
370
+ # https://api.exchange.cryptomkt.com/#candles
371
+ #
372
+ # +String+ +target_currency+:: Target currency for conversion
373
+ # +Array[String]+ +symbols+:: Optional. A list of symbols
374
+ # +String+ +period+:: Optional. A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month). Default is 'M30'
375
+ # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
376
+ # +String+ +from+:: Optional. Initial value of the queried interval. As DateTime
377
+ # +String+ +till+:: Optional. Last value of the queried interval. As DateTime
378
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000
379
+
380
+ def get_converted_candles(target_currency:, symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil) # rubocop:disable Metrics/ParameterLists
381
+ public_get(
382
+ 'public/converted/candles',
383
+ { target_currency: target_currency, symbols: symbols, period: period, sort: sort, from: from, till: till, limit: limit }
384
+ )
385
+ end
386
+
387
+ # Gets OHLCV data regarding the last price converted to the target currency for the specified symbol
388
+ #
389
+ # Candles are used for OHLC representation
390
+ #
391
+ # The result contains candles with non-zero volume only (no trades = no candles)
392
+ #
393
+ # Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid or ask price, the last price is returned.
394
+ #
395
+ # Requires no API key Access Rights
396
+ #
397
+ # https://api.exchange.cryptomkt.com/#candles
398
+ #
399
+ # +String+ +target_currency+:: Target currency for conversion
400
+ # +String+ +symbol+:: A symbol id
401
+ # +String+ +period+:: Optional. A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month). Default is 'M30'
402
+ # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
403
+ # +String+ +from+:: Optional. Initial value of the queried interval. As DateTime
404
+ # +String+ +till+:: Optional. Last value of the queried interval. As DateTime
405
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000
406
+ # +Integer+ +offset+:: Optional. Default is 0. Min is 0. Max is 100_000
407
+
408
+ def get_converted_candles_by_symbol(target_currency:, symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
409
+ public_get(
410
+ "public/converted/candles/#{symbol}",
411
+ { target_currency: target_currency, period: period, sort: sort, from: from, till: till, limit: limit, offset: offset }
412
+ )
413
+ end
414
+
329
415
  ######################
330
416
  # Spot Trading calls #
331
417
  ######################
@@ -567,8 +653,8 @@ module Cryptomarket
567
653
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
568
654
  # +String+ +from+:: Optional. Initial value of the queried interval
569
655
  # +String+ +till+:: Optional. Last value of the queried interval
570
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Max is 1000
571
- # +Integer+ +offset+:: Optional. Default is 0. Max is 100000
656
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Max is 1_000
657
+ # +Integer+ +offset+:: Optional. Default is 0. Max is 100_000
572
658
 
573
659
  def get_spot_orders_history( # rubocop:disable Metrics/ParameterLists
574
660
  client_order_id: nil, symbol: nil, sort: nil, by: nil, from: nil,
@@ -594,8 +680,8 @@ module Cryptomarket
594
680
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
595
681
  # +String+ +from+:: Optional. Initial value of the queried interval
596
682
  # +String+ +till+:: Optional. Last value of the queried interval
597
- # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Max is 1000
598
- # +Integer+ +offset+:: Optional. Default is 0. Max is 100000
683
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Max is 1_000
684
+ # +Integer+ +offset+:: Optional. Default is 0. Max is 100_000
599
685
 
600
686
  def get_spot_trades_history( # rubocop:disable Metrics/ParameterLists
601
687
  order_id: nil, symbol: nil, sort: nil, by: nil, from: nil,
@@ -906,8 +992,8 @@ module Cryptomarket
906
992
  # +String+ +id_from+:: Optional. Interval initial value when ordering by id. Min is 0
907
993
  # +String+ +id_till+:: Optional. Interval end value when ordering by id. Min is 0
908
994
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
909
- # +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1000
910
- # +Integer+ +offset+:: Optional. Default is 0. Max is 100000
995
+ # +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1_000
996
+ # +Integer+ +offset+:: Optional. Default is 0. Max is 100_000
911
997
  # +bool+ +group_transactions+:: Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false
912
998
 
913
999
  def get_transaction_history( # rubocop:disable Metrics/ParameterLists
@@ -971,7 +1057,7 @@ module Cryptomarket
971
1057
  # ==== Params
972
1058
  # +String+ +currency+:: Optional. Currency code
973
1059
  # +bool+ +active+:: Optional. value showing whether the lock is active
974
- # +Integer+ +limit+:: Optional. Dafault is 100. Min is 0. Max is 1000
1060
+ # +Integer+ +limit+:: Optional. Dafault is 100. Min is 0. Max is 1_000
975
1061
  # +Integer+ +offset+:: Optional. Default is 0. Min is 0
976
1062
  # +String+ +from+:: Optional. Interval initial value. As Datetime
977
1063
  # +String+ +till+:: Optional. Interval end value. As Datetime
@@ -48,7 +48,7 @@ module Cryptomarket
48
48
  # err is None for successful calls, result is None for calls with error: Proc.new {|err, result| ...}
49
49
 
50
50
  def authenticate(callback = nil)
51
- timestamp = Time.now.to_i * 1000
51
+ timestamp = Time.now.to_i * 1_000
52
52
  digest = OpenSSL::Digest.new 'sha256'
53
53
  message = timestamp.to_s
54
54
  message += @window.to_s unless @window.nil?
@@ -26,7 +26,7 @@ module Cryptomarket
26
26
  # ==== Params
27
27
  # +Proc+ +callback+:: A +Proc+ that recieves notifications as a hash of trades indexed by symbol, and the type of notification (either 'snapshot' or 'update')
28
28
  # +Array[String]+ +symbols+:: A list of symbol ids
29
- # +Integer+ +limit+:: Number of historical entries returned in the first feed. Min is 0. Max is 1000. Default is 0
29
+ # +Integer+ +limit+:: Number of historical entries returned in the first feed. Min is 0. Max is 1_000. Default is 0
30
30
  # +Proc+ +result_callback+:: Optional. A +Proc+ of two arguments, An exception and a result, called either with the exception or with the result, a list of subscribed symbols
31
31
 
32
32
  def subscribe_to_trades(callback:, symbols:, limit: nil, result_callback: nil)
@@ -40,18 +40,15 @@ module Cryptomarket
40
40
  #
41
41
  # normal subscriptions have one update message per symbol
42
42
  #
43
- # the first notification are n candles, with n defined by the limit argument,
44
- # the next notification are updates, with one candle at a time
45
- #
46
43
  # Requires no API key Access Rights
47
44
  #
48
45
  # https://api.exchange.cryptomkt.com/#subscribe-to-candles
49
46
  #
50
47
  # ==== Params
51
48
  # +Proc+ +callback+:: A +Proc+ that recieves notifications as a hash of candles indexed by symbol, and the type of notification (either 'snapshot' or 'update')
52
- # +String+ +period+:: Optional. A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month). Default is 'M30'
49
+ # +String+ +period+:: Optional. A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month).
53
50
  # +Array[String]+ +symbols+:: Optional. A list of symbol ids
54
- # +Integer+ +limit+:: Number of historical entries returned in the first feed. Min is 0. Max is 1000. Default is 0
51
+ # +Integer+ +limit+:: Number of historical entries returned in the first feed. Min is 0. Max is 1_000. Default is 0
55
52
  # +Proc+ +result_callback+:: Optional. A +Proc+ called with a list of subscribed symbols
56
53
 
57
54
  def subscribe_to_candles(callback:, period:, symbols:, limit: nil, result_callback: nil)
@@ -60,6 +57,31 @@ module Cryptomarket
60
57
  intercept_result_callback(result_callback), params)
61
58
  end
62
59
 
60
+ # subscribes to a feed of candles regarding the last price converted to the target currency for all symbols or for the specified symbols
61
+ #
62
+ # Candles are used for the representation of a specific symbol as an OHLC chart
63
+ #
64
+ # Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid or ask price, the last price is returned.
65
+ #
66
+ # Requires no API key Access Rights
67
+ #
68
+ # https://api.exchange.cryptomkt.com/#subscribe-to-converted-candles
69
+ #
70
+ # +Proc+ +callback+:: A +Proc+ that recieves notifications as a hash of candles indexed by symbol, and the type of notification (either 'snapshot' or 'update')
71
+ # +String+ +target_currency+:: Target currency for conversion
72
+ # +Array[String]+ +symbols+:: A list of symbols
73
+ # +String+ +period+:: A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month).
74
+ # +String+ +from+:: Optional. Initial value of the queried interval. As DateTime
75
+ # +String+ +till+:: Optional. Last value of the queried interval. As DateTime
76
+ # +Integer+ +limit+:: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000
77
+ # +Proc+ +result_callback+:: Optional. A +Proc+ called with a list of subscribed symbols
78
+
79
+ def subscribe_to_converted_candles(callback:, target_currency:, symbols:, period:, limit: nil, result_callback: nil) # rubocop:disable Metrics/ParameterLists
80
+ params = { 'target_currency' => target_currency, 'symbols' => symbols, 'limit' => limit }
81
+ send_channel_subscription("converted/candles/#{period}", callback,
82
+ intercept_result_callback(result_callback), params)
83
+ end
84
+
63
85
  # subscribe to a feed of mini tickers
64
86
  #
65
87
  # subscription is for all symbols or for the specified symbols
@@ -258,7 +280,7 @@ module Cryptomarket
258
280
  #
259
281
  # subscription is for all currencies or for the specified currencies
260
282
  #
261
- # https://api.exchange.cryptomkt.com/#subscribe-to-top-of-book-in-batches
283
+ # https://api.exchange.cryptomkt.com/#subscribe-to-price-rates
262
284
  #
263
285
  # ==== Params
264
286
  # +Proc+ +callback+:: A +Proc+ that recieves notifications as a hash of top of orderbooks indexed by symbol, and the type of notification (only 'data')
@@ -35,6 +35,11 @@ module Cryptomarket
35
35
  'spot_balance' => [balances, Args::NotificationType::SNAPSHOT] }
36
36
  end
37
37
 
38
+ alias get_spot_trading_balance_of_currency get_spot_trading_balance
39
+ alias get_spot_trading_balance_by_currency get_spot_trading_balance
40
+ alias get_spot_commission_of_symbol get_spot_commission
41
+ alias get_spot_commission_by_symbol get_spot_commission
42
+
38
43
  # subscribe to a feed of execution reports of the user's orders
39
44
  #
40
45
  # https://api.exchange.cryptomkt.com/#socket-spot-trading
@@ -37,6 +37,9 @@ module Cryptomarket
37
37
  'wallet_balance_update' => [balance, Args::NotificationType::UPDATE] }
38
38
  end
39
39
 
40
+ alias get_wallet_balance_of_currency get_wallet_balance
41
+ alias get_wallet_balance_by_currency get_wallet_balance
42
+
40
43
  # A transaction notification occurs each time a transaction has been changed, such as creating a transaction, updating the pending state (e.g., the hash assigned) or completing a transaction
41
44
  #
42
45
  # https://api.exchange.cryptomkt.com/#subscribe-to-transactions
@@ -151,8 +154,8 @@ module Cryptomarket
151
154
  # +String+ +id_till+:: Optional. Interval end value when ordering by id. Min is 0
152
155
  # +String+ +order_by+:: Optional. sorting parameter.'created_at' or 'id'. Default is 'created_at'
153
156
  # +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
154
- # +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1000
155
- # +Integer+ +offset+:: Optional. Default is 0. Max is 100000
157
+ # +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1_000
158
+ # +Integer+ +offset+:: Optional. Default is 0. Max is 100_000
156
159
  # +bool+ +group_transactions+:: Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false
157
160
 
158
161
  def get_transactions( # rubocop:disable Metrics/ParameterLists
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptomarket-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - T. Ismael Verdugo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-27 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client