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

Submit Order

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

Query Parameters

Headers

{
  "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.

Last updated