POST
https://api.cryptohopper.com/v1/hopper/{id}/order
Places a buy or sell order for a coin on the hopper's exchange. A sell without manual set to 1 sells all open positions of that coin; with manual set to 1 and an amount, it sells only that amount.
OAuth scope:
read manage trade About scopes
Uses the order rate limit bucket: 1 request per 8 seconds, and the same order_type and coin for the same hopper is refused for 8 seconds. order_type is buy or sell; coin is the currency to buy or sell. Without price the current ticker price is used; without amount a buy uses the bot's configured buy amount. The order is queued and placed on the exchange shortly after the response. Optional buy fields: percentage_profit (or pct_profit), trailing_buy and trailing_buy_percentage, take_profit_levels (up to 10 levels, as an array of {"profit", "share"} objects or the shorthand "1:20,2:20"). iceberg_total_orders (2 or more) splits the order for normal bots.
Example request
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/order" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"order_type":"buy","coin":"BTC","amount":0.001,"price":65000,"market_order":0,"pct_profit":2.5,"order_trigger":"my-app"}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/order', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"order_type": "buy",
"coin": "BTC",
"amount": 0.001,
"price": 65000,
"market_order": 0,
"pct_profit": 2.5,
"order_trigger": "my-app"
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/order",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"order_type": "buy",
"coin": "BTC",
"amount": 0.001,
"price": 65000,
"market_order": 0,
"pct_profit": 2.5,
"order_trigger": "my-app"
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/order');
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([
'order_type' => 'buy',
'coin' => 'BTC',
'amount' => 0.001,
'price' => 65000,
'market_order' => 0,
'pct_profit' => 2.5,
'order_trigger' => 'my-app',
]),
]);
$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 |
|---|---|---|---|
order_type | string | Optional | |
market_order | integer | Optional | |
coin | string | Optional | |
price | number | Optional | |
amount | number | Optional | |
order_trigger | string | Optional | |
pct_profit | number | Optional | |
stop_loss_percentage | number | Optional | |
trailing_stop_loss_percentage | number | Optional | |
trailing_arm_percentage | number | Optional | |
manual | number | Optional |
Response
{
"data": "Buy order will be placed at the exchange. Currency: BTC (BTC/USDT) Amount: 0.001 Price: 65000"
}