Forkast Developer Docs
...
Services
Market
10 min
functions get event returns an event object with all necessary details // get event data const eventdata = await marketservice geteventdata(slug); // returns event object containing event details and associated markets get specific market each event will have one or more than one markets you could access a specific market and the outcome id to access order book // we can access specific index from the array const market = eventdata markets\[index]; const outcomeid = market outcomes\[index] id; const outcometype = market outcomes\[index] outcometype; get order book each orderbook is associated with outcome id and type response give all the orders placed with price and amount of shares on both buy and sell side const orderbook = await marketservice getorderbook(market id, outcomeid, outcometype); // returns an orderbook object // example response / { 	"asks" \[ 	 { 	 "price" "0 62", 	 "size" "9" 	 } 	], 	"bids" \[ 	 { 	 "price" "0 62", 	 "size" "9" 	 }	 	] } / get token prices for specific market, you can get current prices of erc 1155 tokens const tokenprices = await marketservice gettokenprices(market id); // example response / \[ 	{ 	 "outcomeid" 797, 	 "price" 0 2, 	 "side" "sell" 	}, 	{ 	 "outcomeid" 798, 	 "price" 0 8, 	 "side" "buy" 	} ] / types event represents a prediction event that may contain one or more markets export interface event { id number; createdat date; title string; description string; status string; startdate date; enddate date; image string; resolutionsource string; volume string; resolvedon date | null; showinfopopup string; infopopuptitle string | null; infopopupsubtitle string | null; isfavorite number; markets market\[]; } key fields field type description id number unique id of the event title string title of the event status string current event status volume string total trading volume ($) markets market\[] array of associated markets market represents a specific tradeable question within an event export interface market { id number; title string; question string; questionid string; image string; rules string; volume string; status marketstatus; resolvedaddress string | null; resolvedoutcome string | null; resolvedoutcomeid string | null; resolvedon string | null; openordernumber number; positions marketposition\[]; conditionid string; outcomes marketoutcome\[]; } key fields field type description id number unique id of the market question string market's question status market status enum indicating the status of the current market volume string total trading volume ($) outcomes marketoutcome\[] available outcomes to bet on positions marketposition\[] positions associated with this market imports these types can be imported from the forkast sdk import { marketoutcome, marketposition, marketstatus } from "@forkastgg/client";