This module lets you get question and prediction information from PredictIt via the API (https://predictit.freshdesk.com/support/solutions/articles/12000001878)
The main class for interacting with PredictIt.
Return the PredictIt market with the given id. A market’s id can be found in the url of the market.
Generate all of the markets currently in PredictIt.
Refetch all of the markets from the PredictIt API.
A PredictIt market.
api_url (str) – url of the PredictIt API for the given question
name (str) – name of the market
shortName (str) – shortened name of the market
image (str) – url of the image resource of the market
url (str) – url of the market in PredictIt
status (str) – status of the market. Closed markets aren’t included in the API, so always “Open”
timeStamp (datetime.datetime) – last time the market was updated. The API updates every minute, but timestamp can be earlier if it hasn’t been traded in
Return the specified question given by the id number.
Generate all of the questions in the market.
Refetch the market data from PredictIt, used when the question data might have changed.
A single binary question in a PredictIt market.
market (PredictItMarket) – PredictIt market instance
dateEnd (datetime.datetime) – end-date of a market, usually None
image (str) – url of the image resource for the contract
name (str) – name of the contract
shortName (str) – shortened name of the contract
status (str) – status of the contract. Closed markets aren’t included in the API, so always “Open”
lastTradePrice (float) – last price the contract was traded at
bestBuyYesCost (float) – cost to buy a single Yes share
bestBuyNoCost (float) – cost to buy a single No share
bestSellYesCost (float) – cost to sell a single Yes share
bestSellNoCost (float) – cost to sell a single No share
lastClosePrice (float) – price the contract closed at the previous day
displayOrder (int) – position of the contract in PredictIt. Defaults to 0 if sorted by lastTradePrice
Refetch the market data from PredictIt and reload the question.
Sample from the PredictIt community distribution (Bernoulli).
- Return type