Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_tinkoff_invest_robot-main/src/algotrading/instruments_service.py
7826 views
1
from tinkoff.invest import InstrumentIdType
2
3
from src.algotrading.utils import api_client_configure
4
5
6
def get_instrument_by(figi: str) -> dict:
7
api_client = api_client_configure()
8
9
with api_client as client:
10
instrument = client.instruments.get_instrument_by(id_type=InstrumentIdType.INSTRUMENT_ID_TYPE_FIGI, id=figi)
11
12
return {'name': instrument.instrument.name,
13
'lot': instrument.instrument.lot,
14
'currency': instrument.instrument.currency,
15
'trading_status': {
16
'name': instrument.instrument.trading_status.name,
17
'code': instrument.instrument.trading_status.value
18
}
19
}
20
21