A library to fetch and process data from the Claims Market API
Project description
Claims Market Library
The Claims Market Library is a Python package designed to fetch, process, and analyze data from the Claims Market API. It provides easy-to-use functions for retrieving and manipulating claims market data for various companies, including Alameda Research LLC, BlockFi Inc., Celsius Network LLC, FTX Trading Ltd., and Genesis Global Capital, LLC.
Features
- Fetch up-to-date claims market data from the API
- Automatic data type conversion (dates to datetime, bid/ask to float)
- Retrieve data for specific companies
- Filter data by date range
- Calculate mid-prices
- Get latest prices for all companies
Installation
You can install the Claims Market Library using pip:
pip install claims_market
Usage
Here's a quick start guide to using the Claims Market Library:
from claims_market import ClaimsMarket
from datetime import datetime
# Create an instance of ClaimsMarket
cm = ClaimsMarket()
# Fetch all data
all_data = cm.fetch_data()
# Get data for specific companies
ftx_data = cm.get_ftx_data()
alameda_data = cm.get_alameda_data()
# Get data within a date range
start_date = datetime(2023, 1, 1)
end_date = datetime(2023, 6, 30)
date_range_data = cm.get_data_in_date_range(start_date, end_date)
# Calculate mid prices
data_with_mid_prices = cm.calculate_mid_price()
# Get latest prices
latest_prices = cm.get_latest_prices()
# Print the first few rows of the FTX data
print(ftx_data.head())
Data Structure
The library returns data in pandas DataFrame format with the following columns:
date
: The date of the pricing data (datetime)bid
: The bid price (float)ask
: The ask price (float)name
: The name of the companymid_price
: The calculated mid-price between bid and ask (available after callingcalculate_mid_price()
)
Advanced Usage
Customizing Data Retrieval
You can easily retrieve data for any company in the dataset:
custom_company_data = cm.get_company_data("Your Company Name")
Data Analysis
The library returns pandas DataFrames, allowing you to perform further analysis using pandas functions:
import matplotlib.pyplot as plt
# Plot FTX bid prices over time
ftx_data = cm.get_ftx_data()
plt.figure(figsize=(12, 6))
plt.plot(ftx_data['date'], ftx_data['bid'])
plt.title('FTX Bid Prices Over Time')
plt.xlabel('Date')
plt.ylabel('Bid Price')
plt.show()
License
This project is licensed under a Custom Attribution License. It is free to use, but if used in research papers or publications, appropriate credit must be given.
Citation
If you use this library in your research or publication, please cite it as follows:
Patrick Ashrafi. 2024. Claims Market Library.
For example:
Smith, J. (2023). Claims Market Library. v0.1.0. https://github.com/patzen123/claims_market
Contributing
Contributions to the Claims Market Library are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any problems or have any questions, please open an issue on the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file claims_market-0.1.1.tar.gz
.
File metadata
- Download URL: claims_market-0.1.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 281f18c227eba72484c7a4fd4755696c0bbfa348d03a144ce4ae6ec98d13ae81 |
|
MD5 | 03c662938d001c6d0d28d512df6b7a0e |
|
BLAKE2b-256 | fea4959b45d386f42724ca44ea893f003cf492db4668fdf9207ccd84b213342e |
File details
Details for the file claims_market-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: claims_market-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094e3b8ac86edfec4fbc118bf0d9e68ad224e237bb3b77646538cde85ebbcaba |
|
MD5 | 90dc5a5972664c66dd82b27d405bccfb |
|
BLAKE2b-256 | a752790c873e144eba540ecd9f2917bfb87b4235a783dcc8b29db61a50f0d9ba |