Logo

Orderbook Endpoints

placeOrder

Places an order on an event.

Method: update isSigned: true


Parameters

NameTypeDescriptionOptional
marketIdNatThe id of the market you wish to get the order book forNo
orderDataPlaceOrder: public type PlaceOrder = { side : OrderSide; odds : Nat; // in E8S so 200_000_000 = 2.0 decimal odds contracts : Nat; // in E8S so 100_000_000 = 1 contract }; public type OrderSide = { #buy; #sell; };The object containing order data you wish to validateNo
blockHeightNatThe blockHeight response from the transfer of funds to the canister completed prior to placing the orderNo

Response

Returns: ?T.ImmutableOrder

  where ImmutableOrder is defined as:

  public type ImmutableOrder = {
    id : OrderID;
    eventId : EventID;
    user : Principal;
    createdAt : Time.Time;
    marketId : MarketID;
    side : OrderSide;
    premium : Premium;
    initialContracts : Nat; // in E8S so 100_000_000 = 1 contract
    currentContracts : Nat; // in E8S so 100_000_000 = 1 contract
    status : OrderStatus;
  };
  public type OrderID = Text;
    public type EventID = Nat;
    public type MarketID = Nat;
      public type OrderSide = {
    #buy;
    #sell;
  };
  public type Premium = Nat;
  public type OrderStatus = {
    #open;
    #cancelled;
    #filled;
  };
Previous
commitOrder