Skip to main content

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:

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 authentication
    • websockets - WebSocket communication
    • httpx - HTTP requests for OpenFIGI API
    • numpy, scipy - Distribution fitting
    • pyarrow - Efficient data handling
    • tenacity - Retry logic
    • matplotlib (optional) - For visualization

Documentation

Full API documentation and additional examples are available at:

Support

For questions, issues, or feature requests:

License

Apache License 2.0 - See LICENSE for details.

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

axor_api-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axor_api-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

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

Hashes for axor_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 01ccd5bb08654185054b6871d8758a94d0631321423cca8c20d7226b55ae6896
MD5 721ff403948039380da21aaa1883ad82
BLAKE2b-256 d7c982d77632966aaff0cc1c92d449470054988349d61941e069012590c56035

See more details on using hashes here.

Provenance

The following attestation bundles were made for axor_api-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on deepmarketmaking/api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for axor_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25191fc1aae86faabde20f6381924b7df99705035aac949918edee4cfd2a4d4f
MD5 5280d6aac6ad896e1bc180e3c136069c
BLAKE2b-256 da4eaf177a87e21beb3cd6b72fb1cee6aef9945f20960a100309f1a38f033452

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page