getPriceHistory

Returns the weighted average price in a specific time range per time frame for each outcome in a market.

Example

const priceHistoryWeekly = await flux.getPriceHistory(0, "2020-07-10", "2020-07-17", ["day"]);
const allPriceHistory = await flux.getPriceHistory(0, "2020-01-10", "2020-07-17", ["day", "month"]);

Parameters

Parameter

Type

Description

Required

marketId

number

The id of the market in question

True

startDate

number

UNIX timestamp (seconds)

True

endDate

number

UNIX timestamp (seconds)

True

dateMetrics

Array<string>

By what date metrics should the history be grouped

"year" | "month" | "hour" | "day"

True

Returns

Name

Type

Description

priceHistory

Array<Object>

Promise that will resolve to an array of objects containing info on the weighted average price of a specific outcome at a certain date. date_type_{i} refers to the dateMetrics you provide the method.

E.g. flux.getPriceHistory(0, "2020-07-10", "2020-07-15", ["hour", "day"])

return: [ { "date_type_0":22, // "hour" "date_type_1":15, // "day" "outcome":"0", "avg_price":"93.0000000000000000" } ]