Skip to content

Commit 63a7b8b

Browse files
committed
fix: replace ".name" with ".ticker" in base currency properties
After recent changes FX tickers have long name different from ticker.
1 parent bd086f0 commit 63a7b8b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

okama/api/api_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class API:
1616
# TODO: introduce 'from' & 'to' for dates.
1717

1818
api_url = "http://api.okama.io:5000"
19-
default_timeout = 10 # secondsq
19+
default_timeout = 10 # seconds
2020

2121
endpoint_ror = "/api/ts/ror/"
2222
endpoint_symbol = "/api/symbol/"

okama/common/make_asset_list.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _make_list(self, ls: list, first_date, last_date) -> dict:
102102
"""
103103
Make an asset list from a list of symbols.
104104
"""
105-
base_currency_name: str = self._currency.name
105+
base_currency_ticker: str = self._currency.ticker
106106
currency_first_date: pd.Timestamp = self._currency.first_date
107107
currency_last_date: pd.Timestamp = self._currency.last_date
108108

@@ -126,9 +126,9 @@ def _make_list(self, ls: list, first_date, last_date) -> dict:
126126
f"{asset_item.symbol} period length is {asset_item.pl.months}. It should be at least 3 months."
127127
)
128128
if i == 0: # required to use pd.concat below (df should not be empty).
129-
df = self._make_ror(asset_item, base_currency_name)
129+
df = self._make_ror(asset_item, base_currency_ticker)
130130
else:
131-
new = self._make_ror(asset_item, base_currency_name)
131+
new = self._make_ror(asset_item, base_currency_ticker)
132132
df = pd.concat([df, new], axis=1, join="inner", copy="false")
133133
# get asset first and last dates after adjusting to the currency
134134
asset_first_date = df.index[0].to_timestamp()
@@ -150,11 +150,11 @@ def _make_list(self, ls: list, first_date, last_date) -> dict:
150150
last_dates[asset_item.symbol] = asset_last_date
151151
own_first_dates[asset_item.symbol] = asset_own_first_date
152152
own_last_dates[asset_item.symbol] = asset_own_last_date
153-
first_dates[base_currency_name] = currency_first_date
154-
last_dates[base_currency_name] = currency_last_date
155-
own_last_dates[base_currency_name] = currency_last_date
156-
own_first_dates[base_currency_name] = currency_first_date
157-
currencies["asset list"] = base_currency_name
153+
first_dates[base_currency_ticker] = currency_first_date
154+
last_dates[base_currency_ticker] = currency_last_date
155+
own_last_dates[base_currency_ticker] = currency_last_date
156+
own_first_dates[base_currency_ticker] = currency_first_date
157+
currencies["asset list"] = base_currency_ticker
158158
# get first and last dates
159159
first_date_list = list(first_dates.values()) + [input_first_date]
160160
last_date_list = list(last_dates.values()) + [input_last_date]

0 commit comments

Comments
 (0)