HitBTC REST & Streaming API version 3.0 provides programmatic access
to HitBTC’s next generation trading engine.
We strongly recommend that our new customers use API version 3.0 to get the best
trading experience. We also recommend that our current traders switch to the
newest version 3.0.
API version 2.0 is still available. For detailed description refer to
API v2.
By using the HitBTC API you confirm that you have read and accepted the
API License Agreement.
DEVELOPMENT GUIDE
API URLs
REST
https://api.hitbtc.com/api/3
Streaming Market Data
wss://api.hitbtc.com/api/3/ws/public
Streaming Trading
wss://api.hitbtc.com/api/3/ws/trading
Streaming Wallet
wss://api.hitbtc.com/api/3/ws/wallet
Demo Environment (Sandbox):
REST
https://api.demo.hitbtc.com/api/3
Streaming Market Data
wss://api.demo.hitbtc.com/api/3/ws/public
Streaming Trading
wss://api.demo.hitbtc.com/api/3/ws/trading
Streaming Wallet
wss://api.demo.hitbtc.com/api/3/ws/wallet
API Explorer
You can explore the API using Swagger UI
including methods requiring authorization.
DateTime Format
All timestamps are returned in ISO 8601 format or UNIX timestamp in milliseconds
(UTC).
Example: "2024-04-03T10:20:49.315Z" or "1614815872000".
Date Format
Some timestamps are returned in ISO 8601 format which includes a calendar date
only.
Example: "2024-04-03".
Number Format
All finance data, e.g., price, quantity, fee, etc., should be arbitrary
precision numbers and have a string representation.
Example: "10.2000058".
Custom Formats
In nested JSON objects, child objects have custom formats which are described in
tables below a place of the first occurrence.
Added POST /api/3/report/{report_type}/{doc_type}: the
transactions report as a CSV, XLSX or PDF
file.
27.08.2026
AMM (auto margin management) and AMR (auto margin replenishment):
the margin settings endpoints, the margin_auto
parameter of new order requests, and the margin_auto and amr fields of
margin account, position, and order models.
06.01.2025
Added an optional symbol parameter in:
GET /api/3/margin/history/positions;
GET /api/3/futures/history/positions.
Added the price_average field in the order model.
16.12.2024
Cross-margin accounts.
29.11.2024
Added order limits.
22.10.2024
Added endpoints:
GET /api/3/user/api-keys;
GET /api/3/wallet/crypto/address/white-list.
Added the attempt_hashes field in transaction history.
02.10.2024
Added endpoints:
POST /api/3/sub-account/transfer/sub-to-super;
POST /api/3/sub-account/transfer/sub-to-sub.
Added the ability to specify stop_price while replacing an order.
04.09.2024
Added endpoints:
GET /api/3/wallet/crypto/fee/withdraw/hash.
17.05.2024
Added endpoints:
POST /api/3/wallet/crypto/fee/estimate/bulk.
15.05.2024
Added last_activity_at field in the transaction model.
Added sorting transaction history by last_activity_at.
10.05.2024
Added fee_cumulative field in the position model and history.
Added close_position parameter in new order requests and responses.
05.03.2024
Added new 20018 error code.
01.02.2024
Changed the way of calculating rates returned by the
GET /api/3/public/price/rate call.
Added new GET /api/3/public/converted/candles and
GET /api/3/public/converted/candles/{symbol} endpoints which return
candles converted to the given currency.
Changed the way of calculating rates published by the /price/rate feed.
Added a new converted/candles/{period} feed which returns candles
converted to the given currency.
Added a new asset_id field in the network object that contains unique
arbitrary data identifying the coin.
02.11.2023
Added support of multichain that allows specifying a combination of a currency
and a base blockchain:
GET /api/3/public/currency:
added preferred_network request parameter;
added contract_address response field;
added networks response field;
properties of blockchain networks moved to items in networks.
POST /api/3/wallet/crypto/withdraw:
added network_code request body field.
GET /api/3/wallet/transactions:
added networks request parameter;
added network_code response field in native object;
added protocol_code response field in native object.
GET /api/3/wallet/crypto/address:
added network_code request parameter;
added network_code response field.
POST /api/3/wallet/crypto/address:
added network_code request body field;
added network_code response field.
GET /api/3/wallet/crypto/address/recent-deposit:
added network_code request parameter;
added network_code response field.
GET /api/3/wallet/crypto/address/recent-withdraw:
added network_code request parameter;
added network_code response field.
GET /api/3/wallet/crypto/fee/estimate:
added network_code request parameter.
GET /api/3/wallet/crypto/fee/levels:
added network_code request parameter.
GET /api/3/sub-account/crypto/address/{sub_account_id}/{currency}:
added network_code request parameter.
POST /api/3/wallet/crypto/fees/estimate:
added network_code request body field;
added networkCode response field.
09.10.2023
Added the commit risk score in the transaction history for deposits.
25.09.2023
Added a new operation_type field in the transaction history.
25.07.2023
Changed default TIF instructions for new orders.
07.07.2023
A new GET /api/3/wallet/crypto/fees/estimate endpoint.
31.05.2023
A new preferred_network filter in the GET /api/3/public/currency endpoint.
19.05.2023
WebSocket price/rate/ feeds.
15.11.2022
WebSocket balance feed.
28.07.2022
One-Triggers-Other (OTO) order lists.
16.03.2022
All-Or-None (AON), One-Cancels-Other (OCO), and
One-Triggers-One-Cancels-Other (OTOCO) order lists.
Positions history endpoint.
Clearing details endpoint.
12.01.2022
Cash-settled futures.
27.12.2021
Take-profit orders.
23.12.2021
Reduce-only orders.
08.12.2021
Margin parameters.
23.11.2021
Amount locks.
19.11.2021
Hidden orders.
Increased rate limits up to 300 requests per second.
10.11.2021
The WebSocket request to get a single–currency trading balance.
Allowed to view and get trading history for disabled symbols.
Allowed to get trading history by several comma-separated symbols.
25.08.2021
Airdrops section.
24.08.2021
Added ability to request Wallet and Trading balance for a single currency.
subscribe_balance method replaced by subscribe_wallet_balances. Response
was changed. Changes are backward compatible.
Eased key permissions for GET /api/3/margin/account,
/api/3/margin/account/isolated/{symbol} and socket margin_get_accounts
from "Place/cancel orders" to "Orderbook, History, Trading balance".
Eased key permissions for GET /api/3/futures/account,
/api/3/futures/account/isolated/{symbol} and socket futures_get_accounts
from "Place/cancel orders" to "Orderbook, History, Trading balance".
Added taker field to trade execution reports both for REST and WS.
Fixed market data subscription acknowledgment wasn't returned in some cases.
Fixed unsubscribe methods on trading subscriptions.
30.07.2021
Subaccounts section.
New endpoints for futures:
GET /api/3/public/futures/candles/open_interest to query open interest
candles.
GET /api/3/public/futures/history/funding to query perpetual contracts
funding history.
28.07.2021
API v3 initial release.
BEST PRACTICES
The HitBTC API development team strives to bring the best trading
experience to API users. This manual contains a set of best practices for using
the API as efficiently as possible.
Request Parameters
Pass a request payload (body) in POST requests and query parameters — in GET
requests.
Passing parameters in a way different from the documentation is not supported.
HTTP Persistent Connection
The underlying TCP connection is kept active for multiple requests/responses.
Subsequent requests will result in reduced latency as the TCP handshaking
process is no longer required.
If you use the HTTP 1.0 client, please ensure it supports the Keep-Alive
directive and submit the "Connection: Keep-Alive" header with a request.
Keep-Alive is a part of the HTTP/1.1 or HTTP/2 protocol and enabled by default
on compliant clients. However, you will have to ensure your implementation does
not set other values as the connection header.
Retrieving and Updating Account State
Use the Streaming API for real-time updates of orders, trades, and any
transaction changes.
REST API REFERENCE
HTTP Status Codes
200 OK. Successful request
400 Bad Request. Returns JSON with the error message
401 Unauthorized. Authorization is required or has been failed
403 Forbidden. Action is forbidden
404 Not Found. Data requested cannot be found
429 Too Many Requests. Your connection has been rate limited
500 Internal Server. Internal Server Error
503 Service Unavailable. Service is down for maintenance
504 Gateway Timeout. Request timeout expired
Error Response
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
All error responses have error code and human-readable message fields. Some
errors contain an additional description field.
Returns the actual list of available currencies, tokens, etc.
Requires no API key Access Rights.
Parameters:
Name
Type
Description
currencies
String
Optional. Comma-separated list of currency codes.
preferred_network
String
Optional. Code of the default network for currencies.
Response:
Name
Type
Description
full_name
String
Currency full name (e.g., "Bitcoin").
crypto
Boolean
Flag indicating whether the currency is a cryptocurrency.
stable
Boolean
Flag indicating whether the currency is a stablecoin.
payin_enabled
Boolean
Flag indicating whether generating deposit addresses is allowed for the currency.
payout_enabled
Boolean
Flag indicating whether withdrawals are allowed for the currency.
transfer_enabled
Boolean
Flag indicating whether transfers between the bank and the exchange accounts are allowed for the network (may be disabled on maintenance).
transfer_to_wallet_enabled
Boolean
Flag indicating whether transfers to a wallet account are allowed.
transfer_to_exchange_enabled
Boolean
Flag indicating whether transfers to an exchange account are allowed.
manual_fiat_payin_enabled
Boolean
Flag indicating whether manual fiat deposits via bank transfer are allowed.
manual_fiat_payout_enabled
Boolean
Flag indicating whether manual fiat withdrawals via bank transfer are allowed.
sign
String
Currency sign.
crypto_payment_id_name
String
Optional. The name of an additional account identifier used for the protocol.
crypto_explorer
String
Optional. The link to the currency explorer with "{tx}" placeholder instead of a hash.
precision_transfer
String
The minimum amount of a transfer.
account_top_order
Number
Optional. The absolute position of the currency in the currency list.
qr_prefix
String
Optional. The QR prefix used for indication of the currency in a deposit address. Returned only for currencies where it is configured.
delisted
Boolean
Flag indicating whether the currency has been delisted.
networks
[]Network
Networks that may host operations on the currency.
Network model consists of:
Name
Type
Description
code
String
Currency code.
network_name
String
Full network name.
network
String
Code of the currency of the hosting network.
is_ens_available
Boolean
Flag indicating whether the network supports ENS (Ethereum Name Service).
protocol
String
Optional. The standard or protocol underlying network operations or smart contracts. If equals code, the currency is the network native currency. If "TOKEN", the currency is a token build on top of this layer-2 network. Example: "ERC20"
default
Boolean
Flag indicating whether the network is the default for the currency.
payin_enabled
Boolean
Flag indicating whether generating deposit addresses is allowed for the network.
payout_enabled
Boolean
Flag indicating whether withdrawals are allowed for the network.
precision_payout
String
The minimum amount of a withdrawal.
payout_fee
String
Optional. The minimal possible fee value constituted of the network fee charged by a blockchain and the maintenance fee charged by the exchange.
payout_is_payment_id
Boolean
Flag indicating whether providing additional information for withdrawals is needed.
payin_payment_id
Boolean
Flag indicating whether providing additional information for deposits is needed.
payin_confirmations
Number
The number of confirmation needed for a transaction to be accepted in the network.
address_regex
String
Optional. Regular expression to a deposit address.
payment_id_regex
String
Optional. Regular expression for a payment identifier.
low_processing_time
Number
Optional. The lowest processing time in seconds for a withdrawal.
high_processing_time
Number
Optional. The highest processing time in seconds for a withdrawal.
avg_processing_time
Number
Optional. The average processing time in seconds for a withdrawal.
crypto_payment_id_name
String
Optional. Transaction identifier, e.g., comment, message, memo, attachment, etc.
crypto_explorer
String
Optional. The link to the network explorer with "{tx}" placeholder instead of a hash.
contract_address
String
Optional. Token contract address.
is_multichain
Boolean
Flag indicating whether multichain is active for the network.
asset_id
JSON
Optional. A unique arbitrary object that identifies a coin. Object keys depend on the network/provider and values are strings.
Returns the actual list of currency symbols (currency pairs) traded on exchange.
The first listed currency of a symbol is called the base currency, and the
second currency is called the quote currency.
The currency pair indicates how much of the quote currency is needed to purchase
one unit of the base currency.
Returns futures information for all or multiple contracts.
Requires no API key Access Rights.
Parameters:
Name
Type
Description
symbols
String
Optional. Comma-separated list of contract codes.
Response:
Name
Type
Description
contract_type
String
Contract type. Possible values: perpetual, cash_settled
mark_price
String
Recent asset price adjusted by the value of fair basis.
index_price
String
Average underlying asset price.
funding_rate
String
Optional. Percent of the contract's mark value paid in the previous funding period. Returned only if contract_type is perpetual.
open_interest
String
Total quantity of traded futures contracts.
next_funding_time
DateTime
Optional. Timestamp of the next funding. Returned only if contract_type is perpetual.
indicative_funding_rate
String
Optional. Estimated percent of the contract's mark value to be paid after the end of the current funding period, calculated at the moment. Returned only if contract_type is perpetual.
premium_index
String
Optional. Time-weighted average over premium indexes from the previous funding to the moment. Used during calculation of indicative_funding_rate. Returned only if contract_type is perpetual.
avg_premium_index
String
Optional. Time-weighted average over premium indexes for the previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price. Returned only if contract_type is perpetual.
interest_rate
String
Optional. Contract interest rate for one funding period.
indicative_settlement_price
String
Optional. Expected price of closing position on a cash settled contract. Calculated during the last 30 minutes prior to contract expiration — until that, equals to index_price. Returned only if contract_type is cash_settled.
expiry
DateTime
Optional. Contract expiration date. Returned only if contract_type is cash_settled.
Returns futures information for a specified contract.
Requires no API key Access Rights.
Response:
Name
Type
Description
contract_type
String
Contract type. Possible values: perpetual, cash_settled
mark_price
String
Recent asset price adjusted by the value of fair basis.
index_price
String
Average underlying asset price.
funding_rate
String
Optional. Percentage of contract mark value paid after the end of current funding interval. Returned only if contract_type is perpetual.
open_interest
String
Total quantity of traded futures contracts.
next_funding_time
DateTime
Optional. Timestamp of the next funding. Returned only if contract_type is perpetual.
indicative_funding_rate
String
Optional. Estimated percent of the contract's mark value to be paid after the end of the current funding period, calculated at the moment. Returned only if contract_type is perpetual.
premium_index
String
Optional. Time-weighted average over premium indexes from the previous funding to the moment. Used during calculation of indicative_funding_rate. Returned only if contract_type is perpetual.
avg_premium_index
String
Optional. Time-weighted average over premium indexes for the previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price. Returned only if contract_type is perpetual.
interest_rate
String
Optional. Contract interest rate for one funding period.
indicative_settlement_price
String
Optional. Expected price of closing position on a cash settled contract. Calculated during the last 30 minutes prior to contract expiration — until that, equals to index_price. Returned only if contract_type is cash_settled.
expiry
DateTime
Optional. Contract expiration date. Returned only if contract_type is cash_settled.
Percentage of contract mark value paid after the end of current funding interval.
avg_premium_index
String
Time-weighted average over premium indexes for the previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price.
Percent of the contract's mark value paid in the previous funding period.
avg_premium_index
String
Time-weighted average over premium indexes for the previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price.
To authorize, place credentials to the request header. Those must be constituted
of apiKey and secretKey as follows: "Basic " + apiKey + ":" + secretKey.
The alternative authentication method is the HMAC signature.
To send a request, you should establish a persistent session using the
credentials signed as follows:
Create an HMAC signature with secret_key as the secret key, SHA256 as the
hash algorithm, and payload as the message, structured like: <method> + <URL path> + [“?” + <query>] + [<body>] + <timestamp> + [<window>]
Add the authorization header to a request. It should have the following
structure: "HS256 " + Base64(api_key + ":" + <HMAC signature> + ":" + timestamp + [":" + window])
Unique order identifier as assigned by the trader. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
order_list_id
String
Optional. Order list identifier. Returned only for an order list request.
contingency_type
String
Optional. Order list type. Returned only for an order list request. Possible values: allOrNone, oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther
symbol
String
Symbol code.
side
String
Trade side. Possible values: sell, buy
status
String
Order state. Possible values: new — an order is placed in the order book. suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order is parked until it meets the conditions for placement in the order book. partiallyFilled — an order is executed, but a part of its quantity is not filled yet. filled — order quantity filled completely. canceled — an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances. expired — an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements.
type
String
Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket
time_in_force
String
Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired. GTC — "Good-Till-Canceled" order won't be closed until it is filled. IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled. FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all. Day — keeps the order active until the end of the trading day (23:59 UTC+0). GTD — "Good-Till-Date" order may remain active until the time specified in expire_time.
quantity
String
Order quantity.
quantity_cumulative
String
Executed order quantity.
price
String
Optional. Order price.
stop_price
String
Optional. The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Optional. Date of order expiration. Specified if time_in_force is GTD.
post_only
Boolean
A post-only order is an order that does not remove liquidity. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
original_client_order_id
String
Optional. Identifier of replaced order.
created_at
DateTime
Date of order's creation.
updated_at
DateTime
Date of order's last update.
trades
[]Trade
Optional. List of trades. Never returned for an order list request.
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/spot/order
Creates a new spot order.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
client_order_id
String
Optional. If omitted, an order will be created, and it will be generated by the Server. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that. Must be from 8 to 32 long. May include Latin letters of any case, digits, and _, -. If specified and corresponds to an existing order, a request will be rejected.
symbol
String
Symbol code.
side
String
Trade side. Accepted values: sell, buy
type
String
Optional. Order type. Must be set to market, stopMarket, or takeProfitMarket if price was left unspecified. Accepted values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket Default value: limit
time_in_force
String
Optional. Time in Force instruction. Accepted values: GTC, IOC, FOK, Day, GTD Default value: FOK — type is market, stopMarket, takeProfitMarket; GTC — type is limit, stopLimit, takeProfitLimit.
quantity
Number
Order quantity.
price
Number
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
Number
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
take_rate
Number
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.
make_rate
Number
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.
Response: spot order
Price accuracy and quantity
Symbol config contains the tick_size parameter which means that price should
be divided by tick_size with no remainder. quantity should be divided by
quantity_increment with no remainder. By default, if strict_validate is
not enabled, the Server rounds half down the price and quantity for
tick_size and quantity_increment.
Example of ETHBTC: if tick_size is 0.000001, then price 0.046016 is valid,
and 0.0460165 is invalid.
Fees
Charged fee is determined by the symbol's fee_currency. Maker-taker fees offer
a transaction rebate make_rate to those who provide liquidity (a maker), while
charging customers who take that liquidity take_rate (a taker).
To create buy orders, you must have sufficient balance including fees.
To create market buy orders, you must have sufficient balance including fees.
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/spot/order/list
Creates a new spot order list.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
order_list_id
String
Order list identifier. If omitted, it will be generated by the system upon order list creation. Must be equal to client_order_id of the first order in the request.
contingency_type
String
Order list type. Accepted values: allOrNone (AON) — all orders in the set should be executed within a single transaction or become expired otherwise; oneCancelOther (OCO) — all orders in the set should be canceled if one of them was executed; oneTriggerOther (OTO) — execution of the first (primary) order on the list activates other (secondary) orders as independent of each other; oneTriggerOneCancelOther (OTOCO) — the execution of the first (primary) order on the list activates the other (secondary) orders as an OCO order list.
orders
[]Order
Orders in the list. There must be 2 or 3 orders for allOrNone/oneCancelOther/oneTriggerOther and 3 — for oneTriggerOneCancelOther. Placing any other number of orders will result in an error.
Order model consists of:
Name
Type
Description
client_order_id
String
Optional. Must be different from the identifiers of other orders in the list. If omitted, it will be generated by the system upon order list creation. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
symbol
String
Symbol code. For a allOrNone order list, symbol code must be unique for each order in the list. For an oneTriggerOneCancelOther order list, symbol code must be the same for all orders in the list (placing orders in different order books is not supported).
side
String
Trade side. Accepted values: sell, buy
type
String
Optional. Order type. Accepted values: for allOrNone — limit, market; for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — limit, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket; for oneTriggerOneCancelOther — limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket. Default value: limit
time_in_force
String
Optional (required for allOrNone). Time in Force instruction. Accepted values: for allOrNone — FOK; for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — GTC, IOC (except limit orders), FOK (except limit orders), Day, GTD; for oneTriggerOneCancelOther — GTC, IOC, FOK, Day, GTD.
quantity
String
Order quantity.
price
String
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
String
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is '0').
take_rate
String
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.
make_rate
String
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.
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
PATCH /api/3/spot/order/{client_order_id}
Replaces a spot order
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
new_client_order_id
String
Optional. client_order_id for a new order.
quantity
Number
Order quantity.
price
Number
Optional. Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
Number
Optional. The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
strict_validate
Boolean
Optional. 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.
Response: spot order
Cancel All Spot Orders
DELETE /api/3/spot/order
Cancels all active spot orders.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
symbol
String
Optional. Parameter to filter active spot orders by symbol.
Filter type. Accepted values: timestamp, id Default value: id
from
DateTime
Interval initial value.
till
DateTime
Interval end value.
limit
Number
Default value: 100 Maximum value: 1000
offset
Number
Default value: 0 Maximum value: 100000
Response:
Name
Type
Description
id
Number
Unique order identifier as assigned by exchange.
client_order_id
String
Unique order identifier as assigned by the trader. The order history may list several orders with the same client_order_id.
symbol
String
Symbol code.
side
String
Trade side. Possible values: sell, buy
status
String
Order state. Possible values: new — an order is placed in the order book. suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order is parked until it meets the conditions for placement in the order book. partiallyFilled — an order is executed, but a part of its quantity is not filled yet. filled — order quantity filled completely. canceled — an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances. expired — an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements.
type
String
Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket
time_in_force
String
Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired. GTC — "Good-Till-Canceled" order won't be closed until it is filled. IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled. FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all. Day — keeps the order active until the end of the trading day (23:59 UTC+0). GTD — "Good-Till-Date" order may remain active until the time specified in expire_time.
quantity
String
Order quantity.
quantity_cumulative
String
Executed order quantity.
display_quantity
String
The visible part of the hidden order quantity.
price
String
Order price.
price_average
String
Average price of executed order quantity.
expire_time
DateTime
Date of order expiration. Specified if time_in_force is GTD.
stop_price
String
The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
created_at
DateTime
Date of order's creation.
updated_at
DateTime
Date of order's last update.
order_list_id
String
Optional. Order list identifier.
contingency_type
String
Optional. Order list type. Possible values: allOrNone, oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther
Filter type. Accepted values: timestamp, id Default value: id
from
DateTime or Number
Interval initial value. If sorting by timestamp is used, then DateTime; otherwise — Number.
till
DateTime or Number
Interval end value. If sorting by timestamp is used, then DateTime; otherwise — Number.
limit
Number
Default value: 100 Maximum value: 1000
offset
Number
Default value: 0 Maximum value: 100000
Response:
Name
Type
Description
id
Number
Trade unique identifier as assigned by exchange.
order_id
Number
Unique order identifier as assigned by exchange.
client_order_id
String
Unique order identifier as assigned by the trader. The order history may list several orders with the same client_order_id.
symbol
String
Symbol code.
side
String
Trade side. Possible values: sell, buy
quantity
String
Trade quantity.
price
String
Trade price.
fee
String
Trade commission. Can be negative ("rebate" — reward paid to the trader). See fee currency in the symbol config.
timestamp
DateTime
Trade timestamp.
taker
Boolean
Liquidity indicator.
Margin Settings
Margin settings define how the margin of a margin account is managed:
AMM (auto margin management) — the platform reserves and releases the
margin of a margin account automatically;
AMR (auto margin replenishment) — the platform replenishes the margin
of a position from the trading balance to prevent liquidation.
Auto Margin Management
With AMM enabled for a margin account:
the margin required for an order and for the position the order opens is
reserved from the trading balance at the moment the order is placed;
the reserve is recalculated when an order is canceled or replaced and when
the position leverage is changed;
the margin is released back to the trading balance once all the positions of
the margin account are closed and no active orders are left;
the margin account and the position are created by the first order, so
neither creating a margin account nor reserving margin for it in advance is
required.
Placing an order with AMM enabled:
Place a new order with margin_auto set to true:
POST /api/3/margin/order or the margin_new_order socket method;
POST /api/3/futures/order or the futures_new_order socket method.
The platform creates the margin account and the position if they do not
exist yet and reserves the margin required for the order from the trading
balance. If the available balance is not sufficient, the order is rejected
with the 20003 error code, and the objects created for it are removed.
The reserved margin is released back to the trading balance once the
position is closed completely and the margin account has no active orders
left.
The margin management mode is a property of the margin account, and the value
passed in an order is applied to it as follows:
the values of the order and of the account are the same — the value is
kept;
the values differ and the account is idle, meaning that it has neither open
positions nor active orders — the value of the order is applied to the
account;
the values differ, but the account is not idle — the value of the
account is kept, and the value of the order is ignored.
Auto Margin Replenishment
AMR (auto margin replenishment) prevents a position from being liquidated: as
soon as the margin of the position reaches the liquidation level, the platform
cancels the active orders of the margin account and, if that is not enough,
reserves additional margin from the trading balance instead of liquidating the
position.
AMR is applied to both the automatic and the manual margin management modes.
For an isolated margin account, AMR is a property of the position; for a
cross-margin account, it is a property of the account and is applied to all
of its positions at once.
The default value is false for an isolated margin account, while for a
cross-margin account it is defined by the platform settings.
With AMM enabled, the flag is reset to its default value once all the
positions of the margin account are closed.
The current value is returned in the amr field of margin account and
position models and reports.
Requires the "Orderbook, History, Trading balance" API key Access Right.
Response:
Name
Type
Description
default_amm
Boolean
Default value of the AMM flag on the platform.
user_can_change_amm
Boolean
Flag indicating whether the user is allowed to change the AMM flag.
user_can_change_amr_isolated
Boolean
Flag indicating whether the user is allowed to change the AMR flag of isolated margin accounts.
user_can_change_amr_cross
Boolean
Flag indicating whether the user is allowed to change the AMR flag of cross-margin accounts.
current_amm
Boolean
Effective value of the AMM flag of the user: either the value set by the user or the default one. This is the value the exchange web interface puts into margin_auto of every new order.
amm_override_set
Boolean
Flag indicating whether the user has set an own value of the AMM flag instead of the default one.
Set Auto Margin Management
curl \-X PUT \-u"apiKey:secretKey"\-H"Content-Type: application/json"\"https://api.hitbtc.com/api/3/margin-settings/amm"\-d'{"amm": true}'
Unique order identifier as assigned by the trader. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
order_list_id
String
Optional. Order list identifier.
contingency_type
String
Optional. Order list type. Possible values: allOrNone, oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther
symbol
String
Symbol code.
side
String
Trade side. Possible values: sell, buy
status
String
Order state. Possible values: new — an order is placed in the order book. suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order is parked until it meets the conditions for placement in the order book. partiallyFilled — an order is executed, but a part of its quantity is not filled yet. filled — order quantity filled completely. canceled — an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances. expired — an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements.
type
String
Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket
time_in_force
String
Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired. GTC — "Good-Till-Canceled" order won't be closed until it is filled. IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled. FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all. Day — keeps the order active until the end of the trading day (23:59 UTC+0). GTD — "Good-Till-Date" order may remain active until the time specified in expire_time.
quantity
String
Order quantity.
quantity_cumulative
String
Executed order quantity.
price
String
Optional. Order price.
stop_price
String
Optional. The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Optional. Date of order expiration. Specified if time_in_force is GTD.
post_only
Boolean
A post-only order is an order that does not remove liquidity. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
original_client_order_id
String
Optional. Identifier of replaced order.
created_at
DateTime
Date of order's creation.
updated_at
DateTime
Date of order's last update.
margin_mode
String
Margin mode. Possible values: isolated, cross
trades
[]Trade
Optional. List of trades. Never returned for an order list request.
price_average
String
Average price of executed order quantity.
margin_auto
Boolean
Optional. Flag indicating whether AMM (auto margin management) is enabled for the margin account or position the order belongs to. Refer to Margin Settings.
The total value of funds reserved for the position.
reserved_orders
String
The value reserved for active orders in the position.
reserved_positions
String
The minimum value reserved for position's executed quantity that cannot be reduced.
margin_call_margin
String
The lower boundary to margin_balance minus debt. If the margin is equal to this value, a margin call is sent. This do not carry information that would be valuable for predicting the condition of a position, since those change after an adjusted price (mark price) changes.
liquidation_margin
String
The lower boundary to margin_balance minus debt. If the margin is equal to this value, it is liquidated. This do not carry information that would be valuable for predicting the condition of a position, since those change after an adjusted price (mark price) changes.
debt_sum
String
Account debt for interests (fundings), fees, and loss.
Optional. The ratio of borrowed funds to trader's initial margin.
margin_mode
String
Margin mode. Possible values: isolated, cross
pnl
String
Unrealized profit and loss.
fee_cumulative
String
Total amount of fees paid throughout the position lifetime until it is closed. This value does zero out after the position closes and does not when it flips.
price_entry
String
Average weighted price of position open orders.
price_margin_call
String
The mark price of margin call.
price_liquidation
String
The mark price of force close.
created_at
DateTime
Position creation date and time.
updated_at
DateTime
Position last update date and time.
margin_auto
Boolean
Flag indicating whether AMM (auto margin management) is enabled for the position. Refer to Margin Settings.
amr
Boolean
Current value of the AMR (auto margin replenishment) flag of the position.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
symbol
String
Symbol code.
margin_mode
String
Margin mode. Accepted values: isolated, cross
price
Number
Optional. If a price is defined, then close order would be a limit order, instead, close order would be a market order.
strict_validate
Boolean
Optional. The value indicating whether the price is going to be checked for incrementation within the symbol’s tick size step. See the symbol's tick_size. Default value: false
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/margin/order
If AMM (auto margin management) is enabled for the order, the Margin Account and
the position are created by the order itself. Otherwise, the Margin Account for
the order symbol is required. Refer to Margin Settings.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
client_order_id
String
Optional. If omitted, it will be generated by the system upon order list creation. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
symbol
String
Trading symbol.
side
String
Trade side. Accepted values: sell, buy
type
String
Optional. Order type. Must be set to market, stopMarket, or takeProfitMarket if price was left unspecified. Accepted values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket Default value: limit
time_in_force
String
Optional. Time in Force instruction. Accepted values: GTC, IOC, FOK, Day, GTD Default value: FOK — type is market, stopMarket, takeProfitMarket; GTC — type is limit, stopLimit, takeProfitLimit.
quantity
Number
Order quantity.
price
Number
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
Number
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Optional. Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise. Default: false Conditions: quantity is omitted.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
Optional. Flag requesting AMM (auto margin management) for the margin account or position the order belongs to. With AMM enabled, the margin account and the position are created by the order if they do not exist, and the required margin is reserved from the trading balance automatically. Refer to Margin Settings. Applicable to margin orders only. Default: false
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/margin/order/list
Creates a new margin order list.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
order_list_id
String
Order list identifier. If omitted, it will be generated by the system upon order list creation. Must be equal to client_order_id of the first order in the request.
contingency_type
String
Order list type. Accepted values: oneCancelOther (OCO) — all orders in the set should be canceled if one of them was executed; oneTriggerOther (OTO) — execution of the first (primary) order on the list activates other (secondary) orders as independent of each other; oneTriggerOneCancelOther (OTOCO) — the execution of the first (primary) order on the list activates the other (secondary) orders as an OCO order list.
orders
[]Order
Orders in the list. There must be 2 or 3 orders for allOrNone/oneCancelOther/oneTriggerOther and 3 — for oneTriggerOneCancelOther. Placing any other number of orders will result in an error.
Order model consists of:
Name
Type
Description
client_order_id
String
Optional. Must be different from the identifiers of other orders in the list. If omitted, it will be generated by the system upon order list creation. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
symbol
String
Symbol code. Must be the same for all orders in an oneTriggerOneCancelOther order list (placing orders in different order books is not supported).
side
String
Trade side. Accepted values: sell, buy
type
String
Optional. Order type. Accepted values: for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — limit, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket; for oneTriggerOneCancelOther — limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket. Default value: limit
time_in_force
String
Optional. Time in Force instruction. Accepted values: for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — GTC, IOC (except limit orders), FOK (except limit orders), Day, GTD; for oneTriggerOneCancelOther — GTC, IOC, FOK, Day, GTD.
quantity
String
Order quantity.
price
String
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
String
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Optional. Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise. Default: false Conditions: quantity is omitted.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is '0').
Optional. Flag requesting AMM (auto margin management) for the margin account or position the order belongs to. With AMM enabled, the margin account and the position are created by the order if they do not exist, and the required margin is reserved from the trading balance automatically. Refer to Margin Settings. Applicable to margin orders only. Default: false
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
PATCH /api/3/margin/order/{client_order_id}
Replaces a margin order.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
new_client_order_id
String
Optional. client_order_id for a new order.
quantity
Number
Order quantity.
price
Number
Optional. Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
Number
Optional. The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
strict_validate
Boolean
Optional. 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.
Response: margin order
Cancel All Margin Orders
DELETE /api/3/margin/order
Cancels all active margin orders.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
symbol
String
Optional. Parameter to filter active margin orders by symbol.
Filter type. Accepted values: timestamp, id Default value: id
symbol
String
Comma-separated symbol codes.
statuses
String
Optional. Filter by order status. Comma-separated array. Possible values: suspended, new, partiallyFilled, filled, canceled, expired,rejected`
from
DateTime
Interval initial value. If sorting by timestamp is used, then DateTime; otherwise Number.
till
DateTime
Interval end value. If sorting by timestamp is used, then DateTime; otherwise Number.
limit
Number
Default value: 100 Maximum value: 1000
offset
Number
Default value: 0 Maximum value: 100000
Response:
Name
Type
Description
id
Number
Unique order identifier as assigned by exchange.
client_order_id
String
Unique order identifier as assigned by the trader. The order history may list several orders with the same client_order_id.
symbol
String
Symbol code.
side
String
Trade side. Possible values: sell, buy
status
String
Order state. Possible values: new — an order is placed in the order book. suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order is parked until it meets the conditions for placement in the order book. partiallyFilled — an order is executed, but a part of its quantity is not filled yet. filled — order quantity filled completely. canceled — an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances. expired — an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements.
type
String
Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket
time_in_force
String
Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired. GTC — "Good-Till-Canceled" order won't be closed until it is filled. IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled. FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all. Day — keeps the order active until the end of the trading day (23:59 UTC+0). GTD — "Good-Till-Date" order may remain active until the time specified in expire_time.
quantity
String
Order quantity.
quantity_cumulative
String
Executed order quantity.
display_quantity
String
The visible part of the hidden order quantity.
price
String
Order price.
price_average
String
Average price of executed order quantity.
expire_time
DateTime
Date of order expiration. Specified if time_in_force is GTD.
position_id
Number
Optional. Position identifier of the order.
stop_price
String
The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
created_at
DateTime
Date of order's creation.
updated_at
DateTime
Date of order's last update.
order_list_id
String
Optional. Order list identifier.
contingency_type
String
Optional. Order list type. Possible values: oneCancelOther, oneTriggerOther, oneTriggerOneCancelOther
margin_mode
String
Margin mode. Possible values: isolated, cross
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise.
margin_auto
Boolean
Optional. Flag indicating whether AMM (auto margin management) is enabled for the margin account or position the order belongs to. Refer to Margin Settings.
Optional. Interval initial value in nanoseconds. Minimum value: 1
till
Number
Optional. Interval end value in nanoseconds. Minimum value: 1
limit
Number
Optional. Default value: 100 Maximum value: 1000
offset
Number
Optional. Default value: 0 Maximum value: 100000
by
String
The name of the field to order the results by (only sorting by update_timestamp is allowed). Accepted values: ts, timestamp
Response:
Name
Type
Description
id
Number
Position identifier.
entry_value
String
Position value in currency.
entry_price
String
Weighted average open price.
avg_buy_price
String
Weighted average buy price.
avg_sell_price
String
Weighted average sell price.
buy_quantity
String
Total quantity of buy trades in the position.
sell_quantity
String
Total quantity of sell trades in the position.
quantity
String
Position quantity.
margin_call_price
String
If the market is equal to or worse than this price, a margin call will be issued.
liquidation_price
String
The price at which the platform begins to close the position.
bankruptcy_price
String
The price at which the position can no longer be closed with any non-negative PnL.
margin
String
Amount of margin expressed in the quote currency.
required_margin
String
Margin reserved for close orders.
orders_margin
String
Margin reserved for open orders.
pnl
String
Unrealized Profit and Loss.
leverage
String
Position leverage.
margin_mode
String
Mode of margin trading. Possible values: isolated, cross
state
String
Position state. Possible values: closed, active, liquidated
fee_cumulative
String
Total amount of fees paid throughout the position lifetime until it is closed. This value does zero out after the position closes and does not when it flips.
symbol
String
Symbol code.
margin_call
Boolean
Flag indicating the position is close to the liquidation, and increased margin may prevent it from happening.
margin_auto
Boolean
Flag indicating whether AMM (auto margin management) was enabled for the position. Refer to Margin Settings.
amr
Boolean
Value of the AMR (auto margin replenishment) flag of the position.
Unique order identifier as assigned by the trader. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
order_list_id
String
Optional. Order list identifier.
contingency_type
String
Optional. Order list type. Possible values: allOrNone, oneCancelOther, oneTriggerOneCancelOther
symbol
String
Contract code.
side
String
Trade side. Possible values: sell, buy
status
String
Order state. Possible values: new — an order is placed in the order book. suspended — a stopLimit, stopMarket, takeProfitLimit or takeProfitMarket order is parked until it meets the conditions for placement in the order book. partiallyFilled — an order is executed, but a part of its quantity is not filled yet. filled — order quantity filled completely. canceled — an order is canceled. It can either be done by a user through a cancel/replace request or by the system under specific circumstances. expired — an order is deactivated after it no longer satisfies Time in Force (IOC, FOK) or Post Only requirements.
type
String
Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket
time_in_force
String
Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired. GTC — "Good-Till-Canceled" order won't be closed until it is filled. IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be canceled. FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all. Day — keeps the order active until the end of the trading day (23:59 UTC+0). GTD — "Good-Till-Date" order may remain active until the time specified in expire_time.
quantity
String
Order quantity.
quantity_cumulative
String
Executed order quantity.
price
String
Optional. Order price.
stop_price
String
Optional. The price level that triggers order activation. Specified if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Optional. Date of order expiration. Specified if time_in_force is GTD.
post_only
Boolean
A post-only order is an order that does not remove liquidity. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise. Default: false Conditions: quantity is omitted.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
original_client_order_id
String
Optional. Identifier of replaced order.
created_at
DateTime
Date of order's creation.
updated_at
DateTime
Date of order's last update.
margin_mode
String
Margin mode. Possible values: isolated, cross
trades
[]Trade
Optional. List of trades. Never returned for an order list request.
price_average
String
Average price of executed order quantity.
margin_auto
Boolean
Optional. Flag indicating whether AMM (auto margin management) is enabled for the margin account or position the order belongs to. Refer to Margin Settings.
The total value of funds reserved for the position.
reserved_orders
String
The value reserved for active orders in the position.
reserved_positions
String
The minimum value reserved for position's executed quantity that cannot be reduced.
margin_call_margin
String
The lower boundary to margin_balance minus debt. If the margin is equal to this value, a margin call is sent. This do not carry information that would be valuable for predicting the condition of a position, since those change after an adjusted price (mark price) changes.
liquidation_margin
String
The lower boundary to margin_balance minus debt. If the margin is equal to this value, it is liquidated. This do not carry information that would be valuable for predicting the condition of a position, since those change after an adjusted price (mark price) changes.
debt_sum
String
Account debt for interests (fundings), fees, and loss.
The ratio of borrowed funds to trader's initial margin.
margin_mode
String
Margin mode. Possible values: isolated, cross
pnl
String
Unrealized profit and loss.
fee_cumulative
String
Total amount of fees paid throughout the position lifetime until it is closed. This value does zero out after the position closes and does not when it flips.
price_entry
String
Average weighted price of position open orders.
price_margin_call
String
The mark price of margin call.
price_liquidation
String
The mark price of force close.
created_at
DateTime
Position creation date and time.
updated_at
DateTime
Position last update date and time.
margin_auto
Boolean
Flag indicating whether AMM (auto margin management) is enabled for the position. Refer to Margin Settings.
amr
Boolean
Current value of the AMR (auto margin replenishment) flag of the position.
Creates or updates a margin account. Setting margin balance to zero will lead to
closing the margin account and retrieval all formerly reserved funds to the
trading account.
Returns margin account details.
To withdraw all funds from the margin account send a request with margin_balance
equal to "0".
If margin_mode is "cross", specifying leverage is not allowed.
For changing the leverage POST /api/3/margin/position/leverage call is
suggested.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
margin_mode
String
Margin mode. Accepted values: isolated, cross
margin_balance
Number
Amount of currency reserved.
leverage
Number
Optional. User leverage. Required if the balance of the isolated margin account is equal to zero. Minimum value: "1" Maximum value: "1000"
strict_validate
Boolean
Optional. The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.
Set Position Leverage
curl \-X POST -u"apiKey:secretKey"\"https://api.hitbtc.com/api/3/futures/position/leverage"\-d"symbol=BTCUSDT_PERP&leverage=100&margin_mode=isolated"
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
symbol
String
Contract code.
margin_mode
String
Margin mode. Accepted values: isolated, cross
leverage
Number
User leverage. Required if the balance of the isolated margin account is equal to zero. Minimum value: "1" Maximum value: "1000"
strict_validate
Boolean
Optional. The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.
Response:
Name
Type
Description
id
Number
Position identifier.
symbol
String
Contract code.
margin_mode
String
Margin mode. Possible values: isolated, cross
leverage
String
Position leverage.
quantity
String
Position quantity.
price_entry
String
Average weighted price of position open orders.
price_margin_call
String
The mark price of margin call.
price_liquidation
String
The mark price of force close.
pnl
String
Unrealized Profit and Loss.
fee_cumulative
String
Optional. Total amount of fees paid throughout the position lifetime until it is closed. This value does zero out after the position closes and does not when it flips.
created_at
DateTime
Position creation date and time.
updated_at
DateTime
Position last update date and time.
status
String
Position status. Possible values: normal, blocked, closeOnly
required_margin
String
Margin reserved for close orders.
orders_margin
String
Margin reserved for open orders.
sum_fundings
String
Optional. Sum of all settled funding to a position.
adl_ranking
String
Optional. Rank of a position which defines how appropriate a position is to be used for closing bankrupt positions avoided liquidation. The rank represents the probability of a position becoming deleveraged: a high rank value signifies a high probability, and vice versa. Possible values: 0 – 4
margin_call
Boolean
Optional. Flag indicating the position is close to the liquidation, and increased margin may prevent it from happening.
margin_auto
Boolean
Flag indicating whether AMM (auto margin management) is enabled for the position. Refer to Margin Settings.
amr
Boolean
Current value of the AMR (auto margin replenishment) flag of the position.
Returns a list of the successfully closed margin positions.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
symbol
String
Contract code.
margin_mode
String
Margin mode. Accepted values: isolated, cross
price
Number
Optional. If a price is defined, then close order would be a limit order with the specified price, instead, close order would be a market order with the market price.
strict_validate
Boolean
Optional. The value indicating whether the price is going to be checked for incrementation within the symbol’s tick size step. See the symbol's tick_size. Default value: false
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/futures/order
Creates a new futures order.
A full order description can be found in the "Margin Order Model" subsection.
If AMM (auto margin management) is enabled for the order, the Margin Account and
the position are created by the order itself. Otherwise, the Margin Account for
the order contract is required. Refer to Margin Settings.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
client_order_id
String
Optional. If omitted, an order will be created, and it will be generated by the Server. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that. Must be from 8 to 32 characters long. May include Latin letters of any case, digits, and _, -. If specified and corresponds to an existing order, a request will be rejected.
symbol
String
Contract code.
side
String
Trade side. Possible values: sell, buy
type
String
Optional. Order type. Possible values: limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket Default value: limit
time_in_force
String
Optional. Time in Force instruction. Possible values: GTC, IOC, FOK, Day, GTD Default value: FOK — type is market, stopMarket, takeProfitMarket; GTC — type is limit, stopLimit, takeProfitLimit.
quantity
Number
Order quantity.
price
Number
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
Number
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Optional. Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is "0").
Optional. Flag requesting AMM (auto margin management) for the margin account or position the order belongs to. With AMM enabled, the margin account and the position are created by the order if they do not exist, and the required margin is reserved from the trading balance automatically. Refer to Margin Settings. Applicable to margin orders only. Default: false
close_position
Boolean
Flag indicating a stop market order must close a margin position when executed or be canceled otherwise. Default: false Conditions: quantity is omitted.
{"error":{"code":20001,"message":"Insufficient funds","description":"Check that the funds are sufficient, given commissions"}}
POST /api/3/futures/order/list
Creates a new futures order list.
Requires the "Place/cancel orders" API key Access Right.
Parameters:
Name
Type
Description
order_list_id
String
Order list identifier. If omitted, it will be generated by the system upon order list creation. Must be equal to client_order_id of the first order in the request.
contingency_type
String
Order list type. Accepted values: oneCancelOther (OCO) — all orders in the set should be canceled if one of them was executed; oneTriggerOther (OTO) — execution of the first (primary) order on the list activates other (secondary) orders as independent of each other; oneTriggerOneCancelOther (OTOCO) — the execution of the first (primary) order on the list activates the other (secondary) orders as an OCO order list.
orders
[]Order
Orders in the list. There must be 2 or 3 orders for allOrNone/oneCancelOther/oneTriggerOther and 3 — for oneTriggerOneCancelOther. Placing any other number of orders will result in an error.
Order model consists of:
Name
Type
Description
client_order_id
String
Optional. Must be different from the identifiers of other orders in the list. If omitted, it will be generated by the system upon order list creation. Uniqueness must be guaranteed until the last order with the same client_order_id becomes inactive (canceled, expired, or fully executed) and some time after that.
symbol
String
Symbol code. Must be the same for all orders in an oneTriggerOneCancelOther order list (placing orders in different order books is not supported).
side
String
Trade side. Accepted values: sell, buy
type
String
Optional. Order type. Accepted values: for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — limit, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket; for oneTriggerOneCancelOther — limit, market, stopLimit, stopMarket, takeProfitLimit, takeProfitMarket. Default value: limit
time_in_force
String
Optional. Time in Force instruction. Accepted values: for oneCancelOther (and secondary orders in oneTriggerOneCancelOther) — GTC, IOC (except limit orders), FOK (except limit orders), Day, GTD; for oneTriggerOneCancelOther — GTC, IOC, FOK, Day, GTD.
quantity
String
Order quantity.
price
String
Order price. Required if type is limit, stopLimit, or takeProfitLimit.
stop_price
String
The price level that triggers order activation. Required if type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket.
expire_time
DateTime
Date of order expiration. Required if time_in_force is GTD.
strict_validate
Boolean
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.
post_only
Boolean
Optional. If a post-only order causes a match with a pre-existing order as a taker, then the order will expire.
reduce_only
Boolean
Optional. Reduce-only order, being filled, guarantees not to put the position quantity to the point when the position flips.
display_quantity
String
Optional. The visible part of the hidden order quantity (the only valid value is '0').
Optional. Flag requesting AMM (auto margin management) for the margin account or position the order belongs to. With AMM enabled, the margin account and the position are created by the order if they do not exist, and the required margin is reserved
[Page truncated to keep GeezerVison snappy.]
You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.