Class: Cryptomarket::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptomarket/client.rb

Overview

Creates a new rest client

Params

String api_key

the user api key

String api_secret

the user api secret

Integer window

Maximum difference between the creation of the request and the moment of request processing in milliseconds. Max is 60_000. Defaul is 10_000

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, api_secret: nil, window: nil) ⇒ Client

rubocop:disable Metrics/ClassLength



14
15
16
# File 'lib/cryptomarket/client.rb', line 14

def initialize(api_key: nil, api_secret: nil, window: nil)
  @http_manager = HttpManager.new api_key: api_key, api_secret: api_secret, window: window
end

Instance Method Details

#activate_sub_accounts(sub_account_ids:) ⇒ Object

Activates sub-accounts listed. It would make sub-accounts active after being frozen

Requires no API key Access Rights

api.exchange.cryptomkt.com/#activate-sub-account

Params

Array[String] sub_account_ids

A list of sub-account ids to activate



1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/cryptomarket/client.rb', line 1151

def activate_sub_accounts(
  sub_account_ids:
)
  post(
    'sub-account/activate',
    {
      sub_account_ids: 
    }
  )['result']
end

#cancel_all_spot_ordersObject

Cancel all active spot orders

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#cancel-all-spot-orders



584
585
586
# File 'lib/cryptomarket/client.rb', line 584

def cancel_all_spot_orders
  delete('spot/order')
end

#cancel_spot_order(client_order_id:) ⇒ Object

Cancel the order with the client order id

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#cancel-spot-order

Params

String client_order_id

client order id of the order to cancel



597
598
599
# File 'lib/cryptomarket/client.rb', line 597

def cancel_spot_order(client_order_id:)
  delete("spot/order/#{client_order_id}")
end

#change_acl_settings(sub_account_ids:, deposit_address_generation_enabled: nil, withdraw_enabled: nil, description: nil, created_at: nil, updated_at: nil) ⇒ Object

Returns a list of withdrawal settings for sub-accounts listed

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-acl-settings

Params

Array[String] sub_account_ids

A list of sub-account ids to get the acl settings

bool deposit_address_generation_enabled

Optional. Enables deposits

bool withdraw_enabled

Optional. Enables withdrawals

String description

Optional. Textual description

String created_at

Optional. ACL creation time

String updated_at

Optional. ACL update time



1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
# File 'lib/cryptomarket/client.rb', line 1225

def change_acl_settings( # rubocop:disable Metrics/ParameterLists
  sub_account_ids:, deposit_address_generation_enabled: nil, withdraw_enabled: nil,
  description: nil, created_at: nil, updated_at: nil
)
  post(
    'sub-account/acl',
    { sub_account_ids: , deposit_address_generation_enabled: deposit_address_generation_enabled,
      withdraw_enabled: withdraw_enabled, description: description, created_at: created_at, updated_at: updated_at }
  )['result']
end

#change_credentials(api_key:, api_secret:) ⇒ Object

Changes the user credentials used for authentication in calls

Params

String api_key

The user public key used in new calls

String api_secret

The user secret key used in new calls



48
49
50
# File 'lib/cryptomarket/client.rb', line 48

def change_credentials(api_key:, api_secret:)
  @http_manager.change_credentials(api_key: api_key, api_secret: api_secret)
end

#change_window(window:) ⇒ Object

Changes the window used in authenticated calls

Params

Integer window

Acceptable time between request and server execution in millis



57
58
59
# File 'lib/cryptomarket/client.rb', line 57

def change_window(window:)
  @http_manager.change_window(window: window)
end

#convert_between_currencies(from_currency:, to_currency:, amount:) ⇒ Object

Converts between currencies Successful response to the request does not necessarily mean the resulting transaction got executed immediately. It has to be processed first and may eventually be rolled back To see whether a transaction has been finalized, call #get_transaction

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#convert-between-currencies

Params

String from currency

currency code of origin

String to currency

currency code of destiny

float amount

the amount to be converted



929
930
931
932
933
934
935
936
937
938
# File 'lib/cryptomarket/client.rb', line 929

def convert_between_currencies(from_currency:, to_currency:, amount:)
  post(
    'wallet/convert',
    {
      from_currency: from_currency,
      to_currency: to_currency,
      amount: amount
    }
  )['result']
end

#create_deposit_crypto_address(currency:, network_code: nil) ⇒ Object

Creates a new address for a currency

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#generate-deposit-crypto-address

Params

String currency

currency to create a new address

String network_code

Optional. network code



751
752
753
# File 'lib/cryptomarket/client.rb', line 751

def create_deposit_crypto_address(currency:, network_code: nil)
  post('wallet/crypto/address', { currency: currency, network_code: network_code })
end

#create_spot_order(symbol:, side:, quantity:, client_order_id: nil, type: nil, time_in_force: nil, price: nil, stop_price: nil, expire_time: nil, strict_validate: nil, post_only: nil, take_rate: nil, make_rate: nil) ⇒ Object

Creates a new spot order For fee, for price accuracy and quantity, and for order status information see the api docs

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#create-new-spot-order

Params

String symbol

Trading symbol

String side

Either ‘buy’ or ‘sell’

String quantity

Order quantity

String client_order_id

Optional. If given must be unique within the trading day, including all active orders. If not given, is generated by the server

String type

Optional. ‘limit’, ‘market’, ‘stopLimit’, ‘stopMarket’, ‘takeProfitLimit’ or ‘takeProfitMarket’. Default is ‘limit’

String time_in_force

Optional. ‘GTC’, ‘IOC’, ‘FOK’, ‘Day’, ‘GTD’. Default is ‘GTC’ if ‘limit’, ‘stopLimit’ or ‘takeProfitLimit’ order, Default is ‘FOK’ if ‘market’, ‘stopMarket’ or ‘takeProfitMarket’ order

String price

Optional. Required for ‘limit’ and ‘stopLimit’. limit price of the order

String stop_price

Optional. Required for ‘stopLimit’ and ‘stopMarket’ orders. stop price of the order

String expire_time

Optional. Required for orders with timeInForce = GDT

bool strict_validate

Optional. If False, the server rounds half down for tickerSize and quantityIncrement. Example of ETHBTC: tickSize = ‘0.000001’, then price ‘0.046016’ is valid, ‘0.0460165’ is invalid

bool post_only

Optional. If True, your post_only order causes a match with a pre-existing order as a taker, then the order will be cancelled

String take_rate

Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

String make_rate

Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.



480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/cryptomarket/client.rb', line 480

def create_spot_order( # rubocop:disable Metrics/ParameterLists
  symbol:, side:, quantity:, client_order_id: nil, type: nil, time_in_force: nil, price: nil,
  stop_price: nil, expire_time: nil, strict_validate: nil, post_only: nil, take_rate: nil,
  make_rate: nil
)
  post(
    'spot/order',
    { client_order_id: client_order_id, symbol: symbol, side: side, quantity: quantity, type: type,
      time_in_force: time_in_force, price: price, stop_price: stop_price, expire_time: expire_time,
      strict_validate: strict_validate, post_only: post_only, take_rate: take_rate, make_rate: make_rate }
  )
end

#create_spot_order_list(contingency_type:, orders:, order_list_id: nil) ⇒ Object

creates a list of spot orders

Types or contingency

  • ‘allOrNone’ (AON)

  • ‘oneCancelAnother’ (OCO)

  • ‘oneTriggerOther’ (OTO)

  • ‘oneTriggerOneCancelOther’ (OTOCO)

Restriction in the number of orders:

  • An AON list must have 2 or 3 orders

  • An OCO list must have 2 or 3 orders

  • An OTO list must have 2 or 3 orders

  • An OTOCO must have 3 or 4 orders

Symbol restrictions

  • For an AON order list, the symbol code of orders must be unique for each order in the list.

  • For an OCO order list, there are no symbol code restrictions.

  • For an OTO order list, there are no symbol code restrictions.

  • For an OTOCO order list, the symbol code of orders must be the same for all orders in the list (placing orders in different order books is not supported).

OrderType restrictions

  • For an AON order list, orders must be ‘limit’ or ‘market’

  • For an OCO order list, orders must be ‘limit’, ‘stopLimit’, ‘stopMarket’, takeProfitLimit or takeProfitMarket.

  • An OCO order list cannot include more than one limit order (the same

applies to secondary orders in an OTOCO order list).

  • For OTO order list, there are no order type restrictions.

  • For an OTOCO order list, the first order must be ‘limit’, ‘market’, ‘stopLimit’, ‘stopMarket’, takeProfitLimit or takeProfitMarket.

  • For an OTOCO order list, the secondary orders have the same restrictions as an OCO order

  • Default is ‘limit’

api.exchange.cryptomkt.com/#create-new-spot-order-list

Params

String order_list_id

order list identifier. If ommited, it will be generated by the system. Must be equal to the client order id of the first order in the request

String contingency_type

order list type. ‘allOrNone’, ‘oneCancelOther’ or ‘oneTriggerOneCancelOther’

Array[] orders

the list of orders. aech order in the list has the same parameters of a new spot order



530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/cryptomarket/client.rb', line 530

def create_spot_order_list(
  contingency_type:,
  orders:,
  order_list_id: nil
)
  post(
    'spot/order/list',
    {
      order_list_id: order_list_id,
      contingency_type: contingency_type,
      orders: orders
    }
  )
end

#crypto_address_belongs_to_current_account?(address:) ⇒ Boolean

Check if an address is from this account

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#check-if-crypto-address-belongs-to-current-account

Params

String address

address to check

Returns:

  • (Boolean)


949
950
951
# File 'lib/cryptomarket/client.rb', line 949

def crypto_address_belongs_to_current_account?(address:)
  get('wallet/crypto/address/check-mine', { address: address })['result']
end

#delete(endpoint, params = nil) ⇒ Object



38
39
40
# File 'lib/cryptomarket/client.rb', line 38

def delete(endpoint, params = nil)
  @http_manager.make_request(method: 'delete', endpoint: endpoint, params: params)
end

#freeze_sub_accounts(sub_account_ids:) ⇒ Object

Freezes sub-accounts listed Sub-accounts frozen wouldn’t be able to:

  • login

  • withdraw funds

  • trade

  • complete pending orders

  • use API keys

For any sub-account listed, all orders will be canceled and all funds will be transferred form the Trading balance

Requires no API key Access Rights

api.exchange.cryptomkt.com/#freeze-sub-account

Params

Array[String] sub_account_ids

A list of sub-account ids to freeze



1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
# File 'lib/cryptomarket/client.rb', line 1132

def freeze_sub_accounts(
  sub_account_ids:
)
  post(
    'sub-account/freeze',
    {
      sub_account_ids: 
    }
  )['result']
end

#get(endpoint, params = nil) ⇒ Object



22
23
24
# File 'lib/cryptomarket/client.rb', line 22

def get(endpoint, params = nil)
  @http_manager.make_request(method: 'get', endpoint: endpoint, params: params)
end

#get_acl_settings(sub_account_ids:) ⇒ Object

Returns a list of withdrawal settings for sub-accounts listed

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-acl-settings

Params

Array[String] sub_account_ids

A list of sub-account ids to get the acl settings



1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/cryptomarket/client.rb', line 1200

def get_acl_settings(
  sub_account_ids:
)
  get(
    'sub-account/acl',
    {
      sub_account_ids: 
    }
  )['result']
end

#get_active_spot_order(client_order_id:) ⇒ Object

Get an active spot order by its client order id

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#get-active-spot-order

Params

String client_order_id

The client order id of the order



454
455
456
# File 'lib/cryptomarket/client.rb', line 454

def get_active_spot_order(client_order_id:)
  get("spot/order/#{client_order_id}")
end

#get_all_active_spot_orders(symbol: nil) ⇒ Object

Get the user’s active spot orders

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#get-all-active-spot-orders

Params

String symbol

Optional. A symbol for filtering the active spot orders



441
442
443
# File 'lib/cryptomarket/client.rb', line 441

def get_all_active_spot_orders(symbol: nil)
  get('spot/order', { symbol: symbol })
end

#get_all_trading_commissionObject Also known as: get_all_trading_commissions, get_trading_commissions

Get the personal trading commission rates for all symbols

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#get-all-trading-commissions



607
608
609
# File 'lib/cryptomarket/client.rb', line 607

def get_all_trading_commission # rubocop:disable Naming/AccessorMethodName
  get('spot/fee')
end

#get_amount_locks(currency: nil, active: nil, limit: nil, offset: nil, from: nil, till: nil) ⇒ Object

Get the list of amount locks

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-amount-locks

Params

String currency

Optional. Currency code

bool active

Optional. value showing whether the lock is active

Integer limit

Optional. Dafault is 100. Min is 0. Max is 1_000

Integer offset

Optional. Default is 0. Min is 0

String from

Optional. Interval initial value. As Datetime

String till

Optional. Interval end value. As Datetime



1095
1096
1097
1098
1099
1100
1101
1102
# File 'lib/cryptomarket/client.rb', line 1095

def get_amount_locks( # rubocop:disable Metrics/ParameterLists
  currency: nil, active: nil, limit: nil, offset: nil, from: nil, till: nil
)
  get(
    'wallet/amount-locks',
    { currency: currency, active: active, limit: limit, offset: offset, from: from, till: till }
  )
end

#get_bulk_estimate_withdrawal_fees(fee_requests:) ⇒ Object

Get an estimates for withdrawal fees of currencies

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#bulk-estimate-withdrawal-fee

Params

Array[] fee_requests

the list of fee requests, each request is a Hash in the form amount:“string”, network_code:“optional string”



868
869
870
871
# File 'lib/cryptomarket/client.rb', line 868

def get_bulk_estimate_withdrawal_fees(fee_requests:)
  params = fee_requests
  post('wallet/crypto/fee/estimate/bulk', params)
end

#get_candles(symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object

Get a Hash of candles for all symbols or for specified symbols Candles are used for OHLC representation The result contains candles with non-zero volume only (no trades = no candles)

Requires no API key Access Rights

api.exchange.cryptomkt.com/#candles

Params

String symbol

A symbol id

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’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval. As DateTime

String till

Optional. Last value of the queried interval. As DateTime

Integer limit

Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000



317
318
319
320
321
322
# File 'lib/cryptomarket/client.rb', line 317

def get_candles(symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    'public/candles/',
    { symbols: symbols, period: period, sort: sort, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_candles_by_symbol(symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object Also known as: get_candles_of_symbol

Get candles of a symbol Candles are used for OHLC representation The result contains candles with non-zero volume only (no trades = no candles)

Requires no API key Access Rights

api.exchange.cryptomkt.com/#candles

Params

String symbol

A symbol id

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’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval. As DateTime

String till

Optional. Last value of the queried interval. As DateTime

Integer limit

Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000

Integer offset

Optional. Default is 0. Min is 0. Max is 100_000



341
342
343
344
345
346
# File 'lib/cryptomarket/client.rb', line 341

def get_candles_by_symbol(symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    "public/candles/#{symbol}",
    { period: period, sort: sort, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_converted_candles(target_currency:, symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil) ⇒ Object

Gets OHLCV data regarding the last price converted to the target currency for all symbols or for the specified symbols

Candles are used for OHLC representation

The result contains candles with non-zero volume only (no trades = no candles)

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.

Requires no API key Access Rights

api.exchange.cryptomkt.com/#candles

String target_currency

Target currency for conversion

Array[String] symbols

Optional. A list of symbols

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’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval. As DateTime

String till

Optional. Last value of the queried interval. As DateTime

Integer limit

Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000



368
369
370
371
372
373
# File 'lib/cryptomarket/client.rb', line 368

def get_converted_candles(target_currency:, symbols: nil, period: nil, sort: nil, from: nil, till: nil, limit: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    'public/converted/candles',
    { target_currency: target_currency, symbols: symbols, period: period, sort: sort, from: from, till: till, limit: limit }
  )
end

#get_converted_candles_by_symbol(target_currency:, symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object Also known as: get_converted_candles_of_symbol

Gets OHLCV data regarding the last price converted to the target currency for the specified symbol

Candles are used for OHLC representation

The result contains candles with non-zero volume only (no trades = no candles)

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.

Requires no API key Access Rights

api.exchange.cryptomkt.com/#candles

String target_currency

Target currency for conversion

String symbol

A symbol id

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’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval. As DateTime

String till

Optional. Last value of the queried interval. As DateTime

Integer limit

Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1_000

Integer offset

Optional. Default is 0. Min is 0. Max is 100_000



396
397
398
399
400
401
# File 'lib/cryptomarket/client.rb', line 396

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
  public_get(
    "public/converted/candles/#{symbol}",
    { target_currency: target_currency, period: period, sort: sort, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_currencies(currencies: nil, preferred_network: nil) ⇒ Object

Get a Hash of all currencies or specified currencies. indexed by id

Requires no API key Access Rights

api.exchange.cryptomkt.com/#currencies

Params

Array[String] currencies

Optional. A list of currencies ids

String preferred_network

Optional. Code of de default network code of currencies



75
76
77
78
79
80
# File 'lib/cryptomarket/client.rb', line 75

def get_currencies(currencies: nil, preferred_network: nil)
  public_get('public/currency/', {
               currencies: currencies,
               preferred_network: preferred_network
             })
end

#get_currency(currency:) ⇒ Object

Get the data of a currency

Requires no API key Access Rights

api.exchange.cryptomkt.com/#currencies

Params

String currency

A currency id



91
92
93
# File 'lib/cryptomarket/client.rb', line 91

def get_currency(currency:)
  public_get("public/currency/#{currency}")
end

#get_deposit_crypto_address(currency: nil, network_code: nil) ⇒ Object Also known as: get_deposit_crypto_address_of_cyrrency, get_deposit_crypto_address_by_cyrrency

Get the current addresses of a currency of the user

Getting the address of a new currency will create an address

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-deposit-crypto-address

Params

String currency

Currency to get the address

String network_code

Optional. network code



734
735
736
737
738
739
# File 'lib/cryptomarket/client.rb', line 734

def get_deposit_crypto_address(currency: nil, network_code: nil)
  result = get('wallet/crypto/address', { currency: currency, network_code: network_code })
  raise CryptomarketSDKException 'Too many currencies recieved, expected 1 currency' if result.length != 1

  result[0]
end

#get_deposit_crypto_addressesObject

Get a list with the current addresses of the user

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-deposit-crypto-address



718
719
720
# File 'lib/cryptomarket/client.rb', line 718

def get_deposit_crypto_addresses # rubocop:disable Naming/AccessorMethodName
  get('wallet/crypto/address')
end

#get_estimate_withdrawal_fee(currency:, amount:, network_code: nil) ⇒ Object

Get an estimate of the withdrawal fee

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#estimate-withdrawal-fee

Params

String currency

the currency code for withdrawal

float amount

the expected withdraw amount



883
884
885
886
# File 'lib/cryptomarket/client.rb', line 883

def get_estimate_withdrawal_fee(currency:, amount:, network_code: nil)
  params = { amount: amount, currency: currency, network_code: network_code }
  get('wallet/crypto/fee/estimate', params)['fee']
end

#get_estimate_withdrawal_fees(fee_requests:) ⇒ Object

Get an estimates for withdrawal fees of currencies

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#estimate-withdrawal-fees

Params

Array[] fee_requests

the list of fee requests, each request is a Hash in the form amount:“string”, network_code:“optional string”



854
855
856
857
# File 'lib/cryptomarket/client.rb', line 854

def get_estimate_withdrawal_fees(fee_requests:)
  params = fee_requests
  post('wallet/crypto/fees/estimate', params)
end

#get_last_10_deposit_crypto_addresses(currency:, network_code: nil) ⇒ Object

Get the last 10 unique addresses used for deposit, by currency Addresses used a long time ago may be omitted, even if they are among the last 10 unique addresses

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#last-10-deposit-crypto-addresses

Params

String currency

currency to get the list of addresses

String network_code

Optional. network code



766
767
768
# File 'lib/cryptomarket/client.rb', line 766

def get_last_10_deposit_crypto_addresses(currency:, network_code: nil)
  get('wallet/crypto/address/recent-deposit', { currency: currency, network_code: network_code })
end

#get_last_10_withdrawal_crypto_addresses(currency:, network_code: nil) ⇒ Object

Get the last 10 unique addresses used for withdrawals, by currency Addresses used a long time ago may be omitted, even if they are among the last 10 unique addresses

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#last-10-withdrawal-crypto-addresses

Params

String currency

currency to get the list of addresses

String network_code

Optional. network code



781
782
783
# File 'lib/cryptomarket/client.rb', line 781

def get_last_10_withdrawal_crypto_addresses(currency:, network_code: nil)
  get('wallet/crypto/address/recent-withdraw', { currency: currency, network_code: network_code })
end

#get_orderbook(symbol:, depth: nil) ⇒ Object Also known as: get_orderbook_by_symbol, get_orderbook_of_symbol

Get order book of a symbol An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

api.exchange.cryptomkt.com/#order-books

Params

String symbol

A symbol id

Integer depth

Optional. Order Book depth. Default value is 100. Set to 0 to view the full Order Book



282
283
284
# File 'lib/cryptomarket/client.rb', line 282

def get_orderbook(symbol:, depth: nil)
  public_get("public/orderbook/#{symbol}", { depth: depth })
end

#get_orderbook_volume(symbol:, volume: nil) ⇒ Object Also known as: get_orderbook_volume_by_symbol, get_orderbook_volume_of_symbol

Get order book of a symbol with the desired volume for market depth search An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

api.exchange.cryptomkt.com/#order-books

Params

String symbol

A symbol id

float volume

Optional. Desired volume for market depth search



297
298
299
# File 'lib/cryptomarket/client.rb', line 297

def get_orderbook_volume(symbol:, volume: nil)
  public_get("public/orderbook/#{symbol}", { volume: volume })
end

#get_orderbooks(symbols: nil, depth: nil) ⇒ Object

Get a Hash of orderbooks for all symbols or for the specified symbols An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

api.exchange.cryptomkt.com/#order-books

Params

Array[String] symbols

Optional. A list of symbol ids

Integer depth

Optional. Order Book depth. Default value is 100. Set to 0 to view the full Order Book



267
268
269
# File 'lib/cryptomarket/client.rb', line 267

def get_orderbooks(symbols: nil, depth: nil)
  public_get('public/orderbook', { symbols: symbols, depth: depth })
end

#get_price_history(to:, from: nil, till: nil, since: nil, limit: nil, period: nil, sort: nil) ⇒ Object

Get quotation prices history

Requires no API key Access Rights

api.exchange.cryptomkt.com/#prices

Params

String to

Target currency code

String from

Optional. Source currency rate

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’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String since

Optional. Initial value of the queried interval

String until

Optional. Last value of the queried interval

Integer limit

Optional. Prices per currency pair. Defaul is 1. Min is 1. Max is 1_000



178
179
180
181
182
183
# File 'lib/cryptomarket/client.rb', line 178

def get_price_history(to:, from: nil, till: nil, since: nil, limit: nil, period: nil, sort: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    'public/price/history',
    { to: to, from: from, till: till, since: since, limit: limit, period: period, sort: sort }
  )
end

#get_prices(to:, from: nil) ⇒ Object

Get a Hash of quotation prices of currencies

Requires no API key Access Rights

api.exchange.cryptomkt.com/#prices

Params

String to

Target currency code

String from

Optional. Source currency rate



159
160
161
# File 'lib/cryptomarket/client.rb', line 159

def get_prices(to:, from: nil)
  public_get('public/price/rate', { to: to, from: from })
end

#get_spot_orders_history(client_order_id: nil, symbol: nil, sort: nil, by: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object

Get all the spot orders Orders without executions are deleted after 24 hours ‘from’ param and ‘till’ param must have the same format, both id or both timestamp

Requires the “Orderbook, History, Trading balance” API key Access Right

api.exchange.cryptomkt.com/#spot-orders-history

Params

String symbol

Optional. Filter orders by symbol

String by

Optional. Sorting parameter. ‘id’ or ‘timestamp’. Default is ‘timestamp’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval

String till

Optional. Last value of the queried interval

Integer limit

Optional. Prices per currency pair. Defaul is 100. Max is 1_000

Integer offset

Optional. Default is 0. Max is 100_000



647
648
649
650
651
652
653
654
655
656
# File 'lib/cryptomarket/client.rb', line 647

def get_spot_orders_history( # rubocop:disable Metrics/ParameterLists
  client_order_id: nil, symbol: nil, sort: nil, by: nil, from: nil,
  till: nil, limit: nil, offset: nil
)
  get(
    'spot/history/order',
    { client_order_id: client_order_id, symbol: symbol, sort: sort,
      by: by, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_spot_trades_history(order_id: nil, symbol: nil, sort: nil, by: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object

Get the user’s spot trading history

Requires the “Orderbook, History, Trading balance” API key Access Right

api.exchange.cryptomkt.com/#spot-trades-history

Params

String order id

Optional. Order unique identifier as assigned by the exchange

String symbol

Optional. Filter orders by symbol

String by

Optional. Sorting parameter. ‘id’ or ‘timestamp’. Default is ‘timestamp’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String from

Optional. Initial value of the queried interval

String till

Optional. Last value of the queried interval

Integer limit

Optional. Prices per currency pair. Defaul is 100. Max is 1_000

Integer offset

Optional. Default is 0. Max is 100_000



674
675
676
677
678
679
680
681
682
683
# File 'lib/cryptomarket/client.rb', line 674

def get_spot_trades_history( # rubocop:disable Metrics/ParameterLists
  order_id: nil, symbol: nil, sort: nil, by: nil, from: nil,
  till: nil, limit: nil, offset: nil
)
  get(
    'spot/history/trade',
    { order_id: order_id, symbol: symbol, sort: sort,
      by: by, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_spot_trading_balance(currency:) ⇒ Object Also known as: get_spot_trading_balance_of_currency, get_spot_trading_balance_by_currency

Get the user spot trading balance of a currency

Requires the “Orderbook, History, Trading balance” API key Access Right

api.exchange.cryptomkt.com/#get-spot-trading-balance

Params

String currency

The currency code to query the balance



426
427
428
429
430
# File 'lib/cryptomarket/client.rb', line 426

def get_spot_trading_balance(currency:)
  balance = get("spot/balance/#{currency}")
  balance['currency'] = currency
  balance
end

#get_spot_trading_balancesObject

Get the user’s spot trading balance for all currencies with balance

Requires the “Orderbook, History, Trading balance” API key Access Right

api.exchange.cryptomkt.com/#get-spot-trading-balance



413
414
415
# File 'lib/cryptomarket/client.rb', line 413

def get_spot_trading_balances # rubocop:disable Naming/AccessorMethodName
  get('spot/balance')
end

#get_sub_account_balance(sub_account_id:) ⇒ Object

Returns non-zero balance values by sub-account Report will include the wallet and Trading balances for each currency It is functional with no regard to the state of a sub-account

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-sub-account-balance

Params

String sub_account_id

The id of the sub-account



1246
1247
1248
1249
1250
1251
1252
# File 'lib/cryptomarket/client.rb', line 1246

def (
  sub_account_id:
)
  get(
    "sub-account/balance/#{}"
  )['result']
end

#get_sub_account_crypto_address(sub_account_id:, currency:) ⇒ Object

Returns sub-account crypto address for currency

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-sub-account-crypto-address

Params

String sub_account_id

The id of the sub-account

String currency

The currency of the address



1263
1264
1265
1266
1267
1268
1269
1270
# File 'lib/cryptomarket/client.rb', line 1263

def (
  sub_account_id:,
  currency:
)
  get(
    "sub-account/crypto/address/#{}/#{currency}"
  )['result']['address']
end

#get_sub_account_listObject

Returns list of sub-accounts per a super account.

Requires no API key Access Rights.

api.exchange.cryptomkt.com/#sub-accounts



1110
1111
1112
1113
1114
# File 'lib/cryptomarket/client.rb', line 1110

def  # rubocop:disable Naming/AccessorMethodName
  get(
    'sub-account'
  )['result']
end

#get_symbol(symbol:) ⇒ Object

Get a symbol by its id A symbol is the combination of the base currency (first one) and quote currency (second one)

Requires no API key Access Rights

api.exchange.cryptomkt.com/#symbols

Params

String symbol

A symbol id



119
120
121
# File 'lib/cryptomarket/client.rb', line 119

def get_symbol(symbol:)
  public_get("public/symbol/#{symbol}")
end

#get_symbols(symbols: nil) ⇒ Object

Get a Hash of all symbols or for specified symbols. indexed by id A symbol is the combination of the base currency (first one) and quote currency (second one)

Requires no API key Access Rights

api.exchange.cryptomkt.com/#symbols

Params

Array[String] symbols

Optional. A list of symbol ids



105
106
107
# File 'lib/cryptomarket/client.rb', line 105

def get_symbols(symbols: nil)
  public_get('public/symbol', { symbols: symbols })
end

#get_ticker(symbol:) ⇒ Object Also known as: get_ticker_by_symbol, get_ticker_of_symbol

Get the ticker of a symbol

Requires no API key Access Rights

api.exchange.cryptomkt.com/#tickers

Params

String symbol

A symbol id



145
146
147
# File 'lib/cryptomarket/client.rb', line 145

def get_ticker(symbol:)
  public_get("public/ticker/#{symbol}")
end

#get_ticker_price(symbol:) ⇒ Object Also known as: get_ticker_price_by_symbol, get_ticker_price_of_symbol

Get ticker’s last prices of a symbol

Requires no API key Access Rights

api.exchange.cryptomkt.com/#prices

Params

String symbol

A symbol id



207
208
209
# File 'lib/cryptomarket/client.rb', line 207

def get_ticker_price(symbol:)
  public_get("public/price/ticker/#{symbol}")
end

#get_ticker_prices(symbols: nil) ⇒ Object

Get a Hash of the ticker’s last prices for all symbols or for the specified symbols

Requires no API key Access Rights

api.exchange.cryptomkt.com/#prices

Params

Array[String] symbols

Optional. A list of symbol ids



194
195
196
# File 'lib/cryptomarket/client.rb', line 194

def get_ticker_prices(symbols: nil)
  public_get('public/price/ticker', { symbols: symbols })
end

#get_tickers(symbols: nil) ⇒ Object

Get a Hash of tickers for all symbols or for specified symbols. indexed by symbol

Requires no API key Access Rights

api.exchange.cryptomkt.com/#tickers

Params

Array[String] symbols

Optional. A list of symbol ids



132
133
134
# File 'lib/cryptomarket/client.rb', line 132

def get_tickers(symbols: nil)
  public_get('public/ticker', { symbols: symbols })
end

#get_trades(symbols: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object

Get a Hash of trades for all symbols or for specified symbols ‘from’ param and ‘till’ param must have the same format, both id or both timestamp

Requires no API key Access Rights

api.exchange.cryptomkt.com/#trades

Params

Array[String] symbols

Optional. A list of symbol ids

String by

Optional. Sorting parameter. ‘id’ or ‘timestamp’. Default is ‘timestamp’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String since

Optional. Initial value of the queried interval

String until

Optional. Last value of the queried interval

Integer limit

Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000



226
227
228
229
230
231
# File 'lib/cryptomarket/client.rb', line 226

def get_trades(symbols: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    'public/trades/',
    { symbols: symbols, by: by, sort: sort, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_trades_by_symbol(symbol: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object Also known as: get_trades_of_symbol

Get trades of a symbol ‘from’ param and ‘till’ param must have the same format, both id or both timestamp

Requires no API key Access Rights

api.exchange.cryptomkt.com/#trades

Params

String symbol

A symbol id

String by

Optional. Sorting parameter. ‘id’ or ‘timestamp’. Default is ‘timestamp’

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

String since

Optional. Initial value of the queried interval

String until

Optional. Last value of the queried interval

Integer limit

Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1_000

Integer offset

Optional. Default is 0. Min is 0. Max is 100_000



249
250
251
252
253
254
# File 'lib/cryptomarket/client.rb', line 249

def get_trades_by_symbol(symbol: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists
  public_get(
    "public/trades/#{symbol}",
    { by: by, sort: sort, from: from, till: till, limit: limit, offset: offset }
  )
end

#get_trading_commission(symbol:) ⇒ Object Also known as: get_trading_commission_of_symbol, get_trading_commission_by_symbol

Get the personal trading commission rate of a symbol

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#get-trading-commission

Params

String symbol

The symbol of the commission rate



620
621
622
623
624
# File 'lib/cryptomarket/client.rb', line 620

def get_trading_commission(symbol:)
  commission = get("spot/fee/#{symbol}")
  commission['symbol'] = symbol
  commission
end

#get_transaction(id:) ⇒ Object

Get a transaction by its identifier

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-transactions-history

Params

String id

The identifier of the transaction



1051
1052
1053
# File 'lib/cryptomarket/client.rb', line 1051

def get_transaction(id:)
  get("wallet/transactions/#{id}")
end

#get_transaction_history(currency: nil, from: nil, till: nil, types: nil, subtypes: nil, statuses: nil, currencies: nil, networks: nil, id_from: nil, id_till: nil, tx_ids: nil, order_by: nil, sort: nil, limit: nil, offset: nil, group_transactions: nil) ⇒ Object

Get the transaction history of the account Important:

- The list of supported transaction types may be expanded in future versions
- Some transaction subtypes are reserved for future use and do not purport to provide any functionality on the platform
- The list of supported transaction subtypes may be expanded in future versions

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#get-transactions-history

Params

Array[String] tx_ids

Optional. List of transaction identifiers to query

Array[String] types

Optional. List of transaction types to query. valid types are: ‘DEPOSIT’, ‘WITHDRAW’, ‘TRANSFER’ and ‘SWAP’

Array[String] subtyes

Optional. List of transaction subtypes to query. valid subtypes are: ‘UNCLASSIFIED’, ‘BLOCKCHAIN’, ‘AIRDROP’, ‘AFFILIATE’, ‘STAKING’, ‘BUY_CRYPTO’, ‘OFFCHAIN’, ‘FIAT’, ‘SUB_ACCOUNT’, ‘WALLET_TO_SPOT’, ‘SPOT_TO_WALLET’, ‘WALLET_TO_DERIVATIVES’, ‘DERIVATIVES_TO_WALLET’, ‘CHAIN_SWITCH_FROM’, ‘CHAIN_SWITCH_TO’ and ‘INSTANT_EXCHANGE’

Array[String] statuses

Optional. List of statuses to query. valid subtypes are: ‘CREATED’, ‘PENDING’, ‘FAILED’, ‘SUCCESS’ and ‘ROLLED_BACK’

Array[String] currencies

Optional. Currency codes of the transactions to fetch

Array[String] networks

Optional. Network codes of the transactions to fetch

String order_by

Optional. sorting parameter.‘created_at’, ‘updated_at’, ‘last_activity_at’ ‘or ’id’.

String from

Optional. Optional. Interval initial value (inclusive). The value type depends on order_by

String till

Optional. Interval end value (inclusive). The value type depends on order_BY

String id_from

Optional. Interval initial value when ordering by id. Min is 0

String id_till

Optional. Interval end value when ordering by id. Min is 0

String sort

Optional. Sort direction. ‘ASC’ or ‘DESC’. Default is ‘DESC’

Integer limit

Optional. Transactions per query. Defaul is 100. Max is 1_000

Integer offset

Optional. Default is 0. Max is 100_000

bool group_transactions

Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false



1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# File 'lib/cryptomarket/client.rb', line 1029

def get_transaction_history( # rubocop:disable Metrics/ParameterLists
  currency: nil, from: nil, till: nil, types: nil, subtypes: nil, statuses: nil,
  currencies: nil, networks: nil, id_from: nil, id_till: nil, tx_ids: nil, order_by: nil,
  sort: nil, limit: nil, offset: nil, group_transactions: nil
)
  get(
    'wallet/transactions',
    { currency: currency, from: from, till: till, types: types, subtypes: subtypes, statuses: statuses,
      currencies: currencies, networks: networks, id_from: id_from, id_till: id_till, tx_ids: tx_ids,
      order_by: order_by, sort: sort, limit: limit, offset: offset, group_transactions: group_transactions }
  )
end

#get_wallet_balance(currency:) ⇒ Object Also known as: get_wallet_balance_of_currency, get_wallet_balance_by_currency

Get the user’s wallet balance of a currency

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#wallet-balance

Params

String currency

The currency code to query the balance



708
709
710
# File 'lib/cryptomarket/client.rb', line 708

def get_wallet_balance(currency:)
  get("wallet/balance/#{currency}")
end

#get_wallet_balancesObject

Get the user’s wallet balance for all currencies with balance

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#wallet-balance



695
696
697
# File 'lib/cryptomarket/client.rb', line 695

def get_wallet_balances # rubocop:disable Naming/AccessorMethodName
  get('wallet/balance')
end

#offchain_available?(currency:, address:, payment_id: nil) ⇒ Boolean

get the status of the offchain

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#check-if-offchain-is-available

Params

String currency

currency code

String address

address identifier

String payment id

Optional.

Returns:

  • (Boolean)


1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/cryptomarket/client.rb', line 1066

def offchain_available?(
  currency:,
  address:,
  payment_id: nil
)
  post(
    'wallet/crypto/check-offchain-available',
    {
      currency: currency,
      address: address,
      payment_id: payment_id
    }
  )['result']
end

#patch(endpoint, params = nil) ⇒ Object



34
35
36
# File 'lib/cryptomarket/client.rb', line 34

def patch(endpoint, params = nil)
  @http_manager.make_request(method: 'patch', endpoint: endpoint, params: params)
end

#post(endpoint, params = nil) ⇒ Object



26
27
28
# File 'lib/cryptomarket/client.rb', line 26

def post(endpoint, params = nil)
  @http_manager.make_post_request(method: 'post', endpoint: endpoint, params: params)
end

#public_get(endpoint, params = nil) ⇒ Object



18
19
20
# File 'lib/cryptomarket/client.rb', line 18

def public_get(endpoint, params = nil)
  @http_manager.make_request(method: 'get', endpoint: endpoint, params: params, public: true)
end

#put(endpoint, params = nil) ⇒ Object



30
31
32
# File 'lib/cryptomarket/client.rb', line 30

def put(endpoint, params = nil)
  @http_manager.make_request(method: 'put', endpoint: endpoint, params: params)
end

#replace_spot_order(client_order_id:, new_client_order_id:, quantity:, price: nil, strict_validate: nil) ⇒ Object

Replaces a spot order For fee, for price accuracy and quantity, and for order status information see the api docs

Requires the “Place/cancel orders” API key Access Right

api.exchange.cryptomkt.com/#replace-spot-order

Params

String client_order_id

client order id of the old order

String new client order id

client order id for the new order

String quantity

Order quantity

bool strict_validate

Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol’s tick_size and quantity_increment

String price

Required if order type is ‘limit’, ‘stopLimit’, or ‘takeProfitLimit’. Order price



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/cryptomarket/client.rb', line 559

def replace_spot_order(
  client_order_id:,
  new_client_order_id:,
  quantity:,
  price: nil,
  strict_validate: nil
)
  patch(
    "spot/order/#{client_order_id}",
    {
      new_client_order_id: new_client_order_id,
      price: price,
      quantity: quantity,
      strict_validate: strict_validate
    }
  )
end

#transfer_between_wallet_and_exchange(currency:, amount:, source:, destination:) ⇒ Object

Transfer funds between account types ‘source’ param and ‘destination’ param must be different account types

Requires the “Payment information” API key Access Right

api.exchange.cryptomkt.com/#transfer-between-wallet-and-exchange

Params

String currency

currency code for transfering

float amount

amount to be transfered

String source

transfer source account type. Either ‘wallet’ or ‘spot’

String destination

transfer source account type. Either ‘wallet’ or ‘spot’



966
967
968
969
970
971
972
973
974
975
976
# File 'lib/cryptomarket/client.rb', line 966

def transfer_between_wallet_and_exchange(currency:, amount:, source:, destination:)
  post(
    'wallet/transfer',
    {
      currency: currency,
      amount: amount,
      source: source,
      destination: destination
    }
  )
end

#transfer_funds(sub_account_id:, amount:, currency:, type:) ⇒ Object

Transfers funds from the super-account to a sub-account or from a sub-account to the super-account and returns the transaction id

Requires the “Withdraw cryptocurrencies” API key Access Right

api.exchange.cryptomkt.com/#transfer-funds

Params

String sub_account_ids

id of the sub-account to transfer funds from/to

String amount

amount to transfer

String currency

currency to transfer

String type

Direction of transfer, “to_sub_account” or “from_sub_account”



1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# File 'lib/cryptomarket/client.rb', line 1174

def transfer_funds(
  sub_account_id:,
  amount:,
  currency:,
  type:
)
  post(
    'sub-account/transfer',
    {
      sub_account_id: ,
      amount: amount,
      currency: currency,
      type: type
    }
  )['result']
end

#transfer_money_to_another_user(currency:, amount:, by:, identifier:) ⇒ Object

Transfer funds to another user

Requires the “Withdraw cryptocurrencies” API key Access Right

api.exchange.cryptomkt.com/#transfer-money-to-another-user

Params

String currency

currency code

float amount

amount to be transfered

String transfer by

type of identifier. Either ‘email’ or ‘username’

String identifier

the email or username of the recieving user



990
991
992
993
994
995
996
997
998
999
1000
# File 'lib/cryptomarket/client.rb', line 990

def transfer_money_to_another_user(currency:, amount:, by:, identifier:)
  post(
    'wallet/internal/withdraw',
    {
      currency: currency,
      amount: amount,
      by: by,
      identifier: identifier
    }
  )
end

#withdraw_crypto(currency:, amount:, address:, network_code: nil, payment_id: nil, include_fee: nil, auto_commit: nil, use_offchain: nil, public_comment: nil) ⇒ Object

Please take note that changing security settings affects withdrawals:

  • It is impossible to withdraw funds without enabling the two-factor authentication (2FA)

  • Password reset blocks withdrawals for 72 hours

  • Each time a new address is added to the whitelist, it takes 48 hours before that address becomes active for withdrawal

Successful response to the request does not necessarily mean the resulting transaction got executed immediately. It has to be processed first and may eventually be rolled back To see whether a transaction has been finalized, call #get_transaction

Requires the “Withdraw cryptocurrencies” API key Access Right

api.exchange.cryptomkt.com/#withdraw-crypto

Params

String currency

currency code of the crypto to withdraw

float amount

amount to be sent to the specified address

String address

address identifier

String network_code

Optional. network code

String payment id

Optional.

bool include fee

Optional. If true then the amount includes fees. Default is false

bool auto commit

Optional. If false then you should commit or rollback the transaction in an hour. Used in two phase commit schema. Default is true

String use offchain

Optional. Whether the withdrawal may be comitted offchain. Accepted values are ‘never’, ‘optionaly’ and ‘required’.

String public comment

Optional. Maximum lenght is 255



807
808
809
810
811
812
813
814
815
816
817
# File 'lib/cryptomarket/client.rb', line 807

def withdraw_crypto( # rubocop:disable Metrics/ParameterLists
  currency:, amount:, address:, network_code: nil, payment_id: nil,
  include_fee: nil, auto_commit: nil, use_offchain: nil, public_comment: nil
)
  post(
    'wallet/crypto/withdraw',
    { currency: currency, amount: amount, address: address, network_code: network_code,
      payment_id: payment_id, include_fee: include_fee, auto_commit: auto_commit,
      use_offchain: use_offchain, public_comment: public_comment }
  )['id']
end

#withdraw_crypto_commit(id:) ⇒ Object

Commit a withdrawal

Requires the “Withdraw cryptocurrencies” API key Access Right

api.exchange.cryptomkt.com/#withdraw-crypto-commit-or-rollback

Params

String id

the withdrawal transaction identifier



828
829
830
# File 'lib/cryptomarket/client.rb', line 828

def withdraw_crypto_commit(id:)
  put("wallet/crypto/withdraw/#{id}")['result']
end

#withdraw_crypto_rollback(id:) ⇒ Object

Rollback a withdrawal

Requires the “Withdraw cryptocurrencies” API key Access Right

api.exchange.cryptomkt.com/#withdraw-crypto-commit-or-rollback

Params

String id

the withdrawal transaction identifier



841
842
843
# File 'lib/cryptomarket/client.rb', line 841

def withdraw_crypto_rollback(id:)
  delete("wallet/crypto/withdraw/#{id}")['result']
end