Trading days
Log the balance an account closed each trading day at, read the days back with their changes, and remove a day.
A day is the balance an account closed a trading day at. Log one per day you trade; the account's figures are worked out from them.
The day object
{
"date": "2026-11-25",
"balance": 49900,
"change": -700,
"note": "Gave it back on the CPI spike"
}
date: the trading day,YYYY-MM-DD, in your own time zone.balance: the closing balance, in dollars.change: how far the account moved since the day before (the first day compares with the account size). A payout counts as profit taken, so a payout day doesn't show as a loss.note: optional, up to 280 characters.
List days
GET /accounts/{id}/days
Every day logged on the account, newest first. Returns { "days": [ … ] }. Any key.
Log a day
PUT /accounts/{id}/days/{date}. Read & write key.
curl -X PUT https://degenandfriends.com/api/v1/accounts/$ID/days/2026-11-27 \
-H "Authorization: Bearer $DF_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "balance": 51450.50, "note": "NQ open drive" }'
balanceis required: 0 or more, at most two decimals.noteis optional.- Logging a date that's already logged replaces it, so it's safe to send the same day again (for example, from a script that runs every evening).
- The date can't be in the future (
422 invalid_input), and the account can't be archived (409 account_archived): an archived account's days can't be added, changed or removed.
Returns { "day": { … } }, with its change.
Remove a day
DELETE /accounts/{id}/days/{date}. Read & write key.
Returns { "deleted": true }, or 404 not_found if nothing is logged on that date.
Example: a nightly sync
import datetime, os, requests
API = "https://degenandfriends.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['DF_API_KEY']}"}
def log_close(account_id: str, balance: float):
today = datetime.date.today().isoformat()
response = requests.put(
f"{API}/accounts/{account_id}/days/{today}",
headers=HEADERS,
json={"balance": round(balance, 2)},
)
response.raise_for_status()
return response.json()["day"]