Python client for the Toss Securities (토스증권) Open API
Project description
tossinvest
Async Python client for the Toss Securities (토스증권) Open API — a faithful port of
tossinvest-rust.
- Pure REST client with OAuth2
client_credentialsauth - Exact decimals (
Decimal, neverfloat), unknown-tolerant open enums, status-split envelope decoding - Per-group rate limiting (GCRA + adaptive AIMD) with the 09:00–09:10 KST peak-window awareness
- Account-scoped client handle so the
X-Tossinvest-Accountheader is unforgettable
Status: alpha. Stateless SDK (model → rate → client) and the stateful/observable layer (
StateHandle) are implemented.
Install
pip install tossinvest
Quickstart
import asyncio
from tossinvest import TossClient, ClientConfig
async def main():
async with TossClient(ClientConfig(client_id="...", client_secret="...")) as client:
prices = await client.prices(["005930"])
price = prices[0]
print(price.last_price, price.currency)
asyncio.run(main())
Response models live in tossinvest.model (e.g. from tossinvest.model import PriceResponse).
Stateful layer (StateHandle)
The L4/L5 reconciler maintains a live, single-writer projection of your orders, holdings, and prices, with optimistic mutations and on-demand refresh:
import asyncio
from tossinvest import TossClient, ClientConfig
from tossinvest.state import StateHandle
async def main():
async with TossClient(ClientConfig(client_id="...", client_secret="...")) as client:
account = client.account(seq)
async with await StateHandle.spawn(account) as handle:
async with handle.watch_prices(["005930"]): # demand lease
snap = handle.snapshot() # wait-free read
print(snap.prices.get("005930"))
asyncio.run(main())
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tossinvest-0.1.0.tar.gz.
File metadata
- Download URL: tossinvest-0.1.0.tar.gz
- Upload date:
- Size: 121.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00fc0f0aa976057a2540a0f0e458af848aa578ff9fe9efae514c55b0b1f7084
|
|
| MD5 |
7011a64c275044e0df6ad66e70ac5007
|
|
| BLAKE2b-256 |
1e3d8ad8db1b9de080c0bb1240e0ffd9a32436d25ad611b34c0964aa5686c78d
|
File details
Details for the file tossinvest-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tossinvest-0.1.0-py3-none-any.whl
- Upload date:
- Size: 95.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
072b4a6272bd4d2934b1760a351201df529d5f8a0b1f4a24e299d436b70f8992
|
|
| MD5 |
c6340db6cd7ee3a4ff820da9b862a812
|
|
| BLAKE2b-256 |
0434618ec30fa62503611a9a4098c353ad81ddc4d110c81b65d6a67b4c9ef264
|