Перейти к содержанию

Clients

AsyncClient

Async client.

import asyncio
import os

from tinkoff.invest import AsyncClient

TOKEN = os.environ["INVEST_TOKEN"]


async def main():
    async with AsyncClient(TOKEN) as client:
        print(await client.users.get_accounts())


if __name__ == "__main__":
    asyncio.run(main())

Client

Sync client.

import os
from tinkoff.invest import Client

TOKEN = os.environ["INVEST_TOKEN"]

def main():
    with Client(TOKEN) as client:
        print(client.users.get_accounts())