From cfe6de5aa220fde10cb096795d2959c3fc3fb00b Mon Sep 17 00:00:00 2001 From: Jimmy Situ Date: Mon, 18 Mar 2024 23:32:33 +0800 Subject: [PATCH] Add more exmaple for HongKong market --- examples/get_hsi.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 examples/get_hsi.py diff --git a/examples/get_hsi.py b/examples/get_hsi.py new file mode 100755 index 0000000..2386b17 --- /dev/null +++ b/examples/get_hsi.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 -u + +import msfinance as msf + +proxy = 'socks5://127.0.0.1:1088' + +stock = msf.Stock( + debug=True, + session='hsi.sql3', + proxy=proxy, +) + +tickers_list = stock.get_hsi_tickers() + +for ticker in sorted(tickers_list): + valuations = stock.get_valuations(ticker, 'xhkg') + financials = stock.get_financials(ticker, 'xhkg') + + print(f"Ticker: {ticker}") + for valuation in valuations: + print(valuation) + for financial in financials: + print(financial) +