From 5b272a7072ac3a2bd7280fbca2b194caed4086a4 Mon Sep 17 00:00:00 2001 From: Jimmy Situ Date: Sat, 13 Apr 2024 13:59:30 +0800 Subject: [PATCH] Update tests --- examples/get_xnas.py | 25 +++++++++++++++++++++++++ examples/get_xnys.py | 25 +++++++++++++++++++++++++ tests/test_stocks.py | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 examples/get_xnas.py create mode 100755 examples/get_xnys.py diff --git a/examples/get_xnas.py b/examples/get_xnas.py new file mode 100755 index 0000000..73defe2 --- /dev/null +++ b/examples/get_xnas.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 -u + +import msfinance as msf + +proxy = 'socks5://127.0.0.1:1088' + +stock = msf.Stock( + debug=True, + session='xnas.db3', + proxy=proxy, +) + +tickers_list = { + 'asml', # ASML Holding NV ADR +} + +for ticker in sorted(tickers_list): + valuations = stock.get_valuations(ticker, 'xnas') + financials = stock.get_financials(ticker, 'xnas') + + print(f"Ticker: {ticker}") + for valuation in valuations: + print(valuation) + for financial in financials: + print(financial) diff --git a/examples/get_xnys.py b/examples/get_xnys.py new file mode 100755 index 0000000..be4d4ed --- /dev/null +++ b/examples/get_xnys.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 -u + +import msfinance as msf + +proxy = 'socks5://127.0.0.1:1088' + +stock = msf.Stock( + debug=True, + session='xnys.db3', + proxy=proxy, +) + +tickers_list = { + 'tsm', +} + +for ticker in sorted(tickers_list): + valuations = stock.get_valuations(ticker, 'xshg') + financials = stock.get_financials(ticker, 'xshg') + + print(f"Ticker: {ticker}") + for valuation in valuations: + print(valuation) + for financial in financials: + print(financial) diff --git a/tests/test_stocks.py b/tests/test_stocks.py index c5b54f1..0dc25d3 100755 --- a/tests/test_stocks.py +++ b/tests/test_stocks.py @@ -12,7 +12,7 @@ def test_stocks(): proxy = 'socks5://127.0.0.1:1088' - session='/tmp/msfinance/msf.sql3' + session='/tmp/msfinance/msf.db3' if 'true' == os.getenv('GITHUB_ACTIONS'):