Skip to content

Commit

Permalink
feat: add yahoo to the available quote sources
Browse files Browse the repository at this point in the history
  • Loading branch information
glorat committed Nov 13, 2022
1 parent 15c8e3e commit ca41105
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/src/lib/assetdb/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const quoteSourceTypes = [
{value: 'av', label: 'Alpha Vantage'},
{value: 'investpy', label: 'investpy'},
{value: 'ft', label: 'ft.com symbol'},
{value: 'yahoo', label: 'Yahoo finance symbol'},
].map(cleanUp);

export const investmentAssetTypes = [
Expand Down
1 change: 1 addition & 0 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
investpy==1.0.8
investiny==0.7.2
yfinance==0.1.85
4 changes: 3 additions & 1 deletion python/yahoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ def doit(args):
# print(ticker, file=sys.stderr)

t = yf.Ticker(ticker)
currency = t.info['currency']

# df = t.history(period="1mo")
df = t.history(period="max")
df['timestamp'] = df.index.strftime('%Y-%m-%d')
df['close'] = df['Close'].round(4)
ret = df.to_csv(columns=['timestamp', 'close'], index=False)
df['currency'] = currency
ret = df.to_csv(columns=['timestamp', 'close', 'currency'], index=False)
return ret


Expand Down

0 comments on commit ca41105

Please sign in to comment.