src/format/index.ts
v0.3.0 · 1.4 KB
// Price and size rounding and pre-send validation for Hyperliquid orders.
// Pure functions with exact decimal math; the SDK still signs and sends.
export { HlFormatError } from './decimal.js';
export type {
FormatPriceOptions,
MarketKind,
Numeric,
OrderSide,
PriceGridOptions,
PriceRounding,
SizeRounding,
} from './types.js';
export { normalizeDecimal } from './wire.js';
export {
MAX_SZ_DECIMALS,
assertSzDecimals,
formatSize,
hasHiddenRemainder,
isFlatPosition,
isFullyFilled,
isValidSize,
positionMatchesExpected,
sizeFromNotional,
szStep,
} from './size.js';
export {
MAX_PRICE_SIG_FIGS,
formatPrice,
isValidPrice,
priceTick,
pxDecimals,
samePriceOnGrid,
shiftPriceTicks,
} from './price.js';
export {
MIN_ORDER_NOTIONAL_USD,
RECOMMENDED_MIN_QUOTE_NOTIONAL_USD,
bumpToMinNotional,
meetsMinNotional,
notional,
planOrderSize,
quoteSizeFromNotional,
type OrderIntent,
type PlanOrderSizeInput,
type SizePlan,
type SizeSkipReason,
} from './notional.js';
export {
DEFAULT_EXIT_SLIPPAGE_FLOOR,
DEFAULT_FLATTEN_SLIPPAGE_CAP,
escalatingSlippage,
exitSlippage,
marketLimitPrice,
postOnlyPrice,
type EscalatingSlippageOptions,
type MarketLimitPriceInput,
type PostOnlyPriceInput,
} from './slippage.js';
export {
triggerPxMatches,
validateOrder,
type OrderIssue,
type OrderValidation,
type ValidateOrderInput,
} from './validate.js';