Anchor
Anchor documentation / v0.1
On this page
Introduction

The fair-price layer for xStocks.

Anchor helps people buy tokenized US stocks on Solana without blindly accepting the pool price. Before a wallet signs, Anchor compares the live xStock quote with the real US-listed share and turns the difference into one clear verdict.

Why this exists

xStocks trade around the clock; US exchanges do not. At night and on weekends, the token can drift away from the share it represents. Anchor makes that hidden premium visible, adjusts for market conditions, and records the decision with the trade.

9
stocks & ETFs
20s
live refresh
30d
normal range
1 tx
swap + receipt
01Start here

Quick start

Anchor is designed to answer a single question before every buy: is this token fairly priced right now?

  1. 01
    Choose an xStock

    Open Markets and select one of the supported stocks or ETFs.

  2. 02
    Read the tether

    Compare the token price, fair range, market session, and current verdict.

  3. 03
    Request a quote

    Enter a USDC amount. Anchor checks the exact Jupiter route—not an indicative price.

  4. 04
    Review and sign

    Confirm the dollar cost. A Wait verdict requires an extra acknowledgement.

02Core concept

The price tether

A raw token price alone is not enough. Anchor measures the logarithmic premium between an executable xStock price and the corresponding real share, corrected for the token's dividend multiplier.

premium = 10,000 × ln( xStock price ÷ (equity price × shares per token) )

The result is expressed in basis points. Anchor then asks whether this premium is normal for the asset and the current US market session. The visual tether is the live relationship between those two prices—not a promise that they will always match.

03Core concept

How the guard decides

1

Read the real share

Anchor reads the Pyth Equity.US.<TICKER>/USD price account on Solana, including the publisher confidence interval and the age of the latest price.

2

Price the token from both sides

A reference xStock price is the geometric midpoint of a live $100 Jupiter buy quote and the matching sell quote. This removes the bid/ask bounce found in pool last-trade data.

3

Adjust for reinvested dividends

xStocks use Token-2022's ScaledUiAmount extension. Anchor reads the mint multiplier so one raw token is compared with the correct number of underlying shares.

4

Build a normal range

Thirty days of hourly token and equity history create separate regular-hours and extended-hours baselines. The center is the median; dispersion uses a robust MAD-based scale so one bad print cannot dominate the model.

5

Respect a sleeping market

When the US market is closed, the last equity price becomes stale. The allowed range widens with the square root of hours closed, while live oracle confidence adds another uncertainty term.

z = (premium − typical premium) ÷ √(baseline uncertainty² + oracle confidence²)
market closed: uncertainty = √(extended-hours σ² + hourly volatility² × hours closed)
04Core concept

Four verdicts

The model is intentionally asymmetric for a buyer: an unusually low price is useful information; an unusually high price is a cost that deserves friction.

Discount
z ≤ −2
Below its normal range. Good news if you already intended to buy.
Fair
−2 < z < 2
Inside the normal range for this asset and session.
Pricey
2 ≤ z < 3
Above normal, or the route adds more than 0.5% of swap cost.
Wait
z ≥ 3
Far above normal. Buying requires an explicit confirmation.

Thresholds describe the current prototype. They are decision aids—not predictions that a token's price will rise, fall, or converge.

05Trading

Guarded buy

The market card is only the first check. Anchor evaluates the user's exact Jupiter quote again before building the transaction, separating the market premium from route spread and price impact.

1 / Quote

Request a live USDC → xStock route.

2 / Re-check

Compare execution price with the guard.

3 / Build

Compose swap and guard memo together.

4 / Sign

The connected wallet signs one v0 transaction.

User stays in control

Anchor does not sign for the user or custody funds. The server prepares an unsigned transaction; the connected Solana wallet reviews and signs it.

06Trading

On-chain receipts

Every completed Anchor buy includes a Solana memo in the same transaction as the Jupiter swap. That makes the guard's decision public, durable, and tied to the exact execution moment.

anchor-guard:v1|AAPLx|v=fair|z=0.84|prem=+12.3bp|exec=+25.1bp|sess=regular|refage=0.0h
vFinal verdict after execution costs
zHow unusual the observed premium was
premMarket premium in basis points
execAll-in execution premium in basis points
sessUS market session at evaluation
refageAge of the equity reference

The Activity page queries the connected wallet's recent Solana signatures and reconstructs its Anchor receipts directly from these memos.

07Reference

Data sources

InputSourceHow Anchor uses it
Real stock / livePyth on SolanaPrice, confidence interval, update time
xStock / liveJupiterTwo-sided executable quote midpoint
Shares per tokenToken-2022 mintScaledUiAmount dividend multiplier
xStock / historyGeckoTerminal30-day hourly pool averages
Equity / historyYahoo Finance30-minute bars, aggregated hourly
Swap executionJupiterQuote, routing and swap instructions
ReceiptsSolana RPCWallet signatures and memo records

Historical snapshots bundled with the app are fallback data only. Live sources are fetched server-side and cached briefly to reduce rate pressure.

08Reference

Architecture

Anchor is a Next.js application deployed on Vercel. Market data and transaction assembly run server-side; wallet connection and signing stay in the browser.

Interface
Next.js App Router · React · Wallet Standard
↓
Decision layer
Guard baseline · live evaluation · execution check
↓
Pyth
real share
Jupiter
quote + swap
Solana
wallet + memo
src/lib/guard.ts       statistical model and verdicts
src/lib/pyth.ts        Pyth account decoding
src/lib/sources.ts     live and historical market data
src/lib/trade.ts       guarded Jupiter transaction + memo
src/app/api/*          server-side data and transaction routes
09Reference

API overview

These routes power the current web client. Responses are JSON; live routes are dynamic.

GET/api/guardCurrent verdicts for all supported assets
GET/api/guard/:tickerOne guard, 31-day chart series and baseline summary
GET/api/quote?ticker=SPY&usdc=100Guarded Jupiter quote for a specific order
POST/api/swapUnsigned v0 swap transaction with guard memo
POST/api/sendBroadcast a wallet-signed transaction and await confirmation
GET/api/audit?wallet=…Anchor memo receipts for a wallet
GET/api/balance?wallet=…SOL, USDC and supported xStock balances
Prototype interface

The API is public implementation detail for the hackathon app, not a versioned external developer API. Routes and schemas may change.

10Reference

Limits & risks

  • Mainnet only. xStocks do not exist on Solana devnet, so swap flows use mainnet assets and real funds.
  • Availability. Pyth, Jupiter, Solana RPC and historical data services can be stale, unavailable or rate-limited.
  • Model risk. A statistical normal range cannot guarantee fair value or predict future convergence.
  • Market risk. Tokenized equities add issuer, liquidity, tracking, smart-contract and regulatory risk.
  • Eligibility. xStocks are not available to US persons. Users must check their own local eligibility.
  • Prototype status. Anchor is hackathon software, not audited financial infrastructure or investment advice.
11Project

What comes next

The following items are planned directions, not live product capabilities.

Guard-timed recurring buys

A weekly order that waits within a set window for Fair or Discount.

Planned / not live
Guided portfolios

A short risk flow leading to a diversified xStock basket.

Planned / not live
Embedded wallet

A gentler first-run experience without requiring a seed phrase.

Planned / not live
Price alerts

Notify a user when a watched xStock returns to its normal range.

Planned / not live
See the gap before you buy.

Built for the Solana Stocklana hackathon.

Read the source ↗