def _guessInstrumentFromSymbol(symbol: str) -> Instrument:
    if re.search(r"\s(C|P)$", symbol):
        return _parseOption(symbol)
    elif Bond.validBondSymbol(symbol):
        return Bond(symbol, currency=Currency.USD)
    else:
        return Stock(symbol, currency=Currency.USD)
Beispiel #2
0
def _guessInstrumentFromSymbol(symbol: str, currency: Currency) -> Instrument:
    if re.search(r"[0-9]+(C|P)[0-9]+$", symbol):
        return _parseOptionTransaction(symbol, currency)
    elif Bond.validBondSymbol(symbol):
        return Bond(symbol, currency=currency)
    else:
        return Stock(symbol, currency=currency)