Skip to content

Commit

Permalink
[Main] Update YahooQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
billpwchan committed Feb 19, 2024
1 parent 3c3a3c6 commit 38623f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engines/data_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def get_stocks_email(stock_list: list) -> dict:
'Last Close': f"{stock_ticker.summary_detail[stock_code].get('currency', 'N/A')} {stock_ticker.summary_detail[stock_code].get('previousClose', 0):.3f}",
'Open': f"{stock_ticker.summary_detail[stock_code].get('currency', 'N/A')} {stock_ticker.price[stock_code].get('regularMarketDayHigh', 0):.3f}",
'Close': f"{stock_ticker.summary_detail[stock_code].get('currency', 'N/A')} {stock_ticker.price[stock_code].get('regularMarketPrice', 0):.3f}",
'% Change': f"{stock_ticker.price[stock_code].get('regularMarketChange', 0):.2f}%",
'% Change': f"{stock_ticker.price[stock_code].get('regularMarketChangePercent', 0):.2f}%",
'Volume': f"{stock_ticker.summary_detail[stock_code].get('currency', 'N/A')} {humanize.intword(stock_ticker.summary_detail[stock_code].get('volume', 'N/A'))}",
'52 Week Range': f"{stock_ticker.summary_detail[stock_code].get('currency', 'N/A')} {stock_ticker.summary_detail[stock_code].get('fiftyTwoWeekLow', 'N/A')}-{stock_ticker.summary_detail[stock_code].get('fiftyTwoWeekHigh', 'N/A')}",
'PE(Trailing/Forward)': f"{stock_ticker.summary_detail[stock_code].get('trailingPE', 'N/A')} / {stock_ticker.summary_detail[stock_code].get('forwardPE', 'N/A')}",
Expand Down
2 changes: 2 additions & 0 deletions main_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def main():
subscription_list = json.loads(config.get('Email', 'SubscriptionList'))
for market in args.market:
filtered_stock_list = []
filtered_stock_dict = {}
if 'HK' in args.market or 'US' in args.market:
# HK Market Stock Filter
full_equity_list = []
Expand All @@ -207,6 +208,7 @@ def main():
filtered_stock_list = init_stock_filter(args.filter, china_equity_list)
filtered_stock_dict = TuShareInterface.get_stocks_email(filtered_stock_list)

# DO NOT send email if no stock gets selected
if len(filtered_stock_list) == 0:
continue
for subscriber in subscription_list:
Expand Down

0 comments on commit 38623f9

Please sign in to comment.