The problem
I trade crypto futures, and each exchange shows a closed position as a card: pair, entry and closing price, size, fee, profit and the times. Typing those numbers into a journal after every trade is tedious, and a journal with gaps cannot say whether a strategy works. Deposits and withdrawals blur it further, because a growing balance can be new money rather than profit.
The spec set the goal: invite-only access with no signup, trade entry that works from a phone, and analytics without distractions. In practice that meant the screenshot I already have should be enough to record a trade, and the numbers should separate what I put in from what I made.
What it does
- Reads a trade from a screenshot. The Add Trade dialog takes an image up to 10 MB. The server sends it to Google Cloud Vision, finds which exchange made it, and fills the form. I check the values and save.
- Saves trades from Telegram. After a one-time username and PIN, a bot linked to my chat takes a screenshot, runs the same reader and saves the trade without the form. It replies with the pair, side, prices, fee and P/L, or names the fields it could not read.
- Keeps out duplicates. When a screenshot carries the exchange's order ID, the trade keeps it, and both the dialog and the bot refuse a second trade with the same one.
- Separates capital from profit. Deposits and withdrawals are recorded on their own. The dashboard shows total capital, portfolio value, total P/L as a share of capital, win rate and trade count, and the chart puts trades and fund moves on one timeline.
- Stays private. The landing page is one field with no label or hint, as the spec asks. Only a registered username leads on to a 6-digit PIN pad; any other name gets "Access restricted. Contact administrator."
Decisions
One reader per exchange, picked by score
Exchanges label the same values differently, so there is one parser per exchange: Binance and BitXEx today. A detector checks the OCR text against six patterns per exchange, such as "Avg. Close Price" and "Closed Vol." for Binance or "Opening time" and "Close size" for BitXEx, and picks the one with the most matches. Fewer than two matches means unknown, and the form stays empty rather than half-filled from the wrong layout. A new exchange is one more parser and one more list of patterns.
Read the numbers the way the screen wrote them
Vision returns text, not numbers, and Binance writes decimals with a comma: a profit of 0,46 USDT. The parser treats a comma as the decimal point when it is the only separator and is not followed by exactly three digits, and uses the last separator as the decimal point when both appear. Binance's card also does not say long or short, so the side is worked out from the price direction and the sign of the profit: up and in profit is a long, down and in profit is a short.
The exchange's numbers win
The form requires the profit and the fee, read from the screenshot or typed, and shows the net profit as one minus the other before saving. The server stores those values as given rather than recomputing them from the prices, which would differ from the exchange by funding and rounding. The price formula, and a default fee of 0.1% of the position value, are only fallbacks for when a value is missing, which happens on the Telegram path. Every trade stores the gross profit, the fee and the net profit, so the dashboard never recomputes history.
The server checks the PIN, the browser draws the numbers
Logging in is a server function: the PIN is compared with a bcrypt hash, and a signed token goes into an httpOnly, SameSite=strict cookie that lasts 24 hours. The database stores a SHA-256 hash of that token, not the token. Five wrong PINs for a username lock it for 15 minutes. After that, the dashboard subscribes to my trades and funds in InstantDB, and every stat and the chart are computed in the browser from that live data, so a trade saved from Telegram appears on an open dashboard without a reload.
Delete where the cache lives
Deleting a trade first went through a server function with the admin client, and the deleted row stayed on screen until a reload, because the browser's InstantDB cache never heard about it. Deletes now run through the client SDK, which updates the local cache at once and syncs the change.
Limits
- Two exchanges, and no tests for them. Only Binance and BitXEx screenshots are read. The 45 unit tests cover the login helpers and the profit and stats calculations, not the OCR parsers. A screenshot from another exchange fills nothing, yet the dialog still says the data was extracted.
- Binance imports have no order ID. The Binance parser does not read one, so those trades skip the duplicate check and are saved as manual entries.
- The number reader can guess wrong. A comma followed by exactly three digits is read as a thousands separator, so a Binance value of
0,460becomes 460. The form shows every filled value before saving, but the Telegram bot saves without that review. - The lockout lives in memory. The PIN attempt counter is kept in the server process, so on serverless hosting each new instance starts it from zero.
- Two pages are placeholders. Analytics and Settings say Coming Soon.
- The trades table is made for wider screens. On a phone it scrolls sideways, and the side and P/L columns start off screen, as the second screenshot shows.
- It holds real money, so the screenshots do not. They come from a local copy running against a throwaway database with a made-up account and 14 sample trades. The live site shows only the login.


