Quickstart
Clone, test, price an option, reproduce every figure.
The reference implementation has no dependencies and no build step. Node 18 or later.
clone and verify
$ git clone https://github.com/ghosting9458/prior-protocol $ cd prior-protocol/priorem $ npm test 101 passing $ npm run emit regenerates every figure used by the site $ npm run underwrite -- --sweep the cold start curve for counterparty pricing
Price an option
node
import { price, greeks, surfaceVol } from './site/options.js'; const S = 182.40, K = 190, T = 30 / 365; const sigma = surfaceVol({ S, K, T, atmVol: 0.42 }); price({ S, K, T, r: 0.05, q: 0, sigma, kind: 'call' }); greeks({ S, K, T, r: 0.05, q: 0, sigma, kind: 'call' });
Margin a portfolio
node
import { marginRequirement, borrowingPower } from './site/perp.js'; const book = [ { kind: 'call', K: 190, expiryDays: 30, qty: -10 }, { kind: 'call', K: 210, expiryDays: 30, qty: 10 } ]; const market = { S: 182.40, atmVol: 0.42, r: 0.05, q: 0 }; marginRequirement(book, market).initial; // nets the spread borrowingPower(book, market).advanceRate; // what it lends
The testnet terminal runs these same calls in the browser. Nothing is fetched and no account is required.