Skip to main content

A package for interacting with PredictIt markets

Project description

predictit_markets

pip install predictit-markets

Simple Python package that helps to retrieve predictit market data.

market_data

Given a number, returns a Pandas dataframe of the market data. It attempts to grab the last 90 days, but can be changed to '24h',7, or 30 as well. Constructor defaults to 90, but can take the other dates as an argument. Important to note that the '24h' is a string whereas the other arguements are integers. Can also take an integer for the max number of contracts, so if you only want to see the top 2, ie Democrat and Repblican, versus the entire field.

df = market_data(6598)

print(df.head())

PredictIt Markets Example

market_name

print(market_name(6598))

Returns the name of the market as a string.

Which party will win Washington in the 2020 presidential election?

That's all there is to it. Predictit's API is in XML format, which I thought was a pain, and they have download buttons for every market. I found this and it helped me understand the urls that are used to download the market CSV's so I recreated it for Python. I didn't see anything else like this posted, and I figured it may help someone else down the line. Was considering putting this as a package, but it doesn't seem like it would be worth it.

Is now a python package

  • Thinking of adding the ability to get the data raw, but I think df's are fine for now.
  • Thinking of adding charts, but may just throw a notebook up with examples.
  • Need to put publishing on release branch

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

predictit_markets-0.1.5.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

predictit_markets-0.1.5-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page