Skip to main content

Finatic Server SDK (Python)

Python SDK for embedding Finatic in your backend. Keep the company API key on the server. Mint a 90-second one-time token for the browser Client SDK, or start a session and redirect to Connect.

Install

pip install finatic-server-python

Quick start

import asyncio
import os

from finatic_server_python import FinaticServer


async def main() -> None:
    finatic = FinaticServer(
        api_key=os.environ["FINATIC_API_KEY"],
        sdk_config={"environment": "sandbox"},
    )

    # Client iframe: 90-second token. Never send the API key to the browser.
    one_time_token = await finatic.v1.get_token()

    # Redirect flow: start a session first (get_portal_url requires it).
    session = await finatic.v1.start_session()
    if not session.get("session_id"):
        raise RuntimeError(session.get("error") or "Session start failed")
    portal_url = await finatic.v1.get_portal_url(mode="dark")

    # After account.grant.created, start a session for that portal user, then read.
    portal_user_id = "user-from-connect-onSuccess"
    authed = await finatic.v1.start_session(user_id=portal_user_id)
    if not authed.get("authenticated"):
        raise RuntimeError(authed.get("error") or "Authenticated session start failed")
    accounts = await finatic.v1.list_accounts(include_sync_status=True)
    if accounts.get("errors"):
        raise RuntimeError(accounts["errors"])
    if not accounts.get("data"):
        raise RuntimeError("No granted accounts yet")
    account_id = accounts["data"][0]["accountId"]
    positions = await finatic.v1.list_positions(account_id)


asyncio.run(main())

Server v1 data methods return { "traceId", "data", "warnings", "errors" }. Check errors before using data.

Use sdk_config={"environment": "sandbox"} for Finatic synthetic data (fntc_sandbox_ keys). Broker paper/sim accounts stay live.

FinaticServer.init(...) is a shortcut that calls start_session. Use the constructor + get_token() when you only need to hand a token to the browser.

Embed Connect

Connect UI lives in FinaticConnect. This SDK does not open an iframe.

  1. v1.get_token() → pass the token to @finatic/client FinaticConnect.init(token) in the browser (token TTL is 90 seconds).
  2. Or v1.start_session() then v1.get_portal_url(...) → redirect. Treat the full URL as secret.

Wait for HTTPS webhook account.grant.created (or poll list_accounts on an ACTIVE session) before account-scoped reads.

start_session() reports transport/session-start completion in success and account readiness separately in authenticated. Account reads require authenticated=true, which is returned only for an active session carrying the server-authoritative user_id. The result also exposes status, provided_user_id_rejected, and portal_connection_management_pending for portal-flow handling.

Trading

Fetch the broker schema, then send an idempotent command:

schema = await finatic.v1.get_account_order_schema(account_id, "place")
created = await finatic.v1.create_account_order(
    account_id,
    {"symbol": "AAPL", "quantity": 1, "side": "BUY", "type": "MARKET"},
    idempotency_key="partner-order-123",
)

Python wraps the dict as {"order": ...} on the wire. idempotency_key is required.

Exact instrument identity

Order, fill, event, position, lot, and lot-fill responses expose the generated FDXInstrumentDescriptor contract. future.identityQuality distinguishes an exact contract such as MGCZ6 from a root-only identity such as MGC; optional month, expiry, MIC, and provenance fields remain absent when the API did not prove them.

from finatic_server_python import AccountOrderPayload, FDXInstrumentDescriptor

order = AccountOrderPayload.from_dict(
    {
        "finaticInstrumentId": "finatic:future:MGCZ6",
        "instrumentId": 611092087,  # provider-native identity remains supported
        "symbol": "MGCZ6",
    }
)
result = await finatic.v1.create_account_order(
    account_id, order, idempotency_key="unique-command-key"
)

The server authorizes and resolves identities in account/provider scope. The SDK preserves both identifiers and never infers an exact contract from a root. The v1 facade continues to return dictionaries; its generated TypedDict annotations make descriptor keys discoverable without changing existing mapping access. Generated model classes remain available when explicit validation or construction is desired.

Package layout

Name Role
finatic-server-python PyPI package
finatic_server_python Public import
src Hand-written FinaticServer and v1.V1Client
finatic_server Generated OpenAPI transport — prefer FinaticServer.v1

Common commands

Task Command
Test pytest
Type check mypy

Documentation

This README is the Python SDK contract. Fetch the rest before writing a full integration:

Metadata

Release files for finatic-server-python 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finatic-server-python 1.0.8
File Size Uploaded Provenance
finatic_server_python-1.0.8.tar.gz 396.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for finatic-server-python 1.0.8
File Interpreter ABI Platform
finatic_server_python-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / finatic_server_python-1.0.8.tar.gz

Download URL finatic_server_python-1.0.8.tar.gz
Size 396.0 kB
Tags Source
SHA-256 checksum
How to use checksums
76351f4b3bb57beb9d22c6f1d28dc369837cbc7973739ece24746632793ba344
BLAKE2b-256 checksum
How to use checksums
04e72b2e774693cd25e37a652d4f776293d63e91ade1c1ef401ba74eff1ad13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Release files / finatic_server_python-1.0.8-py3-none-any.whl

Download URL finatic_server_python-1.0.8-py3-none-any.whl
Size 778.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7635c71859f3177bc145724c7b2f7ab2bf95092b537a68858da4b6973e9380e2
BLAKE2b-256 checksum
How to use checksums
7385f90f2ff9a90981bb5f2869f695880c8610d08a7f97695e7aa50a6ab9c6be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Security for finatic-server-python 1.0.8

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.

Select from 2 files

Attestation for finatic_server_python-1.0.8.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 Oct 16, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page