Guide
Loss limits, profit lock and targets
Stop trading for the day at a loss limit, lock in profit once it reaches a level, or exit everything at a profit target.
A risk_limit trigger watches the mark-to-market (MTM) of one account or of all your accounts together, and acts when a limit is reached. It has no legs. Needs the triggers scope.
A daily loss limit #
curl -X POST "https://cirrus.pocketful.in/v2/triggers" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"mtm_floor": -5000,
"on_breach": "flatten"
}
}'import os
import requests
response = requests.post(
"https://cirrus.pocketful.in/v2/triggers",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
json={
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"mtm_floor": -5000,
"on_breach": "flatten",
},
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v2/triggers', {
method: 'POST',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"mtm_floor": -5000,
"on_breach": "flatten"
}
}),
});
const body = await response.json();
console.log(response.status, body);Lock in profit #
Once MTM reaches arm_at, a floor is set at floor. If MTM falls back to it, the limit acts. Combine it with a loss limit in the same trigger:
curl -X POST "https://cirrus.pocketful.in/v2/triggers" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "user",
"mtm_floor": -10000,
"profit_lock": {
"arm_at": 8000,
"floor": 5000
},
"on_breach": "flatten"
}
}'import os
import requests
response = requests.post(
"https://cirrus.pocketful.in/v2/triggers",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
json={
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "user",
"mtm_floor": -10000,
"profit_lock": {
"arm_at": 8000,
"floor": 5000,
},
"on_breach": "flatten",
},
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v2/triggers', {
method: 'POST',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "user",
"mtm_floor": -10000,
"profit_lock": {
"arm_at": 8000,
"floor": 5000
},
"on_breach": "flatten"
}
}),
});
const body = await response.json();
console.log(response.status, body);A profit target #
Use a condition on the MTM variables (account.mtm, user.mtm). This one only notifies, so you decide:
curl -X POST "https://cirrus.pocketful.in/v2/triggers" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"when": "account.mtm >= 15000",
"on_breach": "notify"
}
}'import os
import requests
response = requests.post(
"https://cirrus.pocketful.in/v2/triggers",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
json={
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"when": "account.mtm >= 15000",
"on_breach": "notify",
},
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v2/triggers', {
method: 'POST',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"account": "P1",
"kind": "risk_limit",
"spec": {
"level": "account",
"when": "account.mtm >= 15000",
"on_breach": "notify"
}
}),
});
const body = await response.json();
console.log(response.status, body);| on_breach | What happens |
|---|---|
flatten (default) | Exits every open position at market. |
pause | Stops new entries; open positions stay. |
notify | Only tells you. |
Limits for automated strategies #
Automated strategies also share one daily loss limit and exposure cap. With close_on_breach, reaching the loss limit closes every open strategy trade:
curl -X PUT "https://cirrus.pocketful.in/v2/strategies/risk-limits" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_daily_loss": 15000,
"max_open_exposure": 300000,
"close_on_breach": true
}'import os
import requests
response = requests.put(
"https://cirrus.pocketful.in/v2/strategies/risk-limits",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
json={
"max_daily_loss": 15000,
"max_open_exposure": 300000,
"close_on_breach": True,
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v2/strategies/risk-limits', {
method: 'PUT',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"max_daily_loss": 15000,
"max_open_exposure": 300000,
"close_on_breach": true
}),
});
const body = await response.json();
console.log(response.status, body);{
"status": "success",
"data": {
"max_daily_loss": 15000,
"max_open_exposure": 300000,
"close_on_breach": true,
"updated_at": "2026-10-22T15:22:21.147Z"
},
"error": null
}