Skip to content
markpaper

src/orders/index.ts

v0.3.0 · 2.6 KB

Download file
// Public API of the orders module: intent -> quantized wire order, batch placement with fail-closed
// per-order results, reconciliation by cloid, reduceOnly closes, cancels, dead man's switch, TWAP
// (experimental) and the pre-trade agent check. The caller passes its own SDK ExchangeClient.

export { HlOrderError, type HlOrderErrorCode } from './errors.js';

export {
  CLOID_HEX_LENGTH,
  MAX_CLOID_PREFIX_LENGTH,
  cloidHasPrefix,
  createCloid,
  isCloid,
  normalizeCloid,
  type Cloid,
  type CreateCloidOptions,
} from './cloid.js';

export type {
  AssetResolver,
  CancelExchange,
  ExchangeCallOptions,
  OrderActionParams,
  OrderExchange,
  ScheduleCancelExchange,
  Tif,
  TwapExchange,
  WireBuilder,
  WireOrder,
  WireOrderType,
} from './types.js';

export { ALL_MIDS_WEIGHT, fetchMid, type OrdersInfoOptions } from './mids.js';

export {
  RECOMMENDED_MIN_IOC_SLIPPAGE,
  buildOrder,
  type BuildOrderOptions,
  type BuildOrderResult,
  type BuildSkipReason,
  type BuildWarning,
  type LimitPriceRounding,
  type MarketPricing,
  type OrderIntentInput,
  type PlaceableOrder,
  type SkippedOrder,
  type TriggerSpec,
} from './build.js';

export {
  MAX_BUILDER_FEE,
  MAX_PERP_BUILDER_FEE,
  mayBeLive,
  placeOrders,
  type BatchOutcome,
  type BatchReport,
  type NotSentReason,
  type OrderOutcome,
  type PlacedOrder,
  type PlaceOrdersOptions,
  type PlaceOrdersResult,
} from './place.js';

export {
  ORDER_STATUS_WEIGHT,
  fetchOrderStatus,
  parseOrderStatusAnswer,
  reconcileByCloid,
  reconcilePlacement,
  type CloidReconciliation,
  type OrderStatusCategory,
  type OrderStatusLookup,
  type ReconcileOptions,
} from './status.js';

export {
  CLEARINGHOUSE_STATE_WEIGHT,
  DEFAULT_CLOSE_SLIPPAGE,
  ESTIMATED_CLOSE_SIZE_FACTOR,
  closePosition,
  fetchPosition,
  marketClose,
  type ClosePositionInput,
  type CloseResult,
  type CloseStatus,
  type MarketCloseInput,
  type MarketCloseOptions,
  type PositionSnapshot,
} from './close.js';

export {
  MIN_SCHEDULE_CANCEL_LEAD_MS,
  cancelOrders,
  clearScheduledCancel,
  scheduleCancel,
  type CancelItem,
  type CancelOrdersOptions,
  type CancelOrdersResult,
  type CancelOutcome,
  type CancelTarget,
  type ScheduleCancelOptions,
  type ScheduleCancelResult,
} from './cancel.js';

export {
  MAX_TWAP_MINUTES,
  MIN_TWAP_MINUTES,
  assertTwapMinutes,
  cancelTwap,
  placeTwap,
  type TwapCallOptions,
  type TwapCancelResult,
  type TwapIntent,
  type TwapPlaceResult,
} from './twap.js';

export {
  EXTRA_AGENTS_WEIGHT,
  assertAgentActive,
  checkAgent,
  type AgentCheck,
  type AgentCheckOptions,
  type AgentStatus,
  type AssertAgentOptions,
} from './agent.js';
All files