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.

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

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

Built distribution (wheel)

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

Total release size: 992.1 kB

Release files / finatic_server_python-1.0.4.tar.gz

Download URL finatic_server_python-1.0.4.tar.gz
Size 324.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c983ed4c4b79b19cc8c3178d848f0035eddedd15ad2a5d307fb103be6061a76d
BLAKE2b-256 checksum
How to use checksums
05b42f5ead8ee60fe2d9c12729fec04bb99ad7ad953b08fb7e85d8c98dd54538
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 Sep 13, 2026.

Transparency log

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

Download URL finatic_server_python-1.0.4-py3-none-any.whl
Size 667.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17f1f0657f43e3c614d606f06e83e6aced4e6d46185a0f45a6190d5968b30844
BLAKE2b-256 checksum
How to use checksums
abec45601e369bb0d1d84776127fd3874eceeece2dd34f00a397be911447a8fe
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 Sep 13, 2026.

Transparency log

Security for finatic-server-python 1.0.4

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.4.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 Sep 13, 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.4 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