Overview
A stock brain is one Robinhood stock token on Robinhood Chain (chain 4663), read live from every Uniswap v3 pool it trades in. One Multicall3 call reads the price, liquidity, both balances and the 30 minute time-weighted average of every pool of every stock token in the universe, plus the WETH/USDG pool that turns WETH prices into dollars. From that one read each brain works out a price, its drift, its spread, its depth and a plain read.
A basket brain weights up to eight stock brains in basis points. You can price any basket over the API, and you can publish one to the BrainStudio contract so others can rent it by the day.
Quick start
curl https://brainstocks.network/api/v1/brains/NVDA
const res = await fetch("https://brainstocks.network/api/v1/brains/NVDA");
const { block, brain } = await res.json();
console.log(block, brain.priceUsd, brain.read, brain.why);
Brain API endpoints
Base URL https://brainstocks.network/api/v1. Every endpoint is a plain GET that answers JSON, needs no key and allows any origin.
| Endpoint | Answers |
|---|---|
GET/brains | Every stock brain, deepest first, with chain figures, the universe and the rules. Add ?lite=1 to leave out pool lists. |
GET/brains/{symbol} | One stock brain with every pool behind its price. NVDA, nvda and nvda-brain all work. |
GET/brains?basket=NVDA:6000,SPY:4000 | A basket brain from the same block: index level, drift, capacity and each leg. |
Fields
| Field | Meaning |
|---|---|
block | The Robinhood Chain block every figure in the answer was read at. |
priceUsd | Depth-weighted mid of the live pools, in dollars. |
twapUsd | The same price at the pools' 30 minute time-weighted average. |
driftBps | Depth-weighted move of the live pools against their own 30 minute average, in basis points. |
spreadBps | Distance between the dearest and the cheapest live pool. null with one live pool. |
depthUsd | The thin side of every live pool, summed: about how much can trade before prices walk. |
livePools / pools | Pools that count right now, out of the pools the stock has. |
read, why | The plain read and the sentence that gave it (next section). |
route | The best two-pool route between this stock's pools and its edge after pool fees. Negative means the pools are in line. |
poolList | Each pool: fee tier, address, live or left out, price, depth and move against its average. |
Reads and rules
A pool is live when both of its sides hold at least $200 and it has liquidity at its current price. The read is the first rule that matches, in this order. The thresholds come back in every answer under rules.
| Read | Rule |
|---|---|
| offline | No live pool, so no price. |
| thin | Depth under $2,000 across the live pools. |
| split | Live pools 150 bps or more apart. |
| rising | 50 bps or more above the 30 minute average. |
| falling | 50 bps or more below the 30 minute average. |
| steady | Anything else: within 50 bps of the average, pools in line. |
A read describes the pools at one block. It is not a forecast and not advice.
Basket brains
Write a basket as SYMBOL:WEIGHT pairs joined by commas: 1 to 8 legs, whole basis points above 0, adding up to exactly 10000, no stock twice. The answer prices it as an index that is 100 at the 30 minute average:
index = 100 * sum(weight * priceUsd / twapUsd)
capacityUsd = min over legs of depthUsd / weight
capacityUsd is roughly how many dollars the whole basket could move before its thinnest leg runs out of depth. thin lists legs that read thin or offline.
Errors and limits
Errors answer {"ok": false, "error": "..."} in plain words: 400 for a bad basket, 404 for an unknown symbol, 502 when the chain did not answer in time. Answers are computed at most once every twelve seconds and cached at the edge for ten, so polling faster than that returns the same block.
BrainStudio contract
BrainStudio is a registry on Robinhood Chain. Anyone can deploy a basket brain: a name, 1 to 8 stock tokens from the allow-list, weights in basis points adding up to 10000, and a daily price in ETH (zero for free). Anyone can rent a brain for 1 to 365 days by paying exactly the price times the days. A rental extends the one you already hold. The creator is credited 95% and the BrainStocks treasury 5% (the fee is read from the contract and capped at 10%), and both withdraw on their own. The owner can change the allow-list, the fee (up to the cap) and the treasury, and can never move anyone's balance.
Functions
| Function | Who | What it does |
|---|---|---|
deploy(name, stocks, weightsBps, pricePerDay) | Anyone | Publishes a basket brain and returns its id. |
rent(id, days) payable | Anyone | Rents a brain; send exactly pricePerDay x days. |
withdraw() | Anyone owed | Pays out your balance. |
setPrice(id, pricePerDay) | Creator | Changes the daily price for new rentals. |
retire(id) | Creator | Stops new rentals; rentals already paid run out normally. |
expiry(id, user), rentalsOf(user), brainsOf(creator), owed(user) | Read | What the console shows for your wallet. |
Events
BrainDeployed, Rented, PriceSet, Retired, Withdrawn, StockSet, plus the ownership and fee events. The site reads state through view functions and never needs to scan logs.
Robinhood Chain
| Chain id | 4663 (0x1237) |
| RPC | https://rpc.mainnet.chain.robinhood.com |
| Explorer | robinhoodchain.blockscout.com |
| Gas token | ETH |
The console adds the chain to your wallet when you connect, if it is not there yet.