src/numbers/index.ts
v0.2.1 · 1,011 B
// Size/price grids, integer wire encoding, the two order minimums and the two margin-fraction scales.
// Pure functions; nothing here touches the network.
export { LighterNumbersError } from './errors.js';
export {
clampLeverage,
imfFromAccountFraction,
imfFromMarketFraction,
leverageFromAccountFraction,
MARGIN_FRACTION_SCALES,
type MarginIdentity,
type MarginIdentityInput,
marginIdentity,
marketFractionForLeverage,
maxLeverageFromImf,
} from './margin.js';
export {
type MinimumKind,
type MinimumsCheck,
type MinimumsInput,
meetsMinimums,
meetsMinimumsExact,
type WireMinimumsInput,
} from './minimums.js';
export {
assertDecimals,
decimalsOf,
formatSize,
fromWire,
isOnPriceGrid,
isOnSizeGrid,
MAX_DECIMALS,
type PriceRounding,
priceFromWire,
priceTick,
priceToWire,
quantizePrice,
quantizeSize,
type SizeRounding,
scaledIntegerFromString,
scaledIntegerToString,
sizeFromWire,
sizeLot,
sizeToWire,
toWire,
} from './quantize.js';