quantified-uncertainty / metaforecast

Fetch forecasts from prediction markets/forecasting platforms to make them searchable. Integrate these forecasts into other services.
https://metaforecast.org/
MIT License
56 stars 5 forks source link

Add history to the graphql API #64

Closed NunoSempere closed 2 years ago

NunoSempere commented 2 years ago

Right now, history isn't yet added to the graphql API. But it seems like a natural next step.

berekuk commented 2 years ago

Done: https://metaforecast.org/api/graphql?query=fragment+Question+on+Question+%7B%0A++id%0A++url%0A++title%0A++description%0A++timestamp%0A++options+%7B%0A++++name%0A++++probability%0A++%7D%0A++platform+%7B%0A++++id%0A++++label%0A++%7D%0A++qualityIndicators+%7B%0A++++stars%0A++++numForecasts%0A++%7D%0A++visualization%0A++history+%7B%0A++++timestamp%0A++++options+%7B%0A++++++name%0A++++++probability%0A++++%7D%0A++%7D%0A%7D%0A%0Aquery+Frontpage+%7B%0A++result%3A+frontpage+%7B%0A++++...Question%0A++%7D%0A%7D

I'm not sure if this is the best approach in terms of API design & implementation, but it's the easiest one for now. Probably going to be too slow if we'll want to serve history graphs for a page full of different questions, but good enough for a single question's page. I haven't tried to benchmark it yet.

Other notes:

NunoSempere commented 2 years ago

Beautiful!