Skip to main content

Submit an Order

Create an order. You can place 4 types of orders: limit, market, stoplimit and stopmarket.

Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.

warning

For all transactions related to the private endpoint, you must authorize before sending your request.

For more information you can check our Authentication V1 article.

You need to send request with [POST] method.

  • quantity,price,stopPrice, newOrderClientId, orderMethod, orderType , pairSymbol parameters must be used for submit order.
  • price field will be ignored for market orders. Market orders get filled with different prices until your order is completely filled. There is a 5% limit on the difference between the first price and the last price. İ.e. you can't buy at a price more than 5% higher than the best sell at the time of order submission and you can't sell at a price less than 5% lower than the best buy at the time of order submission.
  • stopPrice parameter is valid only for stop orders.
  • You can use symbol parameter in this format: BTCUSDT
danger

Decimal patterns must be used with dots (.)

  • 0.1876
  • 42.18
quantity for Market Buy Orderquantity for Market Sell Orderquantity for Limit Buy Orderquantity for Limit Sell Order
TRY, USDT or BTCCRYPTOCRYPTOCRYPTO

Submit Order

POST https://api.btcturk.com/api/v1/order

Query Parameters

NameTypeDescription
quantity*numberdecimal, mandatory for market or limit orders.
price*numberdecimal, price field will be ignored for market orders. Market orders get filled with different prices until your order is completely filled. There is a 5% limit on the difference between the first price and the last price. İ.e. you can't buy at a price more than 5% higher than the best sell at the time of order submission and you can't sell at a price less than 5% lower than the best buy at the time of order submission.
stopPricenumberdecimal, for stop orders
newOrderClientIdstringstring, GUID if user did not set.
orderMethod*stringenum, "limit", "market", "stoplimit" or "stopmarket"
orderType*stringenum, "buy" or "sell"
pairSymbol*stringBTCTRY, ETHTRY etc.

Headers

NameTypeDescription
X-PCK*stringAPI public key. You can create the API key from the Account > API Access page in your exchange account.
X-Stamp*integerNonce must be current timestamp in miliseconds. It is a must to sync your current time with API server time which is in miliseconds format. Our servers are using UTC timezone.
X-Signature*stringSignature is a HMAC-SHA256 encoded message. The HMAC-SHA256 code must be generated using a private key that contains a timestamp as nonce and your API key.
{
"success": true,
"message": "OK",
"code": 0,
"data": {
"id": 9932534,
"datetime": 1543996112263,
"type": "Buy",
"method": "Limit",
"price": "20000.00",
"stopPrice": "20000.00",
"quantity": "0.001",
"pairSymbol": "BTCTRY",
"pairSymbolNormalized": "BTC_TRY",
"newOrderClientId": "test"
}
}

Code Example

// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2

var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

var publicKey = configuration["publicKey"];
var privateKey = configuration["privateKey"];
var resourceUrl = configuration["resourceUrl"];
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);

var limitSellOrder = new OrderInput
{
Quantity = 0.001m,
Price = 40000m,
NewOrderClientId = "test",
OrderMethod = OrderMethod.Limit,
OrderType = OrderType.Sell,
PairSymbol = "BTCTRY"
};

////Create New Order
var orderOutput = apiClientV1.CreateOrder(limitSellOrder);

Console.WriteLine(!orderOutput.Result.Success
? $"Code:{orderOutput.Result.Code} , Message: {orderOutput.Result.Message}"
: orderOutput.Result.Data.ToString());

Expected Errors

The expected errors when creating an order with the submit order endpoint are listed below. Review the meaning of the error you received.

MessageCodeDescription
BALANCE_NOT_ENOUGH1055The balance amount is not enough for this operation. Check your balance amount using the /api/v1/users/balances endpoint.
FAILED_MARKET_ORDER1118You might be sending wrong quantity or pairSymbol parameter. Quantity fields must be greater than zero, also pairSymbol field should be valid. You can check valid pairs from /api/v2/server/exchangeinfo endpoint.
FAILED_LIMIT_ORDER1120You might be sending wrong price, quantity or pairSymbol parameter. Price and quantity fields must be greater than zero, also pairSymbol field should be valid. You can check valid pairs from /api/v2/server/exchangeinfo endpoint.
FAILED_ORDER_WITH_OPEN_ORDERS1122Order submission failed due to open orders. Your free balance is not enough for this transaction. You can view your available balance with the free field from the /api/v1/users/balance endpoint. You may have an open order or a request to withdraw. For more details on open orders, please check documentation.

Get Open Orders
FAILED_MIN_TOTAL_AMOUNT1123The order quantity is less than the minimum required. You can view the minimum order amount from the /api/v2/server/exchangeinfo endpoint. minExchangeValue value of a pair represents the correct minimum amount for order submitting.
FAILED_STOP_PRICE_GREATER_THAN_BEST_ASK1124Stop buy price must be above best ask price. You can check the best ask price information from the /api/v2/ticker endpoint with the askfield.
FAILED_STOP_PRICE_LESS_THAN_BEST_BID1125Stop sell price must be below best bid price. You can check the best bid price information from the /api/v2/ticker endpoint with the bidobject.
FAILED_INVALID_PRICE_SCALE1126This error indicates that scale of the price you send is not valid for that pair. You can check denominatorScale field from /api/v2/server/exchangeinfo endpoint.
FAILED_INVALID_QUANTITY_SCALE1127This error indicates that scale of the quantity you send is not valid for that pair. You can check numeratorScale field from /api/v2/server/exchangeinfo endpoint.
FAILED_INVALID_STOP_PRICE_SCALE1128This error indicates that scale of the stopPrice you send is not valid for that pair. You can check denominatorScale field from /api/v2/server/exchangeinfo endpoint.
ORDER_METHOD_NOT_SUPPORTED1134You might be sending invalid orderMethod parameter. valid orderMethod parameters should be one of this: limit, market, stopLimit, stopMarket Sometimes even though you send valid orderMethod parameter, that order method might not be allowed for a temporary time period for that pair. You can check orderMethods field from /api/v2/server/exchangeinfo endpoint.
ORDER_TYPE_NOT_SUPPORTED1193You might be sending invalid orderTypeparameter. valid orderType parameters should be one of this: buy, sell.
PRICE_MUST_BE_LESS_THAN_MAXPRICE1226Buy price must be less than maximum price for Limit and Stop-Limit order methods, for relevant pair.

You can view the maximum price information from the /api/v2/server/exchangeinfo endpoint with the maxPrice field. Please ensure that you're checking correct pair.
PRICE_MUST_BE_LESS_THAN_MINPRICE1227

Sell price must be greater than min price for Limit and Stop-Limit order methods, for relevant pair.

You can view the minimum price information from the /api/v2/server/exchangeinfo endpoint with the minPrice field.

Note: There is an conflict between error message and explanation. Please take description into consideration.

ORDER_MAX_PRICE_EXCEEDED8003Limit or StopLimit order price is greater than maximumLimitOrderPrice . You can check the maximumLimitOrderPrice value from the /api/v2/server/exchangeinfo endpoint.
ORDER_MIN_PRICE_EXCEEDED8004Limit or StopLimit order price is less than minimumLimitOrderPrice . You can check the minimumLimitOrderPrice value from the /api/v2/server/exchangeinfo endpoint.
ORDER_INSERT_BLOCKED8005Maintenance work is in progress for the trading pair. You can implement one of the retry strategies or you can stop order insertions and follow our status page before starting to send order submit requests.

BtcTurk Status

Also please check the retry strategy guideline documentation before implementing retry strategy.

https://docs.btcturk.com/error-handling-for-order-operations/retry-strategy-guideline