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_all_trading_commissions ⇒ Object
-
#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 Candles 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 Candles are used for OHLC representation The result contains candles with non-zero volume only (no trades = no candles).
- #get_candles_of_symbol ⇒ Object
-
#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.
-
#get_converted_candles_by_symbol(target_currency:, symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object
Gets OHLCV data regarding the last price converted to the target currency for the specified symbol.
- #get_converted_candles_of_symbol ⇒ Object
-
#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_address_by_cyrrency ⇒ Object
- #get_deposit_crypto_address_of_cyrrency ⇒ Object
-
#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_by_symbol ⇒ Object
- #get_orderbook_of_symbol ⇒ Object
-
#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_orderbook_volume_by_symbol ⇒ Object
- #get_orderbook_volume_of_symbol ⇒ Object
-
#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_balance_by_currency ⇒ Object
-
#get_spot_trading_balance_of_currency ⇒ Object
spot trading.
-
#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_by_symbol ⇒ Object
alias of get ticker.
- #get_ticker_of_symbol ⇒ Object
-
#get_ticker_price(symbol:) ⇒ Object
Get ticker’s last prices of a symbol.
- #get_ticker_price_by_symbol ⇒ Object
- #get_ticker_price_of_symbol ⇒ Object
-
#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_trades_of_symbol ⇒ Object
-
#get_trading_commission(symbol:) ⇒ Object
Get the personal trading commission rate of a symbol.
- #get_trading_commission_by_symbol ⇒ Object
- #get_trading_commission_of_symbol ⇒ Object
-
#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_balance_by_currency ⇒ Object
-
#get_wallet_balance_of_currency ⇒ Object
wallet management.
-
#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
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'lib/cryptomarket/client.rb', line 1121 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
596 597 598 |
# File 'lib/cryptomarket/client.rb', line 596 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
609 610 611 |
# File 'lib/cryptomarket/client.rb', line 609 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
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 |
# File 'lib/cryptomarket/client.rb', line 1195 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
899 900 901 902 903 904 905 906 907 908 |
# File 'lib/cryptomarket/client.rb', line 899 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
763 764 765 |
# File 'lib/cryptomarket/client.rb', line 763 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.
492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/cryptomarket/client.rb', line 492 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
542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/cryptomarket/client.rb', line 542 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
919 920 921 |
# File 'lib/cryptomarket/client.rb', line 919 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
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
# File 'lib/cryptomarket/client.rb', line 1102 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
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File 'lib/cryptomarket/client.rb', line 1170 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
466 467 468 |
# File 'lib/cryptomarket/client.rb', line 466 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
453 454 455 |
# File 'lib/cryptomarket/client.rb', line 453 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
619 620 621 |
# File 'lib/cryptomarket/client.rb', line 619 def get_all_trading_commission # rubocop:disable Naming/AccessorMethodName get('spot/fee') end |
#get_all_trading_commissions ⇒ Object
63 |
# File 'lib/cryptomarket/client.rb', line 63 alias get_all_trading_commissions get_all_trading_commission |
#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
1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/cryptomarket/client.rb', line 1065 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 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
329 330 331 332 333 334 |
# File 'lib/cryptomarket/client.rb', line 329 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 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
353 354 355 356 357 358 |
# File 'lib/cryptomarket/client.rb', line 353 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_candles_of_symbol ⇒ Object
58 |
# File 'lib/cryptomarket/client.rb', line 58 alias get_candles_of_symbol get_candles_by_symbol |
#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
380 381 382 383 384 385 |
# File 'lib/cryptomarket/client.rb', line 380 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
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
408 409 410 411 412 413 |
# File 'lib/cryptomarket/client.rb', line 408 def get_converted_candles_by_symbol(target_currency:, symbol:, period: nil, sort: nil, from: nil, till: nil, limit: nil, offset: nil) # rubocop:disable Metrics/ParameterLists public_get( "public/converted/candles/#{symbol}", { target_currency: target_currency, period: period, sort: sort, from: from, till: till, limit: limit, offset: offset } ) end |
#get_converted_candles_of_symbol ⇒ Object
59 |
# File 'lib/cryptomarket/client.rb', line 59 alias get_converted_candles_of_symbol get_converted_candles_by_symbol |
#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
87 88 89 90 91 92 |
# File 'lib/cryptomarket/client.rb', line 87 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
103 104 105 |
# File 'lib/cryptomarket/client.rb', line 103 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
746 747 748 749 750 751 |
# File 'lib/cryptomarket/client.rb', line 746 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_address_by_cyrrency ⇒ Object
71 |
# File 'lib/cryptomarket/client.rb', line 71 alias get_deposit_crypto_address_by_cyrrency get_deposit_crypto_address |
#get_deposit_crypto_address_of_cyrrency ⇒ Object
70 |
# File 'lib/cryptomarket/client.rb', line 70 alias get_deposit_crypto_address_of_cyrrency get_deposit_crypto_address |
#get_deposit_crypto_addresses ⇒ Object
Get a list with the current addresses of the user
Requires the “Payment information” API key Access Right
730 731 732 |
# File 'lib/cryptomarket/client.rb', line 730 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
881 882 883 884 |
# File 'lib/cryptomarket/client.rb', line 881 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”
866 867 868 869 |
# File 'lib/cryptomarket/client.rb', line 866 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
778 779 780 |
# File 'lib/cryptomarket/client.rb', line 778 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
793 794 795 |
# File 'lib/cryptomarket/client.rb', line 793 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
294 295 296 |
# File 'lib/cryptomarket/client.rb', line 294 def get_orderbook(symbol:, depth: nil) public_get("public/orderbook/#{symbol}", { depth: depth }) end |
#get_orderbook_by_symbol ⇒ Object
54 |
# File 'lib/cryptomarket/client.rb', line 54 alias get_orderbook_by_symbol get_orderbook |
#get_orderbook_of_symbol ⇒ Object
55 |
# File 'lib/cryptomarket/client.rb', line 55 alias get_orderbook_of_symbol get_orderbook |
#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
309 310 311 |
# File 'lib/cryptomarket/client.rb', line 309 def get_orderbook_volume(symbol:, volume: nil) public_get("public/orderbook/#{symbol}", { volume: volume }) end |
#get_orderbook_volume_by_symbol ⇒ Object
56 |
# File 'lib/cryptomarket/client.rb', line 56 alias get_orderbook_volume_by_symbol get_orderbook_volume |
#get_orderbook_volume_of_symbol ⇒ Object
57 |
# File 'lib/cryptomarket/client.rb', line 57 alias get_orderbook_volume_of_symbol get_orderbook_volume |
#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
279 280 281 |
# File 'lib/cryptomarket/client.rb', line 279 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
190 191 192 193 194 195 |
# File 'lib/cryptomarket/client.rb', line 190 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
171 172 173 |
# File 'lib/cryptomarket/client.rb', line 171 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
659 660 661 662 663 664 665 666 667 668 |
# File 'lib/cryptomarket/client.rb', line 659 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
686 687 688 689 690 691 692 693 694 695 |
# File 'lib/cryptomarket/client.rb', line 686 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
438 439 440 441 442 |
# File 'lib/cryptomarket/client.rb', line 438 def get_spot_trading_balance(currency:) balance = get("spot/balance/#{currency}") balance['currency'] = currency balance end |
#get_spot_trading_balance_by_currency ⇒ Object
62 |
# File 'lib/cryptomarket/client.rb', line 62 alias get_spot_trading_balance_by_currency get_spot_trading_balance |
#get_spot_trading_balance_of_currency ⇒ Object
spot trading
61 |
# File 'lib/cryptomarket/client.rb', line 61 alias get_spot_trading_balance_of_currency get_spot_trading_balance |
#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
425 426 427 |
# File 'lib/cryptomarket/client.rb', line 425 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
1216 1217 1218 1219 1220 1221 1222 |
# File 'lib/cryptomarket/client.rb', line 1216 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
1233 1234 1235 1236 1237 1238 1239 1240 |
# File 'lib/cryptomarket/client.rb', line 1233 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.
1080 1081 1082 1083 1084 |
# File 'lib/cryptomarket/client.rb', line 1080 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
131 132 133 |
# File 'lib/cryptomarket/client.rb', line 131 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
117 118 119 |
# File 'lib/cryptomarket/client.rb', line 117 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
157 158 159 |
# File 'lib/cryptomarket/client.rb', line 157 def get_ticker(symbol:) public_get("public/ticker/#{symbol}") end |
#get_ticker_by_symbol ⇒ Object
alias of get ticker
49 |
# File 'lib/cryptomarket/client.rb', line 49 alias get_ticker_by_symbol get_ticker |
#get_ticker_of_symbol ⇒ Object
50 |
# File 'lib/cryptomarket/client.rb', line 50 alias get_ticker_of_symbol get_ticker |
#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
219 220 221 |
# File 'lib/cryptomarket/client.rb', line 219 def get_ticker_price(symbol:) public_get("public/price/ticker/#{symbol}") end |
#get_ticker_price_by_symbol ⇒ Object
51 |
# File 'lib/cryptomarket/client.rb', line 51 alias get_ticker_price_by_symbol get_ticker_price |
#get_ticker_price_of_symbol ⇒ Object
52 |
# File 'lib/cryptomarket/client.rb', line 52 alias get_ticker_price_of_symbol get_ticker_price |
#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
206 207 208 |
# File 'lib/cryptomarket/client.rb', line 206 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
144 145 146 |
# File 'lib/cryptomarket/client.rb', line 144 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
238 239 240 241 242 243 |
# File 'lib/cryptomarket/client.rb', line 238 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 1_000
Integer
offset
-
Optional. Default is 0. Min is 0. Max is 100_000
261 262 263 264 265 266 |
# File 'lib/cryptomarket/client.rb', line 261 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_trades_of_symbol ⇒ Object
53 |
# File 'lib/cryptomarket/client.rb', line 53 alias get_trades_of_symbol get_trades_by_symbol |
#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
632 |
# File 'lib/cryptomarket/client.rb', line 632 alias get_trading_commission get_all_trading_commission |
#get_trading_commission_by_symbol ⇒ Object
66 |
# File 'lib/cryptomarket/client.rb', line 66 alias get_trading_commission get_all_trading_commission |
#get_trading_commission_of_symbol ⇒ Object
65 |
# File 'lib/cryptomarket/client.rb', line 65 alias get_trading_commission get_all_trading_commission |
#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
1021 1022 1023 |
# File 'lib/cryptomarket/client.rb', line 1021 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 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
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 |
# File 'lib/cryptomarket/client.rb', line 999 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
720 721 722 |
# File 'lib/cryptomarket/client.rb', line 720 def get_wallet_balance(currency:) get("wallet/balance/#{currency}") end |
#get_wallet_balance_by_currency ⇒ Object
69 |
# File 'lib/cryptomarket/client.rb', line 69 alias get_wallet_balance_by_currency get_wallet_balance |
#get_wallet_balance_of_currency ⇒ Object
wallet management
68 |
# File 'lib/cryptomarket/client.rb', line 68 alias get_wallet_balance_of_currency get_wallet_balance |
#get_wallet_balances ⇒ Object
Get the user’s wallet balance for all currencies with balance
Requires the “Payment information” API key Access Right
707 708 709 |
# File 'lib/cryptomarket/client.rb', line 707 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.
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
# File 'lib/cryptomarket/client.rb', line 1036 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
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/cryptomarket/client.rb', line 571 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’
936 937 938 939 940 941 942 943 944 945 946 |
# File 'lib/cryptomarket/client.rb', line 936 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”
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 |
# File 'lib/cryptomarket/client.rb', line 1144 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
960 961 962 963 964 965 966 967 968 969 970 |
# File 'lib/cryptomarket/client.rb', line 960 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
819 820 821 822 823 824 825 826 827 828 829 |
# File 'lib/cryptomarket/client.rb', line 819 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
840 841 842 |
# File 'lib/cryptomarket/client.rb', line 840 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
853 854 855 |
# File 'lib/cryptomarket/client.rb', line 853 def withdraw_crypto_rollback(id:) delete("wallet/crypto/withdraw/#{id}")['result'] end |