POST
https://api.cryptohopper.com/v1/hopper/{id}/position/sell
Places sell orders for the given open positions at the current bid, or at the price you send. Without position_id it sells all open positions of the given currency that are not on hold.
OAuth scope:
trade About scopes
Uses the order rate limit bucket: 1 request per 8 seconds. Optional fields: price (limit price) and market_order (1 for a market order). When selling by currency instead of position_id, data is "Sell order will be placed at the exchange.". If a selected position already has an open order, the call stops there and returns "Order already placed". Requires an active subscription for the hopper.
Example request
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/sell" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"position_id":[123456,123457],"market_order":0}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/sell', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"position_id": [
123456,
123457
],
"market_order": 0
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/sell",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"position_id": [
123456,
123457
],
"market_order": 0
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/sell');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'position_id' => [
123456,
123457,
],
'market_order' => 0,
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | Required | Hopper ID. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
position_id | array of integer | Optional |
Response
{
"data": "Sell order for position placed."
}