1
0

Type adjustments

This commit is contained in:
Jon Michael Aanes 2024-08-02 05:28:56 +02:00
parent bcae3d4e29
commit de619e2548
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -18,18 +18,19 @@ import fin_defs
import requests
from frozendict import frozendict
from nordnet_api_client import NordnetClient
from nordnet_api_client.data import Instrument
from .data import Depo, DepoFetcher, DepoGroup, DepoSingle
logger = logging.getLogger(__name__)
def asset_from_instrument(intrument) -> fin_defs.Asset | None:
if intrument.instrument_group_type == 'FND':
def asset_from_instrument(instrument: Instrument) -> fin_defs.Asset | None:
if instrument.instrument_group_type == 'FND':
return None
symbol = intrument.symbol
exchange_id = intrument.tradables[0].mic
return fin_defs.Stock(symbol, fin_defs.EXCHANGES_BY_IDS[exchange_id])
symbol = instrument.symbol
exchange_id = instrument.tradables[0].mic
return fin_defs.Stock(symbol, fin_defs.EXCHANGES_BY_IDS[exchange_id], nordnet_id = instrument.instrument_id)
EMPTY_DICT: Mapping[str, str | int] = frozendict()