Class: Cryptomarket::Client
- Inherits:
-
Object
- Object
- Cryptomarket::Client
- 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
-
#activate_sub_accounts(sub_account_ids:) ⇒ Object
Activates sub-accounts listed.
-
#cancel_all_spot_orders ⇒ Object
Cancel all active spot orders.
-
#cancel_spot_order(client_order_id:) ⇒ Object
Cancel the order with the client order id.
-
#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.
-
#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.
-
#create_deposit_crypto_address(currency:, network_code: nil) ⇒ Object
Creates a new address for a currency.
-
#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.
-
#create_spot_order_list(contingency_type:, orders:, order_list_id: nil) ⇒ Object
creates a list of spot orders.
-
#crypto_address_belongs_to_current_account?(address:) ⇒ Boolean
Check if an address is from this account.
- #delete(endpoint, params = nil) ⇒ Object
-
#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.
- #get(endpoint, params = nil) ⇒ Object
-
#get_acl_settings(sub_account_ids:) ⇒ Object
Returns a list of withdrawal settings for sub-accounts listed.
-
#get_active_spot_order(client_order_id:) ⇒ Object
Get an active spot order by its client order id.
-
#get_all_active_spot_orders(symbol: nil) ⇒ Object
Get the user’s active spot orders.
-
#get_all_trading_commission ⇒ Object
Get the personal trading commission rates for all symbols.
-
#get_amount_locks(currency: nil, active: nil, limit: nil, offset: nil, from: nil, till: nil) ⇒ Object
Get the list of amount locks.
-
#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 Candels are used for OHLC representation The result contains candles with non-zero volume only (no trades = no candles).
-
#get_candles_by_symbol(symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object
Get candles of a symbol Candels are used for OHLC representation The result contains candles with non-zero volume only (no trades = no candles).
-
#get_currencies(currencies: nil, preferred_network: nil) ⇒ Object
Get a Hash of all currencies or specified currencies.
-
#get_currency(currency:) ⇒ Object
Get the data of a currency.
-
#get_deposit_crypto_address(currency: nil, network_code: nil) ⇒ Object
Get the current addresses of a currency of the user.
-
#get_deposit_crypto_addresses ⇒ Object
Get a list with the current addresses of the user.
-
#get_estimate_withdrawal_fee(currency:, amount:, network_code: nil) ⇒ Object
Get an estimate of the withdrawal fee.
-
#get_estimate_withdrawal_fees(fee_requests) ⇒ Object
Get an estimates for withdrawal fees of currencies.
-
#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.
-
#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.
-
#get_orderbook(symbol:, depth: nil) ⇒ Object
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.
-
#get_orderbook_volume(symbol:, volume: nil) ⇒ Object
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.
-
#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.
-
#get_price_history(to:, from: nil, till: nil, since: nil, limit: nil, period: nil, sort: nil) ⇒ Object
Get quotation prices history.
-
#get_prices(to:, from: nil) ⇒ Object
Get a Hash of quotation prices of currencies.
-
#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.
-
#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.
-
#get_spot_trading_balance(currency:) ⇒ Object
Get the user spot trading balance of a currency.
-
#get_spot_trading_balances ⇒ Object
Get the user’s spot trading balance for all currencies with balance.
-
#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.
-
#get_sub_account_crypto_address(sub_account_id:, currency:) ⇒ Object
Returns sub-account crypto address for currency.
-
#get_sub_account_list ⇒ Object
Returns list of sub-accounts per a super account.
-
#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).
-
#get_symbols(symbols: nil) ⇒ Object
Get a Hash of all symbols or for specified symbols.
-
#get_ticker(symbol:) ⇒ Object
Get the ticker of a symbol.
-
#get_ticker_price(symbol:) ⇒ Object
Get ticker’s last prices of a symbol.
-
#get_ticker_prices(symbols: nil) ⇒ Object
Get a Hash of the ticker’s last prices for all symbols or for the specified symbols.
-
#get_tickers(symbols: nil) ⇒ Object
Get a Hash of tickers for all symbols or for specified symbols.
-
#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.
-
#get_trades_by_symbol(symbol: nil, by: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object
Get trades of a symbol ‘from’ param and ‘till’ param must have the same format, both id or both timestamp.
-
#get_trading_commission(symbol:) ⇒ Object
Get the personal trading commission rate of a symbol.
-
#get_transaction(id:) ⇒ Object
Get a transaction by its identifier.
-
#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.
-
#get_wallet_balance(currency:) ⇒ Object
Get the user’s wallet balance of a currency.
-
#get_wallet_balances ⇒ Object
Get the user’s wallet balance for all currencies with balance.
-
#initialize(api_key: nil, api_secret: nil, window: nil) ⇒ Client
constructor
rubocop:disable Metrics/ClassLength.
-
#offchain_available?(currency:, address:, payment_id: nil) ⇒ Boolean
get the status of the offchain.
- #patch(endpoint, params = nil) ⇒ Object
- #post(endpoint, params = nil) ⇒ Object
- #public_get(endpoint, params = nil) ⇒ Object
- #put(endpoint, params = nil) ⇒ Object
-
#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.
-
#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.
-
#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.
-
#transfer_money_to_another_user(currency:, amount:, by:, identifier:) ⇒ Object
Transfer funds to another user.
-
#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.
-
#withdraw_crypto_commit(id:) ⇒ Object
Commit a withdrawal.
-
#withdraw_crypto_rollback(id:) ⇒ Object
Rollback a withdrawal.
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
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/cryptomarket/client.rb', line 1035 def activate_sub_accounts( sub_account_ids: ) post( 'sub-account/activate', { sub_account_ids: sub_account_ids } )['result'] end |
#cancel_all_spot_orders ⇒ Object
Cancel all active spot orders
Requires the “Place/cancel orders” API key Access Right
510 511 512 |
# File 'lib/cryptomarket/client.rb', line 510 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
523 524 525 |
# File 'lib/cryptomarket/client.rb', line 523 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
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 |
# File 'lib/cryptomarket/client.rb', line 1109 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: 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 |
#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
813 814 815 816 817 818 819 820 821 822 |
# File 'lib/cryptomarket/client.rb', line 813 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
677 678 679 |
# File 'lib/cryptomarket/client.rb', line 677 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.
406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/cryptomarket/client.rb', line 406 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
456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/cryptomarket/client.rb', line 456 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
833 834 835 |
# File 'lib/cryptomarket/client.rb', line 833 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
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 |
# File 'lib/cryptomarket/client.rb', line 1016 def freeze_sub_accounts( sub_account_ids: ) post( 'sub-account/freeze', { sub_account_ids: 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
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'lib/cryptomarket/client.rb', line 1084 def get_acl_settings( sub_account_ids: ) get( 'sub-account/acl', { sub_account_ids: 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
380 381 382 |
# File 'lib/cryptomarket/client.rb', line 380 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
367 368 369 |
# File 'lib/cryptomarket/client.rb', line 367 def get_all_active_spot_orders(symbol: nil) get('spot/order', { symbol: symbol }) end |
#get_all_trading_commission ⇒ Object
Get the personal trading commission rates for all symbols
Requires the “Place/cancel orders” API key Access Right
533 534 535 |
# File 'lib/cryptomarket/client.rb', line 533 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 1000
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
979 980 981 982 983 984 985 986 |
# File 'lib/cryptomarket/client.rb', line 979 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_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 Candels 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 1000
298 299 300 301 302 303 |
# File 'lib/cryptomarket/client.rb', line 298 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
Get candles of a symbol Candels 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 1000
Integer
offset
-
Optional. Default is 0. Min is 0. Max is 100000
322 323 324 325 326 327 |
# File 'lib/cryptomarket/client.rb', line 322 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_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
56 57 58 59 60 61 |
# File 'lib/cryptomarket/client.rb', line 56 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
72 73 74 |
# File 'lib/cryptomarket/client.rb', line 72 def get_currency(currency:) public_get("public/currency/#{currency}") end |
#get_deposit_crypto_address(currency: nil, network_code: nil) ⇒ Object
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
660 661 662 663 664 665 |
# File 'lib/cryptomarket/client.rb', line 660 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_addresses ⇒ Object
Get a list with the current addresses of the user
Requires the “Payment information” API key Access Right
644 645 646 |
# File 'lib/cryptomarket/client.rb', line 644 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
795 796 797 798 |
# File 'lib/cryptomarket/client.rb', line 795 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”
780 781 782 783 |
# File 'lib/cryptomarket/client.rb', line 780 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
692 693 694 |
# File 'lib/cryptomarket/client.rb', line 692 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
707 708 709 |
# File 'lib/cryptomarket/client.rb', line 707 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
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
263 264 265 |
# File 'lib/cryptomarket/client.rb', line 263 def get_orderbook(symbol:, depth: nil) public_get("public/orderbook/#{symbol}", { depth: depth }) end |
#get_orderbook_volume(symbol:, volume: nil) ⇒ Object
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
278 279 280 |
# File 'lib/cryptomarket/client.rb', line 278 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
248 249 250 |
# File 'lib/cryptomarket/client.rb', line 248 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 1000
159 160 161 162 163 164 |
# File 'lib/cryptomarket/client.rb', line 159 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
140 141 142 |
# File 'lib/cryptomarket/client.rb', line 140 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 1000
Integer
offset
-
Optional. Default is 0. Max is 100000
573 574 575 576 577 578 579 580 581 582 |
# File 'lib/cryptomarket/client.rb', line 573 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 1000
Integer
offset
-
Optional. Default is 0. Max is 100000
600 601 602 603 604 605 606 607 608 609 |
# File 'lib/cryptomarket/client.rb', line 600 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
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
352 353 354 355 356 |
# File 'lib/cryptomarket/client.rb', line 352 def get_spot_trading_balance(currency:) balance = get("spot/balance/#{currency}") balance['currency'] = currency balance end |
#get_spot_trading_balances ⇒ Object
Get the user’s spot trading balance for all currencies with balance
Requires the “Orderbook, History, Trading balance” API key Access Right
339 340 341 |
# File 'lib/cryptomarket/client.rb', line 339 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
1130 1131 1132 1133 1134 1135 1136 |
# File 'lib/cryptomarket/client.rb', line 1130 def get_sub_account_balance( sub_account_id: ) get( "sub-account/balance/#{sub_account_id}" )['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
1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/cryptomarket/client.rb', line 1147 def get_sub_account_crypto_address( sub_account_id:, currency: ) get( "sub-account/crypto/address/#{sub_account_id}/#{currency}" )['result']['address'] end |
#get_sub_account_list ⇒ Object
Returns list of sub-accounts per a super account.
Requires no API key Access Rights.
994 995 996 997 998 |
# File 'lib/cryptomarket/client.rb', line 994 def get_sub_account_list # 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
100 101 102 |
# File 'lib/cryptomarket/client.rb', line 100 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
86 87 88 |
# File 'lib/cryptomarket/client.rb', line 86 def get_symbols(symbols: nil) public_get('public/symbol', { symbols: symbols }) end |
#get_ticker(symbol:) ⇒ Object
Get the ticker of a symbol
Requires no API key Access Rights
api.exchange.cryptomkt.com/#tickers
Params
String
symbol
-
A symbol id
126 127 128 |
# File 'lib/cryptomarket/client.rb', line 126 def get_ticker(symbol:) public_get("public/ticker/#{symbol}") end |
#get_ticker_price(symbol:) ⇒ Object
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
188 189 190 |
# File 'lib/cryptomarket/client.rb', line 188 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
175 176 177 |
# File 'lib/cryptomarket/client.rb', line 175 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
113 114 115 |
# File 'lib/cryptomarket/client.rb', line 113 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 1000
207 208 209 210 211 212 |
# File 'lib/cryptomarket/client.rb', line 207 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
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 1000
Integer
offset
-
Optional. Default is 0. Min is 0. Max is 100000
230 231 232 233 234 235 |
# File 'lib/cryptomarket/client.rb', line 230 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
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
546 547 548 549 550 |
# File 'lib/cryptomarket/client.rb', line 546 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
935 936 937 |
# File 'lib/cryptomarket/client.rb', line 935 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’ or ‘id’. Default is ‘created_at’
String
from
-
Optional. Interval initial value when ordering by ‘created_at’. As Datetime
String
till
-
Optional. Interval end value when ordering by ‘created_at’. As Datetime
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 1000
Integer
offset
-
Optional. Default is 0. Max is 100000
bool
group_transactions
-
Optional. Flag indicating whether the returned transactions will be parts of a single operation. Default is false
913 914 915 916 917 918 919 920 921 922 923 924 |
# File 'lib/cryptomarket/client.rb', line 913 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
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
634 635 636 |
# File 'lib/cryptomarket/client.rb', line 634 def get_wallet_balance(currency:) get("wallet/balance/#{currency}") end |
#get_wallet_balances ⇒ Object
Get the user’s wallet balance for all currencies with balance
Requires the “Payment information” API key Access Right
621 622 623 |
# File 'lib/cryptomarket/client.rb', line 621 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.
950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
# File 'lib/cryptomarket/client.rb', line 950 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
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/cryptomarket/client.rb', line 485 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’
850 851 852 853 854 855 856 857 858 859 860 |
# File 'lib/cryptomarket/client.rb', line 850 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”
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 |
# File 'lib/cryptomarket/client.rb', line 1058 def transfer_funds( sub_account_id:, amount:, currency:, type: ) post( 'sub-account/transfer', { sub_account_id: 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
874 875 876 877 878 879 880 881 882 883 884 |
# File 'lib/cryptomarket/client.rb', line 874 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
733 734 735 736 737 738 739 740 741 742 743 |
# File 'lib/cryptomarket/client.rb', line 733 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
754 755 756 |
# File 'lib/cryptomarket/client.rb', line 754 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
767 768 769 |
# File 'lib/cryptomarket/client.rb', line 767 def withdraw_crypto_rollback(id:) delete("wallet/crypto/withdraw/#{id}")['result'] end |