Skip to main content

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 company
  • mid_price: The calculated mid-price between bid and ask (available after calling calculate_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


Download files

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

Source Distribution

claims_market-0.1.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

claims_market-0.1.1-py3-none-any.whl (2.5 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