Record a trade
record_tradeRecords a buy or sell the user made, as the trade form on the page does: cash, the holding, the lots and the trade journal move, and fees are what the broker charged when given, otherwise worked out from the user's trading-cost settings. Places no order with any broker. The stock has to be on the watchlist, unless add_to_watchlist is true. A buy without trigger is filed as on a signal when the stock had a buy (for an add: add or buy) signal in the last 14 days, otherwise as manual. A sale to zero closes the journal with close_reason, or "other". Sent without preview_id, it changes nothing and returns a preview of the change with a preview_id; sent again with the same arguments and that preview_id, it makes the change.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"market": "<market>",
"ticker": "<ticker>",
"type": "<type>",
"price": "<price>",
"quantity": "<quantity>"
},
"name": "record_trade"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fees | No | What the broker charged for this trade, in its currency. Without it, the fee is estimated from the user's settings. | |
| stop | No | Buy only. Planned stop; null clears it. | |
| type | Yes | ||
| price | Yes | Price per share. | |
| lesson | No | Sell only. What the user took from it. | |
| market | Yes | hk = Hong Kong, us = United States, cn = China A-shares. | |
| target | No | Buy only. Planned target; null clears it. | |
| thesis | No | Buy only. Why, in the user's words. | |
| ticker | Yes | For example 0700.HK or 700 (hk), AAPL (us), 600519.SS or 600519 (cn). | |
| trigger | No | Buy only. Why it was bought. | |
| quantity | Yes | Shares. | |
| traded_at | No | Trade date in the market; default today there, YYYY-MM-DD. | |
| preview_id | No | The preview_id that the same call without it returned. Without it, nothing is changed. | |
| external_id | No | The client's own id for the trade, such as the broker's order number. Sent again, it records nothing and returns the trade already recorded with it. | |
| close_reason | No | Sell only. | |
| add_to_watchlist | No | Buy only. true adds the stock to the watchlist before the trade when it is not on it. Default false. |