Forkast Developer Docs
...
Services
Order
10 min
this section documents the core interfaces used when working with placing, querying, or processing orders in forkastsdk functions get all orders import { orderresponse } from '@forkastgg/client/dist/src/types/orders'; async getallorders( address string, outcomeid number, accesstoken string, status? number, limit? number, page? number ) promise\<orderresponse\[]> parameters field type required description address string yes wallet address outcomeid number yes outcome id accesstoken string yes access token received from login response status number no filter orders by status (optional) limit number no number of results per page (optional) page number no page number for pagination (optional) place an order import { orderresponse } from '@forkastgg/client/dist/src/types/orders'; async placesingleorder( marketid, token, account, price, amount, side, accesstoken ); promise\<orderresponse> parameters field type required description marketid number yes market id token string yes address of the token account string yes wallet address price number yes price at which to place the order ( 0 < price < 1 ) amount number yes number of shares ( amount > 1) side number yes the side of the order ( 0 = buy, 1 = sell) accesstoken string yes access token received from login response cancel an order cancelorder( orderid, accesstoken ) field type required description orderid number yes id of the order accesstoken string yes access token received from login response types order used to place a new order (buy/sell) on the market interface order { marketid number; outcomeid number; tokenid string; side number; // 0 for buy, 1 for sell type number; // 1 for limit, 2 for market outcometype number; // 1 for yes, 0 for no price number; amount number; total number; maxmatchedtimes number; expiredat number; } key fields field type description marketid number unique id of the market outcomeid number title of the event tokenid string token address (represents outcome share) side number 0 = buy 1 = sell type number 1 = limit order 2 = market order outcometype number 1 = yes outcome 0 = no outcome price number price per unit of outcome token amount number number of shares to buy/sell total number total value (price amount) maxmatcheditems number max times this order is matched expiredat number order expiry timestamp in unix format order info represents a specific tradable question within an event interface orderinfo { signer address string; maker address string; market id number; amount number; price number; outcome id number; token id string; outcome type number; side number; type number; } key fields field type description signer address string wallet that signed the order maker address string address that placed the order order book represents live buy/sell offers for a specific outcome in a market export interface orderbook { asks array<{ price number; size number }>; bids array<{ price number; size number }>; } // example / { "asks" \[{ "price" 0 75, "size" 100 }], "bids" \[{ "price" 0 68, "size" 80 }] } / key fields field description asks sell offers with price and available shares bids buy offers with price and available shares