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.

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

Decimal patterns must be used with dots (.)

  • 0.1876

  • 42.18

quantity for Market Buy Order

quantity for Market Sell Order

quantity for Limit Buy Order

quantity for Limit Sell Order

TRY, USDT or BTC

CRYPTO

CRYPTO

CRYPTO

Submit Order

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

Query Parameters

Name
Type
Description

quantity*

number

decimal, mandatory for market or limit orders.

price*

number

decimal, 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

number

decimal, for stop orders

newOrderClientId

string

string, GUID if user did not set.

orderMethod*

string

enum, "limit", "market", "stoplimit" or "stopmarket"

orderType*

string

enum, "buy" or "sell"

pairSymbol*

string

BTCTRY, ETHTRY etc.

Headers

Name
Type
Description

X-PCK*

string

API public key. You can create the API key from the Account > API Access page in your exchange account.

X-Stamp*

integer

Nonce 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*

string

Signature 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.

Message
Code
Description

BALANCE_NOT_ENOUGH

1055

The balance amount is not enough for this operation. Check your balance amount using the /api/v1/users/balances endpoint.

FAILED_MARKET_ORDER

1118

You 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_ORDER

1120

You 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_ORDERS

1122

FAILED_MIN_TOTAL_AMOUNT

1123

The 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_ASK

1124

Stop 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_BID

1125

Stop 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_SCALE

1126

This 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_SCALE

1127

This 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_SCALE

1128

This 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_SUPPORTED

1134

You 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_SUPPORTED

1193

You might be sending invalid orderTypeparameter. valid orderType parameters should be one of this: buy, sell.

PRICE_MUST_BE_LESS_THAN_MAXPRICE

1226

Buy 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_MINPRICE

1227

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_EXCEEDED

8003

Limit or StopLimit order price is greater than maximumLimitOrderPrice . You can check the maximumLimitOrderPrice value from the /api/v2/server/exchangeinfo endpoint.

ORDER_MIN_PRICE_EXCEEDED

8004

Limit or StopLimit order price is less than minimumLimitOrderPrice . You can check the minimumLimitOrderPrice value from the /api/v2/server/exchangeinfo endpoint.

ORDER_INSERT_BLOCKED

8005

Last updated