Skip to content

Commit

Permalink
Fix Metaculus get_questions api (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
evangriffiths authored Jul 9, 2024
1 parent 82505cb commit 1d242ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 5 additions & 7 deletions prediction_market_agent_tooling/markets/metaculus/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
from prediction_market_agent_tooling.gtypes import Probability
from prediction_market_agent_tooling.markets.metaculus.data_models import (
MetaculusQuestion,
MetaculusQuestions,
)
from prediction_market_agent_tooling.tools.utils import (
response_list_to_model,
response_to_model,
)
from prediction_market_agent_tooling.tools.utils import response_to_model

METACULUS_API_BASE_URL = "https://www.metaculus.com/api2"

Expand Down Expand Up @@ -91,7 +89,7 @@ def get_questions(
url_params["status"] = status

url = f"{METACULUS_API_BASE_URL}/questions/"
return response_list_to_model(
return response_to_model(
response=requests.get(url, headers=get_auth_headers(), params=url_params),
model=MetaculusQuestion,
)
model=MetaculusQuestions,
).results
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,9 @@ class MetaculusQuestion(BaseModel):
community_prediction: CommunityPredictionStats
my_predictions: UserPredictions | None = None
# TODO add the rest of the fields https://github.com/gnosis/prediction-market-agent-tooling/issues/301


class MetaculusQuestions(BaseModel):
next: str | None
previous: str | None
results: list[MetaculusQuestion]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prediction-market-agent-tooling"
version = "0.41.0"
version = "0.41.1"
description = "Tools to benchmark, deploy and monitor prediction market agents."
authors = ["Gnosis"]
readme = "README.md"
Expand Down

0 comments on commit 1d242ca

Please sign in to comment.