--- name: price-watch description: >- Gives the price now of one token or up to 20 at once, with the 24h change, from Chord's own trade index on Monad, Robinhood Chain, Arc and Solana and from CoinGecko on Avalanche, Base, BNB Chain, Arbitrum and Ethereum (Chord's index when CoinGecko does not list the token). A wait mode follows Chord's live price stream until a token goes above or below a level, or a time limit passes, then prints one line: it covers the Monad tokens on Chord's live ticker (MON, USDC, WETH, WBTC, shMON, USDT0 and the top nad.fun memes) and every priced Robinhood Chain token, stocks included. Use when the user asks for prices, a quick ticker, or "tell me when X crosses Y" within the next hour. Not for candles or history (charts), full token stats (token-stats) or alerts that last days. Read only. license: MIT compatibility: Needs python3 and HTTPS to api.getchord.xyz. Set CHORD_API_KEY (free at chordsi.xyz/me). metadata: author: Chord (getchord.xyz) homepage: https://chordsi.xyz/s/price-watch version: "1.0.0" --- # Price Watch Prices for a list of tokens in one go, and a way to wait for a level without polling: the wait mode holds one connection to Chord's live market stream and returns the moment the price crosses. ## Run it ```bash python3 scripts/price_watch.py CHAIN TOKEN [TOKEN ...] python3 scripts/price_watch.py ticker python3 scripts/price_watch.py CHAIN TOKEN --above PRICE | --below PRICE [--max-wait 600] ``` - `CHAIN`: monad, robinhood, arc, avalanche, base, bnb, arbitrum, ethereum or solana (wait mode: monad or robinhood). - `TOKEN`: a contract address (best), a listed symbol, or the chain's coin (MON, ETH, AVAX, BNB: priced through its wrapped token). On Solana, the mint exactly as written. Up to 20 tokens per run. - `ticker`: Chord's live ticker strip, the Monad tokens the wait mode can follow. - `--above` / `--below`: the level in dollars. `--max-wait`: seconds to wait, 10 to 3600 (default 600). Example: `python3 scripts/price_watch.py monad MON --above 0.01 --max-wait 600` ## Read the answer - Prices now: `prices` (`symbol`, `name`, `token`, `priceUsd`, `change24hPct`, `volume24hUsd` where known, `source`: `chord index`, `coingecko`, or `peg` for the stablecoin a chain's pools are quoted in) and `missing` (each token with no price, and why; `AMBIGUOUS` lists `candidates`). - Wait mode prints ONE line of JSON: `crossed` (true or false), `reason` (`crossed`, `already there`, `max wait`, `stream closed`), `priceUsd` (the last price seen), `startPriceUsd`, `waitedS`, `at` (UTC). - On the stream, Robinhood Chain prices refresh every few seconds; Monad ticker prices about every two minutes, so a brief spike on Monad can pass unseen. The wait can run a few seconds past `--max-wait`. - Exit 2: the chain or token is not on the live stream (check the price now instead), or nothing could be priced. Exit 3: no token could be identified (ask which one). ## How to answer the user 1. Prices: one line per token with the price and 24h change; name the source when it is CoinGecko or a peg. Say which tokens had no price and why. Check `name`: a ticker can belong to a meme (on Robinhood Chain, "HOOD" is a meme, not the stock), so pass the address when it matters. 2. Before a wait, tell the person what you are waiting for and for how long. After it, say plainly whether it crossed, the price and the time; `already there` means it was past the level when the wait began. 3. This is not a standing alert: it ends when the script ends. For longer watches, run it again. 4. Report prices; never predict them or give investment advice. ## Cost Monad, Robinhood Chain and Arc: one call for any number of tokens. Avalanche, Base, BNB Chain, Arbitrum and Ethereum: one call per token (two when CoinGecko does not list it). Solana: one per token, plus one per symbol. The ticker: one. A wait: one call for the whole stream (a dropped stream reconnects, at most twice, each one more call). Calls that answer an error are not charged. `billableCalls` (prices now) and `streams` (wait) say what it used. 300 calls a month are free; then $0.006 a call from your ChordSI credit. If the script exits with code 4, show the person the message: their credit is empty or a limit was reached, and chordsi.xyz/me is where they top up. ## Chord endpoints it calls - `GET /v1/tokens/market?chain=`: Monad, Robinhood Chain and Arc prices in one map. - `GET /v1/chains/{chain}/token/{address}/ref-price` (CoinGecko), then `GET /v1/chains/{chain}/token/{address}` (Chord's index) on Avalanche, Base, BNB Chain, Arbitrum and Ethereum. - `GET /v1/chains/solana/token/{mint}`, `GET /v1/chains/solana/search`: Solana. - `GET /v1/market/ticker`: the ticker. `GET /v1/stream/market` (server-sent events, `ticker` and `rh-ticker`): the wait. - Free lookups: `GET /v1/tokens`, `GET /v1/tokens/search`, `GET /v1/chains`.