toss-portfolio-state
Toss Portfolio State
Collect a read-only Toss Invest OpenAPI snapshot as a normalized toss_portfolio_snapshot for temporary account-state evidence.
Quick Start
-
Read
references/snapshot-contract.mdbefore mapping fields or changing the script. -
Confirm from the requested outcome that the task is read-only. If it includes orders, transfers, automatic rebalancing, or live execution, state the boundary and stop before loading credentials.
-
Check prerequisites. Both scripts need Bun on this device (verified with 1.4.2). The direct route needs Toss Invest OpenAPI credentials (
TOSS_INVEST_API_KEYandTOSS_INVEST_SECRET_KEY) in an env file the user names or in the process environment. The remote route needssshon this device and the credentials on the remote host at the fixed paths inreferences/remote-access.md. If Bun is missing, return a blocker that points to the official Bun install instructions; installing it needs the user's approval. Never store secrets, tokens, raw account numbers, or raw broker responses in the skill directory. -
Choose the route and run the transport bundled with the active skill directory:
-
If
~/.config/toss-portfolio-state/remote.jsonexists (or the file named byTOSS_PORTFOLIO_REMOTE_CONFIG), a remote route is configured: a host the user controls, such as a home server, whose public IP Toss accepts. Readreferences/remote-access.mdand run:bun --no-env-file --no-install scripts/remote_portfolio_snapshot.ts fetch --market-context basic --orders-days 30 --recent-orders-limit 40 -
If no remote route is configured and the user's Toss API key accepts requests only from a registered IP that this device does not have, offer the one-time remote setup in
references/remote-access.md. Run it only after the user approves the local SSH key and config changes. -
Otherwise, run the direct fetcher with an explicit env file that the user names. Load credentials only from that file or the process environment, and keep
--no-env-fileso Bun does not auto-load an ambient.env:
-