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("session_id"):
        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.

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

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.7
File Size Uploaded Provenance
finatic_server_python-1.0.7.tar.gz 393.9 kB With provenance Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / finatic_server_python-1.0.7.tar.gz

Download URL finatic_server_python-1.0.7.tar.gz
Size 393.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5070841fa926482ccfe00e2cf5cf719812c74e36a152da812c68d58099a666c7
BLAKE2b-256 checksum
How to use checksums
830cad8e0b1d5d12d1608bdf67bf84e337da38fe88b2cc79059b5e0f04145e8b
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 12, 2026.

Transparency log

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

Download URL finatic_server_python-1.0.7-py3-none-any.whl
Size 777.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bf4c77f4a34f7a4fbeac1a9de10425eba2cc4d089d5f6f813b1b0b9ec192f87
BLAKE2b-256 checksum
How to use checksums
bfe3f643e26649b3302440a173d7d9e1a3d8aed23f5915edae7053f2fc3a692d
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 12, 2026.

Transparency log

Security for finatic-server-python 1.0.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.

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.7.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 12, 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.7 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