Python client library for the Deep MM AXOR API - Real-time and historical corporate bond pricing
Project description
Deep MM Python Client
Python client library for the Deep MM API - Real-time and historical corporate bond pricing.
Installation
pip install axor-api
Quick Start
import asyncio
import json
from axor import connect, create_get_id_token
async def main():
# Authenticate with AWS Cognito
get_id_token = create_get_id_token(
region="us-east-1",
client_id="2so174j2e4fsg1m28kc9id3hgk", # Test client ID
username="your-username",
password="your-password"
)
# Connect to the Deep MM API
ws = await connect()
# Send authentication token
await ws.send(json.dumps({'token': get_id_token()}))
# Subscribe to real-time pricing
subscription = {
'inference': [{
'rfq_label': 'spread',
'figi': 'BBG003LZRTD5',
'quantity': 1_000_000,
'side': 'bid',
'subscribe': True,
}]
}
await ws.send(json.dumps(subscription))
# Receive updates
while True:
response = await ws.recv()
print(response)
asyncio.run(main())
Features
- Authentication: AWS Cognito integration with automatic token refresh
- Real-time Subscriptions: WebSocket-based live pricing updates
- Historical Data: Query historical pricing distributions
- CUSIP/FIGI Mapping: Convert CUSIPs to FIGIs using OpenFIGI API
- Distribution Fitting: Fit normal and Johnson SU distributions to percentile data
API Reference
Authentication
from axor import create_get_id_token
get_id_token = create_get_id_token(
region="us-east-1",
client_id="your-client-id",
username="your-username",
password="your-password"
)
# Token is automatically refreshed as needed
token = get_id_token()
Connection
from axor import connect
# Use default server (wss://api.deepmm.com)
ws = await connect()
# Or specify custom server
ws = await connect("wss://custom-server.com")
CUSIP to FIGI Mapping
from axor import openfigi_map_cusips_to_figis
cusip_to_figi, figi_to_cusip = openfigi_map_cusips_to_figis(
api_key="your-openfigi-api-key",
cusip_list=["594918BJ2", "037833100"]
)
# Use the mappings
figi = cusip_to_figi["594918BJ2"]
Distribution Fitting
from axor import fit_normal_distribution, fit_johnson_su
# Fit normal distribution to percentile data
percentiles = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95]
values = [...] # Your percentile values from API response
mu, sigma, error = fit_normal_distribution(percentiles, values)
print(f"Mean: {mu}, Std Dev: {sigma}")
# Fit Johnson SU distribution (better for skewed/heavy-tailed data)
gamma, delta, loc, scale, error = fit_johnson_su(percentiles, values)
# Generate plots (requires matplotlib)
from axor import plot_cdf_of_fitted_johnson_su_distribution
plot_cdf_of_fitted_johnson_su_distribution(
'output.png',
percentiles,
values,
gamma, delta, loc, scale
)
Examples
Complete working examples are available in the examples/ directory:
- subscribe_simple.py - Basic subscription to real-time pricing
- subscribe.py - Advanced subscription with multiple variations
- timestamp_simple.py - Historical pricing queries
- timestamp_normal.py - Historical data with normal distribution fitting
- timestamp_johnson_su.py - Historical data with Johnson SU fitting
Installation for Development
# Clone the repository
git clone https://github.com/deepmarketmaking/api.git
cd api/python
# Install in editable mode with dev dependencies
pip install -e ".[dev,visualization]"
# Run tests
pytest
Requirements
- Python 3.8 or higher
- Dependencies:
boto3- AWS Cognito authenticationwebsockets- WebSocket communicationhttpx- HTTP requests for OpenFIGI APInumpy,scipy- Distribution fittingpyarrow- Efficient data handlingtenacity- Retry logicmatplotlib(optional) - For visualization
Documentation
Full API documentation and additional examples are available at:
Support
For questions, issues, or feature requests:
- GitHub Issues
- Email: support@deepmm.com
License
Apache License 2.0 - See LICENSE for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file axor_api-0.1.0.tar.gz.
File metadata
- Download URL: axor_api-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01ccd5bb08654185054b6871d8758a94d0631321423cca8c20d7226b55ae6896
|
|
| MD5 |
721ff403948039380da21aaa1883ad82
|
|
| BLAKE2b-256 |
d7c982d77632966aaff0cc1c92d449470054988349d61941e069012590c56035
|
Provenance
The following attestation bundles were made for axor_api-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on deepmarketmaking/api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axor_api-0.1.0.tar.gz -
Subject digest:
01ccd5bb08654185054b6871d8758a94d0631321423cca8c20d7226b55ae6896 - Sigstore transparency entry: 761731672
- Sigstore integration time:
-
Permalink:
deepmarketmaking/api@7f6c5218438d9fe658b49505600cffafcf2c9ba3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepmarketmaking
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@7f6c5218438d9fe658b49505600cffafcf2c9ba3 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file axor_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: axor_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25191fc1aae86faabde20f6381924b7df99705035aac949918edee4cfd2a4d4f
|
|
| MD5 |
5280d6aac6ad896e1bc180e3c136069c
|
|
| BLAKE2b-256 |
da4eaf177a87e21beb3cd6b72fb1cee6aef9945f20960a100309f1a38f033452
|
Provenance
The following attestation bundles were made for axor_api-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on deepmarketmaking/api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axor_api-0.1.0-py3-none-any.whl -
Subject digest:
25191fc1aae86faabde20f6381924b7df99705035aac949918edee4cfd2a4d4f - Sigstore transparency entry: 761731688
- Sigstore integration time:
-
Permalink:
deepmarketmaking/api@7f6c5218438d9fe658b49505600cffafcf2c9ba3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepmarketmaking
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@7f6c5218438d9fe658b49505600cffafcf2c9ba3 -
Trigger Event:
workflow_dispatch
-
Statement type: