Files
raptor-trading/check_me.py

19 lines
672 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from dotenv import load_dotenv
from t_tech.invest import Client
load_dotenv("tok.env")
TOKEN = os.getenv("TINKOFF_TOKEN")
with Client(TOKEN) as client:
accounts = client.users.get_accounts().accounts
print("--- ДОСТУПНЫЕ СЧЕТА ---")
for acc in accounts:
print(f"ID: {acc.id} | Имя: {acc.name} | Статус: {acc.status.name}")
# Прямой запрос цены Сбера
price = client.market_data.get_last_prices(instrument_id=["a78b8349-a1dc-447d-9277-1d75826d089a"])
p = price.last_prices[0].price
print(f"\n--- ЦЕНА ИЗ API ---")
print(f"Цена: {p.units + p.nano / 1e9} руб.")