QuantCore
Options pricing, crypto vol surfaces and portfolio risk for Apps
- Ratings
- —
- No ratings yet
- Price
- Free
- Version
- 1
- Dec 3, 2026
- Developer
- JamesTeam
About this library
QuantCore
Derivatives pricing, crypto volatility surfaces and portfolio risk — one statically linked library for SP2 Module Apps.
QuantCore is a pure-computation engine. Your App fetches market data through the Runtime SDK; QuantCore turns it into prices, Greeks, smiles and risk numbers inside your own Wasm, with no network calls and no host dependencies.
| Area | What you get | |---|---| | Vanilla options | Black–Scholes–Merton price and 20+ analytic Greeks (1st–3rd order), Black-76, implied volatility, whole-chain Greeks with book totals | | Exotics | Continuously monitored single barriers (all 8 types, rebates at hit or expiry), one-touch / no-touch, Margrabe exchange options | | Stochastic vol | Heston European options by the Fang–Oosterlee COS method, Heston implied-vol smiles | | Vol surfaces | Strike chain → 10D/25D/ATM/75D/90D forward-delta pillars, Kahale arbitrage-free NK smiles, Gaussian-copula cross-pair smiles (e.g. ETH per BTC) from two USDC smiles, futures forward curve | | Risk & performance | Sharpe, Sortino, Calmar, CAGR, max drawdown (with dates and duration), historical and parametric VaR / CVaR, skew and kurtosis, win rate, profit factor, correlation matrix, fractional Kelly, spot × vol scenario P&L grids | | Technicals | SMA, EMA, Wilder RSI, Bollinger bands, MACD, rolling realised volatility |
Accuracy is tested against published references: Hull's textbook values, Haug's barrier tables, the Fang–Oosterlee Heston benchmark (to 2e-8), finite-difference Greeks, and put–call / in–out / touch–no-touch parities. The cross-pair engine reproduces the reference Python implementation's BTC/ETH surface to 2e-12 in volatility.
Interface
The ABI is three C functions. All symbols carry the sp2_01a23586_831e_7400_aa12_ee402ec9a321_ prefix.
| Function | Signature | Description | |---|---|---| | sp2_01a23586_831e_7400_aa12_ee402ec9a321_init | int32_t (void) | One-time setup. Call exactly once from your App's `init()` before anything else. Returns 0. | | sp2_01a23586_831e_7400_aa12_ee402ec9a321_call | int32_t (const uint8_t *req_ptr, size_t req_len, uint8_t **out_ptr, size_t *out_len) | Runs one JSON request. Returns 0 and writes a UTF-8 JSON response buffer; returns -1 if out_ptr/out_len is NULL or req_ptr is NULL with req_len > 0. | | sp2_01a23586_831e_7400_aa12_ee402ec9a321_free | void (uint8_t *ptr, size_t len) | Releases a buffer from _call. NULL is a no-op. Free each buffer exactly once. |
Every request is a JSON object with an op field. Every response is either {"ok": true, "data": ...} or {"ok": false, "error": "<message>"} (domain errors such as a price outside no-arbitrage bounds, a delta pillar that cannot be bracketed, or invalid inputs). The Rust crate also exports safe wrappers init() and call(&str) -> Option<String>.
Conventions. Rates and volatilities are decimal and annualised (0.6 = 60%); time t is in years; right is "call" or "put". Raw Greeks use a 1.0 vol move and one year of time passage; the *_1pct / *_1d fields are scaled to 1 vol point / 1 rate point / 1 calendar day. r, q default to 0 when omitted.
Operations
| op | Required fields (optional with defaults) | Returns | |---|---|---| | version | — | version, ops (list of operation names) | | bs_greeks | right, spot, strike, t, vol (r, q) | price, delta, gamma, vega, theta, rho, phi, vanna, volga, charm, veta, speed, zomma, color, ultima, dual_delta, dual_gamma, forward_delta, lambda, vega_1pct, theta_1d, rho_1pct, gamma_1pct, d1, d2, forward, prob_itm | | bs_chain | spot, t, legs[] (r, q); leg: right, strike and vol or price (t, qty=1) | legs[] (ok, vol, greeks or ok:false, error), net {delta, gamma, vega_1pct, theta_1d}. Max 2000 legs. | | implied_vol | right, price, spot, strike, t (r, q) | vol | | barrier | kind, spot, strike, t, vol, barrier (r, q, rebate=0, pay_at_expiry=true); kind ∈ dic dip doc dop uic uip uoc uop | price, vanilla, barrier_discount, delta, gamma, vega_1pct | | touch | kind, spot, t, vol, barrier (r, q, rebate=1, pay_at_expiry=true); kind ∈ otd otu ntd ntu | price, probability_proxy | | exchange | s1, s2, t, v1, v2, rho (u1=1, u2=1, q1, q2) | price of max(u1·S1 − u2·S2, 0) | | heston | right, spot, strike, t, params{kappa, theta, eta, rho, v0} (r, q, n_terms=512, implied=false) | price, implied_vol (null unless implied) | | heston_smile | as heston | forward, points[25] {moneyness 0.6–1.5, strike, price, implied_vol} | | delta_nodes | strikes[] (ascending), vols[], forward, t | five pillars {label, call_delta, put_delta, strike, volatility, delta_error} | | future_forward | t, times[], prices[] | forward (linear in maturity, flat ends) | | cross_smile | leg1, leg2, t (rho=0.5, quadrature_points=100); leg: strikes[5] ascending, vols[5], forward, spot | forward, atm_strike, atm_target_volatility, rho_copula, atm_price_error, quadrature_mass, iterations, points[41] {x, strike, volatility, price_quote, forward_call_delta} | | perf_stats | equity[] (≥3 positive) (periods_per_year=365, rf=0) | total_return, cagr, vol_annual, sharpe, sortino, calmar, max_drawdown, max_drawdown_start, max_drawdown_end, max_drawdown_duration, var_95, cvar_95, var_99, cvar_99, parametric_var_99, skew, kurtosis_excess, win_rate, profit_factor, best, worst, periods | | indicators | close[] (sma[], ema[], rsi, bollinger:[n,k], macd:[fast,slow,signal], realized_vol, periods_per_year=365) | one array per requested indicator, aligned to close, null during warm-up | | correlation | series[][] (equal length ≥3) | matrix | | kelly | p, b (fraction=1) | fraction | | scenario_grid | spot, legs[]{right, strike, t, vol, qty}, spot_shocks[], vol_shocks[] (r, q, days_forward=0) | base_value, spot_shocks, vol_shocks, pnl[vol][spot] |
Cross-pair method. leg1/leg2 quotes units of coin 2 per coin 1 (BTC/ETH = ETH per BTC). Each five-delta smile is turned into a Kahale piecewise-Black marginal; the cross ATM volatility target is √(σ₁² + σ₂² − 2ρσ₁σ₂) at the forward-delta-neutral strike; a Gaussian copula is calibrated to that price by bisection on a Gauss–Legendre grid; 41 strikes on x = −2…2 standard deviations are priced and inverted to Black vols. rho is a scenario input; rho_copula is the fitted parameter. USDC discounting is zero and spot is the coin's USDC perpetual mark (a disclosed proxy). Non-convex input smiles or an unreachable ATM target return an error; there is no silent smoothing.
Example
Request:
{"op":"bs_greeks","right":"call","spot":100,"strike":100,"t":0.5,"vol":0.6}Response (abridged):
{"ok":true,"data":{"price":16.80,"delta":0.5840,"gamma":0.009260,"vega_1pct":0.2778,"theta_1d":-0.0761,"...":"..."}}Error:
{"ok":false,"error":"price 30.00000000 outside no-arbitrage bounds (0.00000000, 20.00000000)"}Usage
Cargo.toml of your App backend:
[dependencies]
quantcore = { package = "sp2019e58bb4e6574848b4d4f97d6ee45ca-01a23586-831e-7400-aa12-ee402ec9a321-sys", version = "=<version>", registry = "sp2-cargo" }
serde_json = "1"use sp2_sdk::app::App;
use sp2_sdk::{AbiError, InitialContext};
struct MyApp;
impl App for MyApp {
async fn init(_ctx: InitialContext) -> Result<(), AbiError> {
if !quantcore::init() {
return Err(AbiError::internal("QuantCore init failed"));
}
Ok(())
}
}
fn greeks(spot: f64, strike: f64, t: f64, vol: f64) -> Result<serde_json::Value, String> {
let req = serde_json::json!({ "op": "bs_greeks", "right": "call", "spot": spot, "strike": strike, "t": t, "vol": vol });
let text = quantcore::call(&req.to_string()).ok_or("QuantCore ABI failure")?;
let resp: serde_json::Value = serde_json::from_str(&text).map_err(|e| e.to_string())?;
if resp["ok"] == true { Ok(resp["data"].clone()) } else { Err(resp["error"].as_str().unwrap_or("error").to_string()) }
}The archive needs only wasi_snapshot_preview1 and libc malloc; it uses no threads, no host functions and no global state, so calls are reentrant from concurrent App tasks.
Versioning / Compatibility
- Semantic versioning. New operations and new response fields are minor releases; a removed or renamed field or a changed default is a major release.
- Unknown request fields are rejected only where they collide with a typed field; extra fields are otherwise ignored.
- Built for
wasm32-wasip1with the platform Rust toolchain; link it into SP2 Module App backends only.
Pricing / Entitlement
Distributed through the SignalPlus Marketplace. Using QuantCore in your own App requires your organisation to hold a QuantCore entitlement with you assigned as a member; the entitlement covers every reviewed version. Apps that end users install from you do not need their own QuantCore entitlement. The price is shown on the Marketplace listing.
What's new
Version 1 · Dec 3, 2026
Information
- Developer
- JamesTeam
- Type
- Library
- Price
- Free
- Remix
- Not open to remix
- Listed
- Dec 3, 2026
More from this developer
Apps on the Marketplace are made by independent developers and reviewed by SignalPlus before listing; their descriptions are the developers' own. Nothing here is investment advice or a promise of returns.
