API Reference
These docs are for v2.0. Click to read the latest docs for v2.0.1.

Post Stop Order

The method postOrder is a wrapper around the createSignedOrder and placeSignedOrder methods, simplifying the order placement to the off-chain orderbook down to one method call for the client. (Recommended

The method takes as input the following params:

PostOrderRequest: An interface with the following fields:

  interface PostOrderRequest {
    symbol: MarketSymbol; // market for which to create order
    price: number; // price at which to place order. Will be zero for a market order
    quantity: number; // quantity/size of order
    side: ORDER_SIDE; // BUY/SELL
    orderType: ORDER_TYPE; // MARKET/LIMIT/STOP_LIMIT/STOP_MARKET
    triggerPrice?: number; //added for stop orders, price at which user wants their order to be triggered and added to orderbook
    leverage?: number; // leverage must be an integer value and match the user set market leverage
    reduceOnly?: boolean; // order should only reduce a position, default False
    salt?: number; // random number for uniqueness of order. Generated randomly if not provided
    expiration?: number; // time at which order will expire. Will be set to 1 month if not provided
    timeInForce?: TIME_IN_FORCE; // GTC/FOK/IOC by default all orders are GTC
    postOnly?: boolean; // true/false, default is true
    clientId?: string; // an optional field set by the user
    maker: string; // defaults to address of the account placing order, optionally specify parent account if trading as a sub account
  }

All number inputs are expected in base format and will be converted to big number strings internally by the library.

Returns
The PlaceOrderResponse interface with the following fields:

  interface PlaceOrderResponse {
    id: number; // a unique incremental id assigned to each order by orderbook
    clientId: string; // information about the client browser
    requestTime: number; // timestamp at which order request was made
    cancelReason: CANCEL_REASON; // if the order was cancelled, what the reason was
    orderStatus: ORDER_STATUS; // status of placed order
    hash: string; // unique hash of the order
    symbol: MarketSymbol; // market on which order is placed
    orderType: ORDER_TYPE; // MARKET/LIMIT/STOP_LIMIT/STOP_MARKET
    timeInForce: TIME_IN_FORCE; // GTC/FOK/etc..
    userAddress: string; // address of user (lower-cased)
    side: ORDER_SIDE; // BUY/SELL
    price: string; // price of the order. This is big number string in base x 10^18 format
    triggerPrice: string; //trigger price of `stop order`. This is big number string in base x 10^18 format
    quantity: string; // quantity of the order. This is big number string in base x 10^18 format
    leverage: string; // leverage of the order. This is big number string in base x 10^18 format
    reduceOnly: boolean; // if the order was reduce only
    expiration: number; // timestamp at which order will get expired
    salt: number; // a random number 
    orderSignature: string; // signature of the order
    filledQty: string; // if the order was partially or fully filled, its filled quantity
    avgFillPrice: string; // the average price at which order was filled
    makerFee: string; // the amount of fee paid by the user as marker on this order
    takerFee: string; // the amount of fee paid by the user as taker on this order 
    createdAt: number; // timestamp at which order was stored in db
    updatedAt: number; // timestamp at which order was last updated in db
  }