finatic-server-python 1.0.2__py3-none-any.whl → 1.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- finatic_server_python/__init__.py +8 -7
- finatic_server_python-1.0.4.dist-info/METADATA +157 -0
- {finatic_server_python-1.0.2.dist-info → finatic_server_python-1.0.4.dist-info}/RECORD +6 -6
- {finatic_server_python-1.0.2.dist-info → finatic_server_python-1.0.4.dist-info}/WHEEL +1 -1
- src/v1.py +33 -0
- finatic_server_python-1.0.2.dist-info/METADATA +0 -168
- {finatic_server_python-1.0.2.dist-info → finatic_server_python-1.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,20 +6,21 @@ Import::
|
|
|
6
6
|
|
|
7
7
|
from finatic_server_python import FinaticServer
|
|
8
8
|
|
|
9
|
-
finatic = FinaticServer(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
finatic = FinaticServer(
|
|
10
|
+
api_key="fntc_sandbox_your_key",
|
|
11
|
+
sdk_config={"environment": "sandbox"},
|
|
12
|
+
)
|
|
13
|
+
token = await finatic.v1.get_token() # 90 seconds; send to the browser only
|
|
12
14
|
|
|
13
15
|
Package layout:
|
|
14
16
|
|
|
15
17
|
- ``finatic_server_python`` — stable public import name (this shim re-exports ``src``).
|
|
16
18
|
- ``src`` — hand-written SDK: ``FinaticServer``, ``FinaticServerCore``, ``v1.V1Client``.
|
|
17
19
|
- ``finatic_server`` — generated OpenAPI transport client (``src/openapi/finatic_server``).
|
|
18
|
-
|
|
20
|
+
Prefer ``FinaticServer.v1``.
|
|
19
21
|
|
|
20
|
-
Portal auth
|
|
21
|
-
|
|
22
|
-
``portal-links`` creation and post-consent account/grant/webhook APIs.
|
|
22
|
+
Portal auth UX runs in **FinaticConnect**. This SDK mints one-time tokens and portal URLs
|
|
23
|
+
and exposes post-grant account, order, grant, and webhook APIs.
|
|
23
24
|
"""
|
|
24
25
|
|
|
25
26
|
from __future__ import annotations
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: finatic-server-python
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Python SDK for Finatic Server API
|
|
5
|
+
Project-URL: Homepage, https://github.com/FinaticORG/FinaticServerSDK-Python
|
|
6
|
+
Project-URL: Documentation, https://docs.finatic.com/python
|
|
7
|
+
Project-URL: Repository, https://github.com/FinaticORG/FinaticServerSDK-Python
|
|
8
|
+
Project-URL: Issues, https://github.com/FinaticORG/FinaticServerSDK-Python/issues
|
|
9
|
+
Author-email: Finatic <support@finatic.dev>
|
|
10
|
+
License: PROPRIETARY
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,finance,finatic,sdk,trading
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: Other/Proprietary License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: aiohttp-retry>=2.9.1
|
|
24
|
+
Requires-Dist: aiohttp>=3.14.3
|
|
25
|
+
Requires-Dist: cachetools>=7.1.7
|
|
26
|
+
Requires-Dist: pydantic>=2.12.5
|
|
27
|
+
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
28
|
+
Requires-Dist: structlog>=25.5.0
|
|
29
|
+
Requires-Dist: tenacity>=9.1.2
|
|
30
|
+
Requires-Dist: typing-extensions>=4.16.0
|
|
31
|
+
Requires-Dist: urllib3>=2.7.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: build>=1.5.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: flake8>=7.3.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: isort>=8.0.1; extra == 'dev'
|
|
37
|
+
Requires-Dist: mypy>=2.3.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: types-cachetools>=5.3.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: types-python-dateutil>=2.9.0.20260716; extra == 'dev'
|
|
44
|
+
Provides-Extra: integration
|
|
45
|
+
Requires-Dist: psycopg[binary]>=3.3.4; extra == 'integration'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# Finatic Server SDK (Python)
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install finatic-server-python
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio
|
|
62
|
+
import os
|
|
63
|
+
|
|
64
|
+
from finatic_server_python import FinaticServer
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
async def main() -> None:
|
|
68
|
+
finatic = FinaticServer(
|
|
69
|
+
api_key=os.environ["FINATIC_API_KEY"],
|
|
70
|
+
sdk_config={"environment": "sandbox"},
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Client iframe: 90-second token. Never send the API key to the browser.
|
|
74
|
+
one_time_token = await finatic.v1.get_token()
|
|
75
|
+
|
|
76
|
+
# Redirect flow: start a session first (get_portal_url requires it).
|
|
77
|
+
session = await finatic.v1.start_session()
|
|
78
|
+
if not session.get("session_id"):
|
|
79
|
+
raise RuntimeError(session.get("error") or "Session start failed")
|
|
80
|
+
portal_url = await finatic.v1.get_portal_url(mode="dark")
|
|
81
|
+
|
|
82
|
+
# After account.grant.created, start a session for that portal user, then read.
|
|
83
|
+
portal_user_id = "user-from-connect-onSuccess"
|
|
84
|
+
authed = await finatic.v1.start_session(user_id=portal_user_id)
|
|
85
|
+
if not authed.get("session_id"):
|
|
86
|
+
raise RuntimeError(authed.get("error") or "Authenticated session start failed")
|
|
87
|
+
accounts = await finatic.v1.list_accounts(include_sync_status=True)
|
|
88
|
+
if accounts.get("errors"):
|
|
89
|
+
raise RuntimeError(accounts["errors"])
|
|
90
|
+
if not accounts.get("data"):
|
|
91
|
+
raise RuntimeError("No granted accounts yet")
|
|
92
|
+
account_id = accounts["data"][0]["accountId"]
|
|
93
|
+
positions = await finatic.v1.list_positions(account_id)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
asyncio.run(main())
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Server `v1` data methods return `{ "traceId", "data", "warnings", "errors" }`. Check `errors` before using `data`.
|
|
100
|
+
|
|
101
|
+
Use `sdk_config={"environment": "sandbox"}` for Finatic synthetic data (`fntc_sandbox_` keys). Broker paper/sim accounts stay `live`.
|
|
102
|
+
|
|
103
|
+
`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.
|
|
104
|
+
|
|
105
|
+
## Embed Connect
|
|
106
|
+
|
|
107
|
+
Connect UI lives in **FinaticConnect**. This SDK does not open an iframe.
|
|
108
|
+
|
|
109
|
+
1. `v1.get_token()` → pass the token to `@finatic/client` `FinaticConnect.init(token)` in the browser (token TTL is 90 seconds).
|
|
110
|
+
2. Or `v1.start_session()` then `v1.get_portal_url(...)` → redirect. Treat the full URL as secret.
|
|
111
|
+
|
|
112
|
+
Wait for HTTPS webhook `account.grant.created` (or poll `list_accounts` on an ACTIVE session) before account-scoped reads.
|
|
113
|
+
|
|
114
|
+
## Trading
|
|
115
|
+
|
|
116
|
+
Fetch the broker schema, then send an idempotent command:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
schema = await finatic.v1.get_account_order_schema(account_id, "place")
|
|
120
|
+
created = await finatic.v1.create_account_order(
|
|
121
|
+
account_id,
|
|
122
|
+
{"symbol": "AAPL", "quantity": 1, "side": "BUY", "type": "MARKET"},
|
|
123
|
+
idempotency_key="partner-order-123",
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Python wraps the dict as `{"order": ...}` on the wire. `idempotency_key` is required.
|
|
128
|
+
|
|
129
|
+
## Package layout
|
|
130
|
+
|
|
131
|
+
| Name | Role |
|
|
132
|
+
|------|------|
|
|
133
|
+
| `finatic-server-python` | PyPI package |
|
|
134
|
+
| `finatic_server_python` | Public import |
|
|
135
|
+
| `src` | Hand-written `FinaticServer` and `v1.V1Client` |
|
|
136
|
+
| `finatic_server` | Generated OpenAPI transport — prefer `FinaticServer.v1` |
|
|
137
|
+
|
|
138
|
+
## Common commands
|
|
139
|
+
|
|
140
|
+
| Task | Command |
|
|
141
|
+
|------|---------|
|
|
142
|
+
| Test | `pytest` |
|
|
143
|
+
| Type check | `mypy` |
|
|
144
|
+
|
|
145
|
+
## Documentation
|
|
146
|
+
|
|
147
|
+
This README is the Python SDK contract. Fetch the rest before writing a full integration:
|
|
148
|
+
|
|
149
|
+
- Quick start: [https://finatic.dev/docs/quick-start/quick-start](https://finatic.dev/docs/quick-start/quick-start)
|
|
150
|
+
- Client SDK README: [https://github.com/FinaticORG/FinaticClientSDK/blob/develop/README.md](https://github.com/FinaticORG/FinaticClientSDK/blob/develop/README.md)
|
|
151
|
+
- Node SDK README: [https://github.com/FinaticORG/FinaticServerSDK-Node/blob/develop/README.md](https://github.com/FinaticORG/FinaticServerSDK-Node/blob/develop/README.md)
|
|
152
|
+
- Embed Connect: [https://finatic.dev/docs/quick-start/account-grants](https://finatic.dev/docs/quick-start/account-grants)
|
|
153
|
+
- Demo apps: [https://github.com/FinaticORG/FinaticDemoApps/blob/develop/README.md](https://github.com/FinaticORG/FinaticDemoApps/blob/develop/README.md)
|
|
154
|
+
- API reference: [https://finatic.dev/docs/api-reference](https://finatic.dev/docs/api-reference)
|
|
155
|
+
- OpenAPI: [https://finatic.dev/openapi.json](https://finatic.dev/openapi.json)
|
|
156
|
+
- Agent index: [https://finatic.dev/llms.txt](https://finatic.dev/llms.txt)
|
|
157
|
+
- Agent notes: [https://finatic.dev/AGENTS.md](https://finatic.dev/AGENTS.md)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
finatic_server/__init__.py,sha256=4kk4SVN6YPa8g371MGc7jWoypOAn9YGwBDvJqLvQeqM,955
|
|
2
|
-
finatic_server_python/__init__.py,sha256=
|
|
2
|
+
finatic_server_python/__init__.py,sha256=LB4GcHvm7rEvldM1iqzVqYrJ4WDSQR5-AEd5Kj3uDLw,1082
|
|
3
3
|
src/.openapi-generator-ignore,sha256=46FEmqRTpNMVA_uwwYPyCJXI7qufXp0A7sk0ZUY6OEQ,714
|
|
4
4
|
src/FinaticServer.py,sha256=5FqaZEm21BNZeos-QMCTPDv3rWq4XWr9DGUU7K7M53k,238
|
|
5
5
|
src/FinaticServerCore.py,sha256=hsunqG9ligZGEdqnkma1mki7TwHiEY7JRaQ0qJCwtaI,2704
|
|
@@ -7,7 +7,7 @@ src/__init__.py,sha256=IVXwcOfwSGqWIXnEl8c0s6LX7FOBqAIeqAA8wZKifqM,363
|
|
|
7
7
|
src/config.py,sha256=X10rF_jr-VlwiTAaHNIJZJ97q4932PoRKZW-P90j44M,2412
|
|
8
8
|
src/finatic_fdx_types.py,sha256=RyM3v9Y48VwhKhAtgtZilGErwF2jNRT9YAPBEJ3tin0,664
|
|
9
9
|
src/types.py,sha256=Ze4isFaWuwm6b6zrCmAhkt8tmGuBZ2XX-9oPYeMwI6s,639
|
|
10
|
-
src/v1.py,sha256=
|
|
10
|
+
src/v1.py,sha256=8KUGwTZ2XjZBR0HRm_tcldWKMqV9WjTDhWzVIFAKvmI,26739
|
|
11
11
|
src/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
src/openapi/.openapi-generator-ignore,sha256=46FEmqRTpNMVA_uwwYPyCJXI7qufXp0A7sk0ZUY6OEQ,714
|
|
13
13
|
src/openapi/path_bootstrap.py,sha256=ywVDEDRhAEs9aqmchRETHPOONaGg5lV4U05CDsaMyxY,622
|
|
@@ -379,7 +379,7 @@ src/utils/request_id.py,sha256=R_Gcyc5rih7_keAruJHW0bg0Y0MCqQNsUgkZ4C_9sRc,200
|
|
|
379
379
|
src/utils/url_utils.py,sha256=dtxaFEF6Li_lQ7ft0BEDsbyYUDcNXUN4WO_yVAG5MJ8,5051
|
|
380
380
|
src/utils/validation.py,sha256=ODt5raui4KVH1Iz_-Tt8-VKEw-yUzIZg6o93iWLwRj0,1263
|
|
381
381
|
src/wrappers/__init__.py,sha256=8puRg8uOrUR42gCwCtW5zkOtCDbgyMpZSMi2iz2bPcU,123
|
|
382
|
-
finatic_server_python-1.0.
|
|
383
|
-
finatic_server_python-1.0.
|
|
384
|
-
finatic_server_python-1.0.
|
|
385
|
-
finatic_server_python-1.0.
|
|
382
|
+
finatic_server_python-1.0.4.dist-info/METADATA,sha256=t40vIw1VPjy-1XZPjMxBvslBErL-WYUSODcxn_ZWEUM,6532
|
|
383
|
+
finatic_server_python-1.0.4.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
384
|
+
finatic_server_python-1.0.4.dist-info/licenses/LICENSE,sha256=hE35tOCe7uZCeYglYc-sjRSjad4jPyB3i53-QW1YfLk,3590
|
|
385
|
+
finatic_server_python-1.0.4.dist-info/RECORD,,
|
src/v1.py
CHANGED
|
@@ -130,6 +130,16 @@ class V1Client:
|
|
|
130
130
|
)
|
|
131
131
|
|
|
132
132
|
async def get_token(self, api_key: str | None = None) -> str:
|
|
133
|
+
"""Mint a 90-second one-time token for the browser Client SDK.
|
|
134
|
+
|
|
135
|
+
Does not start a session. For redirect, call ``start_session()`` then
|
|
136
|
+
``get_portal_url()``.
|
|
137
|
+
|
|
138
|
+
@example
|
|
139
|
+
```python
|
|
140
|
+
token = await finatic.v1.get_token()
|
|
141
|
+
```
|
|
142
|
+
"""
|
|
133
143
|
response = await self.init_session(api_key)
|
|
134
144
|
if response.get("errors"):
|
|
135
145
|
errors = response["errors"]
|
|
@@ -222,6 +232,14 @@ class V1Client:
|
|
|
222
232
|
email: str | None = None,
|
|
223
233
|
mode: Literal["light", "dark"] | None = None,
|
|
224
234
|
) -> str:
|
|
235
|
+
"""Return a Connect redirect URL. Does not open a browser iframe.
|
|
236
|
+
|
|
237
|
+
@example
|
|
238
|
+
```python
|
|
239
|
+
session = await finatic.v1.start_session()
|
|
240
|
+
portal_url = await finatic.v1.get_portal_url(mode='dark')
|
|
241
|
+
```
|
|
242
|
+
"""
|
|
225
243
|
if not self.session_id:
|
|
226
244
|
raise ValueError("Session not initialized. Call v1.start_session() first.")
|
|
227
245
|
|
|
@@ -289,6 +307,14 @@ class V1Client:
|
|
|
289
307
|
offset: int | None = None,
|
|
290
308
|
include_sync_status: bool | None = None,
|
|
291
309
|
) -> FinaticResponse:
|
|
310
|
+
"""List granted financial accounts. Server envelope uses ``data`` / ``errors``.
|
|
311
|
+
|
|
312
|
+
@example
|
|
313
|
+
```python
|
|
314
|
+
result = await finatic.v1.list_accounts()
|
|
315
|
+
print(result.get('data'), result.get('traceId'))
|
|
316
|
+
```
|
|
317
|
+
"""
|
|
292
318
|
return await self._request(
|
|
293
319
|
"GET",
|
|
294
320
|
"/api/v1/accounts",
|
|
@@ -329,6 +355,13 @@ class V1Client:
|
|
|
329
355
|
async def list_positions(
|
|
330
356
|
self, account_id: str, *, limit: int | None = None, offset: int | None = None
|
|
331
357
|
) -> FinaticResponse:
|
|
358
|
+
"""Positions for one financial account.
|
|
359
|
+
|
|
360
|
+
@example
|
|
361
|
+
```python
|
|
362
|
+
result = await finatic.v1.list_positions('acct_123')
|
|
363
|
+
```
|
|
364
|
+
"""
|
|
332
365
|
return await self.list_account_resource(
|
|
333
366
|
account_id, "positions", limit=limit, offset=offset
|
|
334
367
|
)
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: finatic-server-python
|
|
3
|
-
Version: 1.0.2
|
|
4
|
-
Summary: Python SDK for Finatic Server API
|
|
5
|
-
Project-URL: Homepage, https://github.com/FinaticORG/FinaticServerSDK-Python
|
|
6
|
-
Project-URL: Documentation, https://docs.finatic.com/python
|
|
7
|
-
Project-URL: Repository, https://github.com/FinaticORG/FinaticServerSDK-Python
|
|
8
|
-
Project-URL: Issues, https://github.com/FinaticORG/FinaticServerSDK-Python/issues
|
|
9
|
-
Author-email: Finatic <support@finatic.dev>
|
|
10
|
-
License: PROPRIETARY
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Keywords: api,finance,finatic,sdk,trading
|
|
13
|
-
Classifier: Development Status :: 3 - Alpha
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: Other/Proprietary License
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
-
Requires-Python: >=3.10
|
|
23
|
-
Requires-Dist: aiohttp-retry>=2.9.1
|
|
24
|
-
Requires-Dist: aiohttp>=3.13.2
|
|
25
|
-
Requires-Dist: cachetools>=6.2.2
|
|
26
|
-
Requires-Dist: pydantic>=2.12.5
|
|
27
|
-
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
28
|
-
Requires-Dist: structlog>=25.5.0
|
|
29
|
-
Requires-Dist: tenacity>=9.1.2
|
|
30
|
-
Requires-Dist: typing-extensions>=4.15.0
|
|
31
|
-
Requires-Dist: urllib3>=2.6.1
|
|
32
|
-
Provides-Extra: dev
|
|
33
|
-
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
34
|
-
Requires-Dist: build>=1.2.2; extra == 'dev'
|
|
35
|
-
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
36
|
-
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
37
|
-
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
38
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
39
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
40
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
41
|
-
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
42
|
-
Requires-Dist: types-cachetools>=5.3.0; extra == 'dev'
|
|
43
|
-
Requires-Dist: types-python-dateutil>=2.8.0; extra == 'dev'
|
|
44
|
-
Provides-Extra: integration
|
|
45
|
-
Requires-Dist: psycopg[binary]>=3.2.0; extra == 'integration'
|
|
46
|
-
Description-Content-Type: text/markdown
|
|
47
|
-
|
|
48
|
-
# Finatic Server SDK (Python)
|
|
49
|
-
|
|
50
|
-
Python SDK for server-side Finatic integrations.
|
|
51
|
-
|
|
52
|
-
Use this package to authenticate with Finatic from Python services, generate client tokens, and retrieve standardized broker-domain data.
|
|
53
|
-
|
|
54
|
-
## Version lines (FDX v1)
|
|
55
|
-
|
|
56
|
-
| Version | API surface | Use when |
|
|
57
|
-
|---------|-------------|----------|
|
|
58
|
-
| **1.0.0** | `/api/v1/*` via `FinaticServer.v1` | New account-grant integrations |
|
|
59
|
-
|
|
60
|
-
The 1.0 line does not ship generated beta broker/company clients, connection-first models, or
|
|
61
|
-
inactive position-lot types. The generated transport source is maintained for the account-first
|
|
62
|
-
v1/session surface used by the public facade.
|
|
63
|
-
|
|
64
|
-
## Install
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
pip install finatic-server-python
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Quick Start
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from finatic_server_python import FinaticServer
|
|
74
|
-
|
|
75
|
-
finatic = await FinaticServer.init(api_key="your-api-key")
|
|
76
|
-
token = await finatic.get_token()
|
|
77
|
-
positions = await finatic.get_all_positions()
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Package layout
|
|
81
|
-
|
|
82
|
-
| Name | Role |
|
|
83
|
-
|------|------|
|
|
84
|
-
| `finatic-server-python` | PyPI package (`pip install finatic-server-python`) |
|
|
85
|
-
| `finatic_server_python` | Public import path (`from finatic_server_python import FinaticServer`) |
|
|
86
|
-
| `src` | Hand-written SDK (`FinaticServer`, `v1.V1Client`) |
|
|
87
|
-
| `finatic_server` | Generated OpenAPI transport client (`src/openapi/finatic_server`) |
|
|
88
|
-
|
|
89
|
-
Portal connect flows (institutions, auth-attempts, discovered accounts, grant UI)
|
|
90
|
-
run in **FinaticConnect**, not the server SDK. The server SDK exposes session
|
|
91
|
-
management, `portal-links` creation, and post-consent account/grant/webhook APIs.
|
|
92
|
-
|
|
93
|
-
## Account-First v1 Preview
|
|
94
|
-
|
|
95
|
-
The v1 facade targets the SDK OpenAPI contract (`spec-sdk.yaml`) and sends
|
|
96
|
-
`X-Finatic-Environment` on every request.
|
|
97
|
-
|
|
98
|
-
```python
|
|
99
|
-
from finatic_server_python import FinaticServer
|
|
100
|
-
|
|
101
|
-
finatic = FinaticServer(
|
|
102
|
-
api_key="fntc_live_your_key",
|
|
103
|
-
sdk_config={"environment": "live"},
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
session = await finatic.v1.create_session()
|
|
107
|
-
portal_link = await finatic.v1.create_portal_link()
|
|
108
|
-
# Open portal_link URL in FinaticConnect for user auth + grant consent
|
|
109
|
-
|
|
110
|
-
accounts = await finatic.v1.list_accounts()
|
|
111
|
-
orders = await finatic.v1.list_account_orders("broker-account-id")
|
|
112
|
-
created = await finatic.v1.create_account_order(
|
|
113
|
-
"broker-account-id",
|
|
114
|
-
{"symbol": "AAPL", "quantity": 1, "side": "BUY", "type": "MARKET"},
|
|
115
|
-
idempotency_key="partner-order-123",
|
|
116
|
-
)
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Use `sdk_config={"environment": "sandbox"}` for Finatic synthetic sandbox data.
|
|
120
|
-
Broker paper or simulated accounts remain `live` environment accounts.
|
|
121
|
-
|
|
122
|
-
### OpenAPI Contract Artifact
|
|
123
|
-
|
|
124
|
-
The v1 facade is validated against `artifacts/openapi/finaticapi-v1.json`, which
|
|
125
|
-
is exported from the FinaticAPI account-first branch. Refresh it with:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
env PYTHONPATH=/home/claw/.openclaw/workspace/worktrees/FinaticAPI-pr174-openapi/src:/home/claw/.openclaw/workspace/worktrees/FinaticCore-pr171-openapi/src /home/claw/.openclaw/workspace/repos/FinaticAPI/.venv/bin/python /home/claw/.openclaw/workspace/worktrees/FinaticAPI-pr174-openapi/scripts/export_openapi.py --output /home/claw/.openclaw/workspace/repos/FinaticServerSDK-Python/artifacts/openapi/finaticapi-v1.json
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
PR #25 currently uses FinaticAPI PR #174 head `4ca17320` and finaticCore PR
|
|
132
|
-
#171 head `0a126bed` as branch-ready dependency inputs. The package version is
|
|
133
|
-
prepared as `1.0.0` for the API v1 semver lane, but the coordinated FDX
|
|
134
|
-
account-consent operator hold still controls merge and release timing.
|
|
135
|
-
|
|
136
|
-
## Common Commands
|
|
137
|
-
|
|
138
|
-
| Task | Command |
|
|
139
|
-
|---|---|
|
|
140
|
-
| Install in editable mode | `uv pip install -e .` |
|
|
141
|
-
| Run tests | `pytest` |
|
|
142
|
-
| Build package | `python -m build` |
|
|
143
|
-
| Lint | `ruff check .` |
|
|
144
|
-
| Format | `ruff format .` |
|
|
145
|
-
|
|
146
|
-
## Core Capabilities
|
|
147
|
-
|
|
148
|
-
- API-key initialization and session management.
|
|
149
|
-
- Portal URL generation for end-user authentication.
|
|
150
|
-
- One-time token generation for client SDK sessions.
|
|
151
|
-
- Typed access to orders, positions, accounts, and balances.
|
|
152
|
-
- Consistent response/error structures across endpoints.
|
|
153
|
-
|
|
154
|
-
## Documentation
|
|
155
|
-
|
|
156
|
-
- Product docs: [https://finatic.dev/docs](https://finatic.dev/docs)
|
|
157
|
-
- API reference: [https://finatic.dev/docs/api-reference](https://finatic.dev/docs/api-reference)
|
|
158
|
-
- LLM context doc: [https://finatic.dev/llms.txt](https://finatic.dev/llms.txt)
|
|
159
|
-
|
|
160
|
-
## Using Finatic with AI
|
|
161
|
-
|
|
162
|
-
Use this SDK in Python AI/data systems to:
|
|
163
|
-
|
|
164
|
-
- query balances, positions, and orders across connected brokers
|
|
165
|
-
- normalize broker interactions behind one SDK surface
|
|
166
|
-
- feed structured brokerage data into analytics or model workflows
|
|
167
|
-
|
|
168
|
-
MCP support is coming soon.
|
{finatic_server_python-1.0.2.dist-info → finatic_server_python-1.0.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|