BuyCoins API Guide
Search…
Post Market Order
Place a market order
A market order is an order to immediately buy or sell cryptocurrency at the best available current price.
Unlike limit orders, you do not specify a price when you place a market order. When you place a market order, it is matched with an existing limit order with the best buy or sell price at the time of the request.

When to place a market order

Place market orders when you want your order to execute as soon as possible, regardless of the price.

Estimating a market order's fees

You can find out an estimate of how much placing a market order will cost you using the getProOrderFees mutation.
1
query {
2
getProOrderFees(orderType: market_order, pair: btc_usdt, side: sell, amount: 10000){
3
fee
4
baseCurrencyTotal
5
quoteCurrencyTotal
6
price
7
}
8
}
Copied!

Parameters

  • orderType: The type of the order either limit_order or market_order
  • pair: The currency pair you want to buy or sell
  • side: The order side either buy or sell
  • amount: The amount of the quote currency worth of the base currency you want to buy or sell
Response
  • fee: An estimate of the fees that'll be incurred when you place an order
  • baseCurrencyTotal: How much of the base currency you're purchasing.
  • quoteCurrencyTotal: How much of the quote currency is needed to purchase your specified amount of the base currency.
  • price: The current price (in the quote currency) of one unit of the base currency. Eg: For the btc_usdt pair, a price of 34977.7 means one BTC = 34977.7 USDT.

Placing a market order

You can place a market order that shows up in the order book using the postProMarketOrder mutation.
1
mutation {
2
postProMarketOrder(pair: btc_usdt, quantity: 10000, side: buy){
3
id
4
pair
5
price
6
side
7
status
8
timeInForce
9
orderType
10
fees
11
filled
12
total
13
initialBaseQuantity
14
initialQuoteQuantity
15
remainingBaseQuantity
16
remainingQuoteQuantity
17
meanExecutionPrice
18
engineMessage
19
}
20
}
Copied!

Parameters

Response

  • id: Unique identifier of the order
  • pair: The currency pair of the order
  • price: The price the order was executed at
  • side: The order side either buy or sell
  • status: The status of the orderpending, in_progress, cancelled, successful, failed, partially_filled
  • timeInForce: The timeInForce option of the order
  • orderType: The type of the order either limit_order, market_order
  • fees: The fees incurred for placing the order
  • filled: The amount of the base currency that was filled
  • total: An alias for initial base quantity.
  • initialBaseQuantity: The initial quantity of the base currency
  • initialQuoteQuantity: The initial quantity of the quote currency
  • remainingBaseQuantity: The remaining base quantity that has not been filled.
  • remainingQuoteQuantity: The remaining quote quantity that has not been filled. (Only applies to market buy orders)
  • meanExecutionPrice: The price that an order was executed at if it matched with one other order. The average price if it matched with multiple other orders.
  • engineMessage: The reason why an order failed