Skip to main content

Python client for Synthera AI API

Project description

Synthera AI SDK

This provides a Python SDK for accessing the Synthera AI API.

Installation

pip install synthera

API Key

You are required to use an API key to access the Synthera AI API.

For ease of use, set as an environment variable: SYNTHERA_API_KEY.

For example:

export SYNTHERA_API_KEY=<api_key>

Or you can pass to the client.

Getting Started

Import the Synthera client:

from synthera import SyntheraClient

Create a client:

client = SyntheraClient()

Check the connection works:

client.healthy()

`True`

For more advanced connection options, pass parameters to the client:

SyntheraClient(api_key: str, host: str, port: int, timeout_secs: int)

Fixed Income

To run fixed income yield curve simulations.

Parameters

Prepare input parameters.

Parameter Type Description Values
no_of_days integer Number of days to simulate forward from the reference date > 0 (e.g., 3, 30, 60, 120)
no_of_samples integer Number of simulation paths to generate > 0 (e.g., 100, 1024, 10000)
reference_date string Reference date for the simulation (in the past) YYYY-MM-DD format
yield_curve_names list[string] List of yield curves to simulate, using their unique identifiers List of curve names (e.g., ["USD_Z0", "EUR_Z0", "GBP_Z0"])
model_label string Version of the model to use Valid model version (V) and universe (U): "YieldGAN-vV-U"
return_conditional boolean Whether to return conditional simulation results Optional; defaults to false

For example:

params = {
    "no_of_days": 60,
    "no_of_samples": 1024,
    "reference_date": "2010-01-01",
    "yield_curve_names": [
        "USD_Z0",
        "EUR_Z0",
    ],
    "model_label": "YieldGAN-v41-z0",
    "return_conditional": False
}

Simulations

Run directly:

results = client.fixed_income.simulation_past_date(params=params)

To view available yield curves:

print(results.names)

To view yield curve dataframe column names:

print(results.column_names)

To view a specific yield curve dataframes, e.g. for USD_Z0:

print(results.dataframes["USD_Z0"])

To view all yield curves in a single numpy ndarray (order is same as names):

print(results.ndarray)

To view request metadata:

print(results.metadata)

Alternatively, import the fixed income class:

from synthera import FixedIncome

Pass the client:

fixed_income = FixedIncome(client)

Then run a simulations:

results = fixed_income.simulation_past_date(params=params)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

synthera-0.2.3a1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file synthera-0.2.3a1-py3-none-any.whl.

File metadata

  • Download URL: synthera-0.2.3a1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for synthera-0.2.3a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d85135126c156f05fa6ba6640e50640e0f75d78c9f790c4e35b8b997e534677b
MD5 604f7b048d3c60aeacf53c45c1691c7a
BLAKE2b-256 5ba770fd6b53f8f7f257a2b006a0e7fc32efcf0ae81a683f5528f51f9179633e

See more details on using hashes here.

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