Ruff
This commit is contained in:
parent
571ad4e938
commit
aad7c9939e
|
@ -16,11 +16,11 @@ Defined hierarchy:
|
|||
- `Commodity`
|
||||
"""
|
||||
|
||||
import abc
|
||||
import dataclasses
|
||||
import datetime
|
||||
import re
|
||||
from decimal import Decimal
|
||||
import abc
|
||||
|
||||
import enforce_typing
|
||||
|
||||
|
@ -176,6 +176,7 @@ class FiatCurrency(Currency):
|
|||
def raw_short_name(self) -> str:
|
||||
return self.iso_code
|
||||
|
||||
|
||||
@enforce_typing.enforce_types
|
||||
@dataclasses.dataclass(frozen=True, eq=True)
|
||||
class CryptoCurrency(Currency):
|
||||
|
@ -192,6 +193,7 @@ class CryptoCurrency(Currency):
|
|||
def raw_short_name(self) -> str:
|
||||
return self.ccxt_symbol
|
||||
|
||||
|
||||
@enforce_typing.enforce_types
|
||||
@dataclasses.dataclass(frozen=True, eq=True)
|
||||
class Stock(Asset):
|
||||
|
@ -225,6 +227,7 @@ class Index(Asset):
|
|||
def raw_short_name(self) -> str:
|
||||
return self.ticker
|
||||
|
||||
|
||||
@enforce_typing.enforce_types
|
||||
@dataclasses.dataclass(frozen=True, eq=True)
|
||||
class Commodity(Asset):
|
||||
|
@ -236,7 +239,7 @@ class Commodity(Asset):
|
|||
raise ValueError(msg)
|
||||
|
||||
def raw_short_name(self) -> str:
|
||||
return self.alpha_vantage_id # TODO
|
||||
return self.alpha_vantage_id # TODO
|
||||
|
||||
|
||||
Commodity.CRUDE_OIL_WTI = Commodity('WTI')
|
||||
|
|
|
@ -2,11 +2,15 @@ import pytest
|
|||
|
||||
import fin_defs
|
||||
|
||||
|
||||
@pytest.mark.parametrize('asset', fin_defs.WELL_KNOWN_SYMBOLS.values())
|
||||
def test_to_from_string_id(asset: fin_defs.Asset):
|
||||
assert fin_defs.Asset.from_string_id(asset.to_string_id()) == asset
|
||||
|
||||
|
||||
import fin_defs
|
||||
|
||||
|
||||
@pytest.mark.parametrize('asset', fin_defs.WELL_KNOWN_SYMBOLS.values())
|
||||
def test_to_from_polygon_id(asset: fin_defs.Asset):
|
||||
assert fin_defs.Asset.from_polygon_id(asset.to_polygon_id()) == asset
|
||||
|
|
Loading…
Reference in New Issue
Block a user