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())
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.
- 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
Metadata
Release files for predictit-markets 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| predictit_markets-0.1.5.tar.gz | 4.6 kB | Without provenance | Details for predictit_markets-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| predictit_markets-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for predictit_markets-0.1.5-py3-none-any.whl |
Total release size: 10.1 kB
Release files / predictit_markets-0.1.5.tar.gz
| Download URL | predictit_markets-0.1.5.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69d839107088b7f0ad2aa6b37281017913889b773a45b10f5fd794d746b05bce
|
|
BLAKE2b-256 checksum How to use checksums |
50255187d917c2256eaaf0a750ecfd35420022b448bdb539ee46998e06a68149
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.9
|
Release files / predictit_markets-0.1.5-py3-none-any.whl
| Download URL | predictit_markets-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c397278e11f450509e99c6e561722759f66cbd921884fd91ef75a26c793993c4
|
|
BLAKE2b-256 checksum How to use checksums |
dbf402d9dc0d0fb93cfe85a7b90e28d2a90128fe1e48d8fbb909b808e396019a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.9
|
Security for predictit-markets 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.