Resume#
POST https://api.pro.anboto.xyz/api/v2/strategies/campaigns/resume
paused -> running. A campaign in error also retries from here: its open legs are watched again. ApiKeyAuth required.
Body params#
campaign_id string requiredThe campaign's id (UUID)
Headers#
| Header | ||
|---|---|---|
X-API-KEY |
string | required |
X-TIMESTAMP |
int64 ms | required |
X-SIGN |
string | required |
X-RECV-WINDOW |
int, default 5000 |
Responses#
| 200 | The campaign, running |
| 400 | campaign_id is missing or not a valid id, {"code", "error", "errors"?} |
| 401 | Unauthorized: missing or unknown API key |
| 403 | Forbidden: the API key is read-only, or the paper_farm_bot feature is not enabled for this team, {"code", "error", "errors"?} |
| 404 | No such campaign on this account, {"code", "error", "errors"?} |
| 409 | Not a valid transition from the campaign's current status, {"code", "error", "errors"?} |
| 429 | Rate limit exceeded, retry later, {"code", "error", "errors"?} |
| 503 | The strategies service is unavailable, {"code", "error", "errors"?} |
Response fields — StrategyCampaign#
id stringCampaign id (UUID)
type stringCampaign type; today always paper_farm
status enumrunning | paused | stopped | done | error —
running, paused, stopped, done, errorstopping booleanA graceful stop or a hard kill is under way. Independent of status: can be true while status stays error (the open legs are being closed before the campaign reaches stopped)
phase stringCycle phase the runner is in: idle, opening, open, closing or settling
stop_reason stringWhy a stopped/done campaign ended: cycles_done, budget_spent, session_key_expiring, queued_share, user_stop or user_kill. Empty while still running
cycles_done integerCycles completed so far
cycles_planned integermax_cycles from create, or null for unlimited
paper_minted numberTotal PAPER minted by this campaign's losing legs
usdc_converted numberTotal USDC spent converting minted PAPER (haircut + fee)
queued_usdc numberProfit queued to fund a future cycle's margin instead of being paid out
haircut_paid numberTotal haircut paid converting PAPER to USDC
fees_paid numberTotal trading fees paid by this campaign
current_legs array[StrategyCampaignLeg]Open legs of the current cycle (0 while idle, up to 2 while open)
current_legs[].position_id stringThe venue's position id, or null while the open is still unconfirmed
current_legs[].side stringlong or short
current_legs[].entry numberEntry (mark) price the leg opened at
current_legs[].move_pct numberSigned move since entry, in percent, from this leg's point of view
current_legs[].bust numberThis leg's liquidation (bust) price
current_legs[].size numberPosition size
current_legs[].margin numberMargin posted for this leg, in USDC
current_legs[].leverage integerLeverage of this leg
current_legs[].mark_price numberLatest mark price used to watch this leg
current_legs[].parent_order_id stringThe order id that opened this leg
current_legs[].opened_at date-timeUTC time the leg opened, ISO 8601
last_cycle StrategyCampaignCycleThe campaign's most recently closed cycle
last_cycle.pnl_usdc numberNet result of the cycle, in USDC (can be negative)
last_cycle.paper numberPAPER minted by the losing leg of this cycle
last_cycle.closed_at date-timeUTC time both legs were closed, ISO 8601
last_cycle.multileg_order_id stringThe multileg (or paired single) order id the close went through, when known
last_error stringWhy the campaign is in error; empty otherwise
symbol stringAnboto symbol being farmed, e.g. BTC/USDC:USDC
leverage integerLeverage of each leg
margin_per_leg numberMargin posted per leg at the start of a cycle, in USDC
target_move_bps integerWinning-leg move, in basis points, that closes the cycle
budget_usdc numberbudget_usdc from create, or null for no spend cap
stop StrategyStopRulesStop conditions the campaign watches on its own, besides an explicit stop/kill
stop.queued_share_pct numberStop once this percent (0-100) of a new cycle's margin would come from queued profit rather than fresh budget. Null or omitted: off
stop.stop_before_key_expiry booleanStop gracefully once the Papertrade session key has under an hour left, rather than risk a cycle stuck open past expiry
stop.hard_kill_on_stop booleanIf a stop rule fires mid-cycle, close both legs at market now instead of waiting for the target
created_at date-timeUTC time the campaign was created, ISO 8601
started_at date-timeUTC time the campaign started, ISO 8601
stopped_at date-timeUTC time the campaign stopped, ISO 8601, or null while still running
body='{
"campaign_id": "string"
}'
curl -X POST "$BASE/api/v2/strategies/campaigns/resume" \
-H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \
-H "X-SIGN: $sign" \
-H "Content-Type: application/json" -d "$body"
payload = {
"campaign_id": "string"
}
r = requests.post(f"{BASE}/api/v2/strategies/campaigns/resume",
data=json.dumps(payload)
headers=signed_headers(payload))
print(r.json())
let payload = serde_json::json!({
"campaign_id": "string"
});
let resp = client
.post(format!("{BASE}/api/v2/strategies/campaigns/resume"))
.headers(signed_headers(&payload))
.json(&payload)
.send()?;
println!("{}", resp.text()?);
payload := map[string]any{
"campaign_id": "string",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", BASE+"/api/v2/strategies/campaigns/resume", bytes.NewReader(body))
for k, v := range signedHeaders(string(body)) {
req.Header.Set(k, v)
}
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
String jsonBody = mapper.writeValueAsString(payload);
HttpResponse<String> resp = client.send(
signedPost("/api/v2/strategies/campaigns/resume", jsonBody),
HttpResponse.BodyHandlers.ofString());
const payload: StrategyCampaignActionRequest = {
"campaign_id": "string"
};
const res = await fetch(`${BASE}/api/v2/strategies/campaigns/resume`, {
method: "POST",
headers: signedHeaders(payload),
body: JSON.stringify(payload),
});
const data: StrategyCampaign = await res.json();
val jsonBody = mapper.writeValueAsString(payload)
val request = signedPost("/api/v2/strategies/campaigns/resume", jsonBody)
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
std::string body = R"({
"campaign_id": "string"
})";
cpr::Response r = cpr::Post(
cpr::Url{BASE + "/api/v2/strategies/campaigns/resume"},
signedHeaders(body),
cpr::Header{{"Content-Type", "application/json"}},
cpr::Body{body});
std::cout << r.text << std::endl;
const payload = {
"campaign_id": "string"
};
const res = await fetch(`${BASE}/api/v2/strategies/campaigns/resume`, {
method: "POST",
headers: signedHeaders(payload),
body: JSON.stringify(payload),
});
console.log(await res.json());
Response 200
{
"id": "string",
"type": "string",
"status": "running",
"stopping": true,
"phase": "string",
"stop_reason": "string",
"cycles_done": 0,
"cycles_planned": 0,
"paper_minted": 0.0,
"usdc_converted": 0.0,
"queued_usdc": 0.0,
"haircut_paid": 0.0,
"fees_paid": 0.0,
"current_legs": [
{
"position_id": "string",
"side": "string",
"entry": 0.0,
"move_pct": 0.0,
"bust": 0.0,
"size": 0.0,
"margin": 0.0,
"leverage": 0,
"mark_price": 0.0,
"parent_order_id": "string",
"opened_at": "string"
}
],
"last_cycle": {
"pnl_usdc": 0.0,
"paper": 0.0,
"closed_at": "string",
"multileg_order_id": "string"
},
"last_error": "string",
"symbol": "string",
"leverage": 0,
"margin_per_leg": 0.0,
"target_move_bps": 0,
"budget_usdc": 0.0,
"stop": {
"queued_share_pct": 0.0,
"stop_before_key_expiry": true,
"hard_kill_on_stop": true
},
"created_at": "string",
"started_at": "string",
"stopped_at": "string"
}