UnderneathThe libraries
The server is a protocol surface over five libraries, each of which stands on its own. If you are writing Python rather than driving a model, import them directly — the server adds validation, handles and a wire format, and none of that is useful inside a process.
| Install | Import | What it does |
|---|---|---|
| moneyness | moneyness | option pricing under Black-Scholes-Merton with the full Greek set, implied volatility, SVI surfaces and Dupire local volatility, pricing on a finite-difference grid under that local volatility, European, American and knocked out at a barrier, single-barrier options in closed form, agreeing with the grid and the simulation to the accuracy each of those supports, American exercise on lattices and in closed form, Heston stochastic volatility priced through its characteristic function by two independent routes, Monte Carlo under both models, including Andersen's quadratic-exponential scheme for the variance process, SABR smiles in both volatility conventions, with a Bachelier model and the density the smile implies, variance and volatility swap strikes replicated out of the quoted smile, with no model in the replication at all, average-price options, whose price can only be bracketed between bounds that hold as inequalities, options on the difference of two correlated assets, with an upper bound that carries no correlation at all because it is the price under the worst one, lookback options on where the path got to, all four of them from one integral of the running extreme's own law, options on a foreign share in all four of the forms the contract is written in, where one correlation leaves one of the four prices untouched and moves two of the others in opposite directions, and choosers and compound options, where the decision is taken at a date before the payoff is known and the price is checked against a decomposition that puts nothing of its own on the other side. |
| shortfall | shortfall | shrinkage covariance and factor risk attribution, value at risk and expected shortfall by five methods, spectral risk measures, where coherence is a property of the weight function rather than of the construction, the loss tail of a portfolio of obligors from its cumulant generating function, expanded where the question is rather than at the centre of the distribution, risk contributions, risk parity and drawdown statistics, conditional volatility, simulated horizons and coverage backtests, generalised Pareto tails and Gaussian or Student-t copulas, volatility from the whole bar by five range estimators, strictly consistent scores for ranking two adequate risk models, expectiles, the only risk measure that is coherent and elicitable at once, a view imposed on a scenario set by reweighting it rather than by filtering it, so the dependence that made the sample worth using survives the stress, the range value at risk can occupy when the marginals are known and the dependence is not, bracketed between two inequalities and two couplings that are constructed rather than assumed, the eigenvalues of a covariance estimate separated into the ones its dimensions can distinguish and the ones that are noise, risk for a book that is quadratic in its factors rather than linear, including the loss bound a long-gamma book has and a delta-only model cannot express, the worst loss over a plausibility ellipsoid, exactly, and the factor move that produces it -- against which moving one factor at a time understates by a factor that grows with the book, and tail risk for a book with a calm state and a stressed one, where the expected shortfall is not the average of the two states' expected shortfalls and the gap is 45% at the level people report. |
| tenor-curves | tenor | day counts, business-day conventions and schedules, curve bootstrapping with monotone interpolation, bond analytics and key rate durations, option-adjusted spreads on a short-rate lattice, floating rate notes and index-linked bonds, forward curves, carry and roll-down, survival curves, credit default swaps and risky bonds, deliverable bond futures, conversion factors and the basis, forecasting and discounting on separate curves, with tenor basis, swaptions on the annuity measure, caps and floors, caplet volatilities bootstrapped out of flat cap quotes, with how sharply each one is pinned reported beside it, constant maturity swaps, replicated out of those same swaptions because the rate is paid outside the measure it is a martingale under, a Gaussian short rate model fitted to the curve, with bond and swaption prices in closed form, a second factor, so that two rates are no longer forced to move together, Bermudan swaptions, where several exercise dates leave no formula for any of them, covered interest parity across two currencies, and the cross-currency basis that is the residual of it, overnight rates compounded over an accrual, under each of the conventions on where the observation window sits, with the replication identity reported where one exists, a parametric forward curve fitted by least squares, for a set of bonds that no curve passes through, the convexity adjustment a daily-margined rate future carries over the forward its own accrual period implies, exactly and for each of the three settlement conventions, and the asset swap spread a bond is actually quoted on, in both of its conventions, which differ by par over the price and neither of which bounds the Z-spread. |
| slippage-tca | slippage | implementation shortfall decomposed against its benchmarks, market impact fitting and reversion, Almgren-Chriss schedules, constrained and for a whole basket, transient impact under a decay kernel, and the schedule it implies, volume curves and participation, a simulator to score a schedule against, schedules that react to the liquidity regime they find, resting a limit order against crossing the spread: the fill probability, the adverse selection and the cost of each, tracking a volume-weighted benchmark, which moves with the market and so inverts what risk aversion does, a schedule that can hold a view, where the smoothing a price forecast receives is the urgency the problem already had, the size at which executing the trade consumes the alpha that motivated it, under both of the conventions in use, which disagree about which impact term sets the limit, what a schedule built on a wrong impact coefficient or volatility costs, which is one number because the schedule sees the parameters only through their ratio, splitting one order across venues whose available liquidity is random, where a posted lot is worth the probability that it is both reached and needed, and the effective spread estimated from bars by three published estimators, each reported with the share of windows it refused and its value before those refusals were floored at zero. |
| holdout-backtest | holdout | deflated Sharpe ratios and effective trial counts, returns put in excess of a financing rate, and what that takes off a Sharpe ratio before any search is accounted for, the probability of backtest overfitting, purged and combinatorial cross-validation, tests for superior predictive ability and a model confidence set, multiplicity haircuts and a robust Sharpe-difference test, a test for a break in the Sharpe ratio at a date the data chose, sample weights for overlapping labels, and the effective sample size they imply, the exact law of a track record's worst drawdown, and the depth a strategy of a given Sharpe ratio reaches anyway, intervals that hold at every record length at once, for a record that is read as it accumulates rather than sampled once, and an interval for the Sharpe ratio of the strategy that was selected, conditional on its having been selected, which the ordinary interval covers 31% of the time out of fifty candidates. |
Two of those install under a name that is not the name you
import. slippage and holdout on the package
index belong to unrelated projects that were there first, so these publish as
slippage-tca and holdout-backtest. Renaming the Python
packages to match would have broken every existing import to settle a registry
collision. The failure mode is quiet — pip install slippage
succeeds and hands you somebody else's library — which is why it is stated
here rather than left to be discovered.
In the libraries, not on the server
The tool surface has a size budget, because every tool's schema is in a model's context before it has done anything, and a surface that does not fit is a surface that crowds out the work. It stands at 39 tools and 138,605 characters against a ceiling of 140,000. The following are built and tested in the libraries and have no tool, which is a statement about the budget and not about what is worth having:
| Library | What it does |
|---|---|
| holdout | a bootstrap test for a break in the Sharpe ratio at a date chosen by the data, and how little power it has |
| holdout | an interval for the Sharpe ratio of the strategy that was selected, conditional on its having been selected, against which the ordinary interval covers the winner's own truth 31% of the time out of fifty equally good candidates -- and which is the wrong tool once those candidates correlate above about three quarters |
| holdout | anytime-valid intervals for a record read as it accumulates, where monitoring an ordinary 95% interval and stopping at the first crossing rejects 44% of the time at 250 observations with no edge present, and replacing it costs a factor of 3.40 in data |
| holdout | financing: returns in excess of a cash rate, where a Sharpe ratio taken on total returns is too high by the rate over the volatility -- 0.31 annualised at 5% cash and 16% volatility, which takes the deflated Sharpe ratio of the best of thirty crossover rules from 0.971 to 0.644 while leaving the benchmark the search earns where it was -- and where one cash rate is not one shift, since it is the rate over each strategy's own volatility, so the strategy that looks best can change and the field it won against is not the field it was judged against |
| holdout | sample weights for overlapping labels, and the arithmetic cap that leaves a sequential bootstrap nothing to recover at full size |
| holdout | the exact law of a track record's worst drawdown, where a strategy with no edge at all expects to fall 17.1% in its first year at 15% volatility and the depth grows logarithmically rather than without bound once there is an edge |
| moneyness | Asian and barrier payoffs under stochastic volatility |
| moneyness | Heston stochastic volatility: the transform, the smile it generates, and simulation of the variance process |
| moneyness | SABR in both volatility conventions, a Bachelier model, and where a long-dated smile stops being a distribution |
| moneyness | a finite-difference solver that prices under the Dupire local volatility rather than only computing it, and the coordinate mistake no derivative test can catch |
| moneyness | arithmetic-average options bracketed rather than priced, where the moment-matched price every system quotes falls below a rigorous lower bound out of the money |
| moneyness | choosers and compound options, where the chooser's closed form is checked against the vanilla pair put-call parity decomposes it into and each compound pair against a parity that constrains both of its members at once |
| moneyness | cross-currency equity options -- foreign struck, quanto, composite and equity-linked -- and the recovery of the exchange rate's volatility and its correlation from two prices, neither of which identifies either on its own |
| moneyness | lookback options on the running extreme, where the closed form everybody transcribes divides by zero on an option on a future and a monthly fix is worth eighteen per cent less than the continuous contract |
| moneyness | options on the difference of two correlated assets, and the measured fact that the approximation desks quote leaves a rigorous no-arbitrage bracket at eighteen of eighty-four strikes and correlations |
| moneyness | single-barrier options in closed form, and the measured fact that a knock-out is the one price in the library that falls as volatility rises |
| moneyness | variance and volatility swaps replicated from the quoted smile, and how much further out the strikes have to reach than a Gaussian rule of thumb would suggest |
| shortfall | a portfolio loss tail from its cumulant generating function, where the lattice correction most treatments call a refinement is worth a factor of seven hundred |
| shortfall | a view imposed on a scenario set by minimum relative entropy, where the move it induces in a series the view never mentioned is that series' own regression coefficient and its tail moves by under half of what a parallel shift predicts |
| shortfall | expectiles, coherent and elicitable at once, and the measured reason a single level cannot stand in for a confidence level |
| shortfall | scoring functions that rank two adequate models, and the measured failure of the one anybody builds first |
| shortfall | second-order risk for a book of options, with the loss floor a long-gamma book has and the confidence above which a delta-only number exceeds it |
| shortfall | spectral risk measures, and the measured factor of two between two spectra that agree on the headline charge |
| shortfall | the exact worst loss over a plausibility ellipsoid and the factor move that causes it, beside the one-factor-at-a-time stress test it replaces -- which understates by a median factor of 6.8 over eight factors, and whose per-factor losses do not sum to a bound on anything |
| shortfall | the noise band a covariance estimate's own dimensions imply, and the factor strength below which a direction leaves no trace in the spectrum whatever its true size -- at sixty assets over a hundred and twenty observations, anything adding less than half again a direction's variance |
| shortfall | value at risk and expected shortfall for a book drawn from a mixture of regimes, with the share of the tail each regime is responsible for -- a state happening 5% of the time carries 97% of the losses past the 99th percentile -- and the horizon law under a Markov chain of states, where the square-root rule is wrong in a direction that depends on the confidence level |
| shortfall | value at risk bounded with no dependence named at all, where the worst coupling runs to twice the comonotonic one on heavy tails and most of the gap between the attained bound and the proved one is quadrature rather than dependence |
| shortfall | volatility from open, high, low and close, by five range estimators |
| slippage | an execution schedule that holds a price forecast, and the measured fact that a tuned proportional tilt recovers 99% of what solving it exactly is worth on anything but a sharp signal |
| slippage | basket liquidation under a matrix of impact and a matrix of risk |
| slippage | impact that decays at a rate rather than instantly, and the block-rate-block schedule that minimises its cost |
| slippage | post-trade mark-outs and reversion decay |
| slippage | the effective spread inferred from bars by the Roll, Corwin-Schultz and Abdi-Ranaldo estimators, each carrying its refusal rate and its value before negatives were floored -- which at the spread-to-volatility ratio of a liquid stock is below zero, so the reported spread is the flooring and not an estimate |
| slippage | the optimal schedule when liquidity switches regime, and what reacting to it is worth against the best schedule fixed in advance |
| slippage | the size at which execution consumes the alpha, where holding the participation rate fixed rather than the horizon turns the temporary impact from a limit on the size into a floor on the alpha required, and where the interval length rather than the interval count is what bounds the discretisation, since a patient rate is a long horizon and the discrete problem stops existing once an interval is long enough for the permanent impact to outweigh the temporary |
| slippage | tracking error against a volume-weighted benchmark, which moves with the market, and the floor volume uncertainty sets underneath it |
| slippage | what a schedule built on the wrong parameters costs, where the forecast is wrong to first order and the trades only to second, so a 10% error in the impact coefficient misprices the trade by 3.4% and misplaces it by 0.04% |
| slippage | where to put one order across venues whose available liquidity is random, exactly and on the lot lattice, where a posted lot is worth the probability that it is both reached and needed -- so the venues are ranked by their liquidity at the margin rather than by their average, and the two orderings disagree |
| slippage | whether to rest a limit order or cross the spread, and why the placement distance turns out not to be a choice -- with the fill probability exactly twice the chance of merely ending below the limit when the mid has no drift, and 5.4 times it at one standard deviation of adverse drift, which is the whole of what being picked off costs |
| tenor | Bermudan swaptions by backward induction on a curve-fitted tree, with the switch value over the best single date the extra rights actually buy |
| tenor | Hull-White's one factor, with Jamshidian's decomposition for swaptions and the measured fact that one quote cannot separate mean reversion from volatility |
| tenor | a credit default swap that has already started, which is every contract in a book: periods dropped by payment date rather than by accrual end, the accrual-on-default weight kept at the period's own start, and the upfront settlement split into principal and accrued -- with the forward price of a risky bond divided by the survival probability to settlement as well as by the discount factor, since a forward is for an instrument you only own if it has not defaulted first |
| tenor | a parametric forward curve fitted to more bond quotes than it has parameters, reported with the band of decay parameters that reprice those quotes equally well -- a factor of 104 wide at ten basis points, across which the slope coefficient moves by thousands while the curve does not |
| tenor | a projection curve solved against a discount curve, tenor basis swaps, and how little the discount curve moves a par swap rate |
| tenor | a two-factor Gaussian model, the decorrelation one factor cannot produce, and the measured fact that a cap carries no information about it |
| tenor | asset swap spreads in the par-par and proceeds conventions, which differ by exactly par over the dirty price, together with the residual the textbook formula's cancellation leaves whenever the floating leg's rolled dates and the bond's part company |
| tenor | caplet volatilities bootstrapped out of flat cap quotes, and the strike below which a quote identifies no volatility at all because the premium and the intrinsic value are the same double |
| tenor | compounded overnight legs and the four conventions on the observation window, where a five-day lookback is worth nothing on a smoothly interpolated curve and nearly four basis points across a policy step |
| tenor | constant maturity swaps by static replication, and the measured sign change the payment date produces in the convexity adjustment |
| tenor | covered interest parity between two currencies and the basis left over, where the two-day settlement lag nobody prices is nearly five per cent of a three-month forward's points |
| tenor | deliverable bond futures: conversion factors, the basis and the cheapest bond to deliver |
| tenor | floating rate notes and discount margins |
| tenor | index-linked bonds, real duration and breakeven inflation |
| tenor | survival curves bootstrapped from par credit default swap spreads, risky bond pricing and the credit triangle's measured error |
| tenor | swaptions on the annuity measure, caps and floors as strips, and the hundredfold gap between what the discount curve is worth to an option and to the rate underneath it |
| tenor | the futures-forward convexity adjustment under a mean-reverting short rate, for term, compounded and averaged settlement, where the textbook approximation's error changes sign between the front of a strip and the back of it |
Importing the library is the answer for any of them today, which is what the rest of this page is about.
When to use the server instead
The server earns its place when a language model is the caller. It adds argument validation with messages addressed at a caller that can retry, handles so state survives a stateless protocol, refusals that distinguish a fixable mistake from a broken request, and a tool surface with a budget on its size. In a Python process every one of those is overhead: you have exceptions, variables and a type checker already.
When to use the libraries instead
Any time the calling code is yours. They have no dependency on this server,
no dependency on each other, and between them no dependency beyond NumPy —
moneyness, shortfall and tenor have none
at all. Each ships type information, a command line, and its own test suite
against published reference figures.