Sell

Selling cryptocurrency with the API

To sell, you will first need to get an active price and then proceed to use this price to place an order. The getPrices query allows you to do this. You can also pass an optional cryptocurrency argument to view singular cryptocurrency prices.

query{
getPrices{
id
cryptocurrency
sellPricePerCoin
minSell
maxSell
expiresAt
}
}

The price call will return notable fields:

  • id: this is Global Object ID that you will need to pass to the sell mutation. You can also use it to retrieve a BuycoinsPrice node.

  • cryptocurrency: this is the cryptocurrency of the prices displayed

  • sellPricePerCoin: this is the sell cost per coin in Naira

  • minSell: this is the minimum amount of that cryptocurrency that can be sold

  • maxSell: this is the maximum amount of that cryptocurrency that can be sold

  • expiresAt: This timestamp is when that price will expire

To place a sell order, you will need the id of an active price.

mutation{
sell(price: "QnV5Y29pbnNQcmljZS0zOGIwYTg1Yi1jNjA1LTRhZjAtOWQ1My01ODk1MGVkMjUyYmQ=", coin_amount: 0.002, cryptocurrency: bitcoin) {
id
cryptocurrency
status
totalCoinAmount
side
}
}

Sell orders usually get filled in a minute but not more than 5 minutes. To check the status of your sell order, you can do a node lookup on Order using the id returned in your buy order mutation.