SDK

Build on Prysm

A TypeScript-first SDK for opening perps, minting prediction markets, streaming GPU odds, and deploying autonomous trading agents on Solana. Rust bindings available for low-latency strategies.

@prysm/sdk·v2.4.1·MIT

Installation

$ npm install @prysm/sdk @prysm/risk
# or
$ pnpm add @prysm/sdk @prysm/risk

Define a trading agent

An agent binds a strategy to a set of markets and a risk guard. It signs with your wallet but never exceeds the limits you set.

import { Agent, Market } from '@prysm/sdk'
import { RiskGuard } from '@prysm/risk'

const sol = new Market('SOL-PERP', { leverage: 12 })

export const predictor = new Agent({
name: 'predictor',
engine: 'gpu-odds',
markets: [sol],
})

predictor.use(new RiskGuard({ maxLeverage: 20, maxNotional: 50_000 }))

Stream GPU odds

const stream = prysm.odds.subscribe('SOL-PERP')

stream.on('tick', (o) => {
if (o.edge > 0.02) predictor.enter(o)
})

Core methods

prysm.perps.open(market, opts)

Open a long or short perp position with leverage and slippage controls.

prysm.perps.close(positionId)

Close an open position and settle PnL on-chain.

prysm.markets.create(question)

Mint a new prediction market seeded by the GPU engine.

prysm.markets.trade(id, side, size)

Buy YES or NO shares against live GPU-priced odds.

prysm.odds.subscribe(market)

Stream sub-second fair-value and edge updates over WebSocket.

agent.use(guard)

Attach an on-chain risk guard to cap leverage, notional, and drawdown.

Ready to ship a strategy?

Deploy to mainnet or read the protocol docs.