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.
Metadata
Release files for axor-api 0.1.0
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 | |
|---|---|---|---|---|
| axor_api-0.1.0.tar.gz | 10.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| axor_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / axor_api-0.1.0.tar.gz
| Download URL | axor_api-0.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01ccd5bb08654185054b6871d8758a94d0631321423cca8c20d7226b55ae6896
|
|
BLAKE2b-256 checksum How to use checksums |
d7c982d77632966aaff0cc1c92d449470054988349d61941e069012590c56035
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 12, 2025.
Transparency logRelease files / axor_api-0.1.0-py3-none-any.whl
| Download URL | axor_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25191fc1aae86faabde20f6381924b7df99705035aac949918edee4cfd2a4d4f
|
|
BLAKE2b-256 checksum How to use checksums |
da4eaf177a87e21beb3cd6b72fb1cee6aef9945f20960a100309f1a38f033452
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 12, 2025.
Transparency logSecurity for axor-api 0.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for axor_api-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 12, 2025.
Transparency logA 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.