Documentation
API Reference
Types
Trading

Type: Trading

MarketPair

This type represents a market pair.

type MarketPair = {
  pairSymbol: string;
  base: string;
  quote: string;
  type: string;
  taker: number;
  maker: number;
  active: boolean;
  precision: {
    amount: number;
    price: number;
  };
};
  • pairSymbol - string
    The pair symbol in the format of base/quote. For example, BTC/USDC.
  • base - string
    The base currency, for example, BTC.
  • quote - string
    The quote currency, for example, USDC.
  • type - string
    The market type, for example, spot.
  • taker - number
    The taker fee.
  • maker - number
    The maker fee.
  • active - boolean
    Is the pair active (trading is allowed).
  • precision - { amount: number, price: number }
    The precision object with amount and price precision.

Order

This type represents an order.

type Order = {
  id: string;
  timestamp: number;
  status: "open" | "closed" | "canceled";
  pairSymbol: string;
  type: "limit" | "market";
  side: "buy" | "sell";
  price: number;
  amount: number;
  filled: number;
  fee: Fee;
};
  • id - string
    The order ID returned by the exchange.
  • timestamp - number
    The order timestamp.
  • status - "open" | "closed" | "canceled"
    The order status.
  • pairSymbol - string
    The pair symbol in the format of base/quote. For example, BTC/USDC.
  • type - "limit" | "market"
    The order type, limit or market.
  • side - "buy" | "sell"
    The order side.
  • price - number
    The price in quote currency.
  • amount - number
    The amount in base currency.
  • filled - number
    The filled amount. When the order is filled, this value is equal to the amount.
  • fee - Fee
    The fee object, see Fee for details.

Create Order Params

This type represents create order params.

type CreateOrderParams = {
  exchangeInstanceId: string;
  pairSymbol: string;
  orderType: "limit" | "market";
  orderSide: "buy" | "sell";
  price: string;
  amount: string;
};
  • exchangeInstanceId - string
    The exchange instance ID to create the order on.
  • auth - The authentication object for the exchange. See authentication section for details.
  • pairSymbol - string
    The pair symbol in the format of base/quote. For example, BTC/USDC.
  • orderType - "limit" | "market"
    The order type, limit or market.
  • orderSide - "buy" | "sell"
    The order side.
  • price - string
    The price in quote currency. For market orders, you still need to provide the price (use getMarketRate method to get the current market rate).
  • amount - string
    The amount in base currency.

Create Order Request

This type represents create order request.

type CreateOrderRequest = {
  pairSymbol: string;
  orderType: "limit" | "market";
  orderSide: "buy" | "sell";
  price: string;
  amount: string;
};
  • pairSymbol - string
    The pair symbol in the format of base/quote. For example, BTC/USDC.
  • orderType - "limit" | "market"
    The order type, limit or market.
  • orderSide - "buy" | "sell"
    The order side.
  • price - string
    The price in quote currency. For market orders, you still need to provide the price (use getMarketRate method to get the current market rate).
  • amount - string
    The amount in base currency. It may include the fee or not, depending on the exchange. Prepare order method will calculate the fee and adjust the amount accordingly.

FuturePosition

This type represents a future position.

type FuturePosition = {
  pairSymbol: string;
  marginToken: string | "unknown";
  marginMode: MarginMode;
  positionSide: "long" | "short";
  notional: string | undefined;
  timestamp: number | undefined;
  unrealizedPnl: string | undefined;
  leverage: string | undefined;
  entryPrice: string | undefined;
  percentage: string | undefined;
  initialMargin: string | undefined;
  initialMarginPercentage: string | undefined;
};
  • pairSymbol - string
    The pair symbol in the format of base/quote.
  • marginTokenSymbol - string | "unknown"
    The margin token symbol. If the token is unknown, it will be set to "unknown".
  • marginMode - MarginMode
    The margin mode, see MarginMode for details.
  • positionSide - "long" | "short"
    The position side.
  • notional - string | undefined
    The notional value of the position, representing the total value of the position in USD.
  • timestamp - number | undefined
    The timestamp of the position.
  • unrealizedPnl - string | undefined
    The unrealized profit and loss.
  • leverage - string | undefined
    The leverage.
  • entryPrice - string | undefined
    The price at which the position was entered.
  • percentage - string | undefined
    Represent the price delta for one point.
  • initialMargin - string | undefined
    The initial margin used to open the position.
  • initialMarginPercentage - string | undefined
    Represent the margin amount delta for one point.

MarginMode

This type represents a margin mode.

export enum MarginMode {
  CROSS = "cross",
  ISOLATED = "isolated",
  UNKNOWN = "unknown",
}