Vest: record every trade, the bot's and outside ones, and list them

Vest's position history (GET /v3/positions) gives each position's size,
open and close price, P&L, fees, funding and why it closed. The client
reads it hourly and a minute after a position closes (or a flat balance
moves) into a new trades table, and stores open positions as they
appear. Vest can't tell an API order from a click, so the bot marks its
own opens and closes as it sends them; an unmarked trade since marking
began was someone else's.

The dashboard's Vest firm row gets a Trades button listing every trade
on its accounts with who opened it and how it closed; the account page
shows its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-26 19:23:24 -05:00
co-authored by Claude Opus 5.5
parent 29eaf64a6b
commit 95cc3bd23f
10 changed files with 603 additions and 4 deletions
+8
View File
@@ -248,6 +248,14 @@ own traffic since Vest publishes no API):
**Commission %** to the same (`0.0025`) for the pre-trade checks.
- Exits: the take-profit and stop are legs of the position on Vest's side,
and Vest cancels the other when one triggers.
- Trades: every position on the accounts, the bot's and anyone else's, from
Vest's position history (`GET /v3/positions`) — size, open and close price,
P&L, fees, funding and why it closed (stop loss, take profit, liquidation,
or an order on the account). Read hourly and a minute after a position
closes, into the `trades` table. Vest can't tell an API order from a click,
so the bot marks its own opens and closes as it sends them; anything
unmarked since marking began was someone else's. The **Trades** button on
the Vest firm's dashboard row lists them, and the account page shows its own.
`npm run check` includes the Vest helpers (scripts/check-vest.mjs).