From 1975deee096172ef23ab9b713d452bb64e322337 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 11:25:28 -0400 Subject: [PATCH 01/18] Update copyright year --- LICENSE | 2 +- docs/conf.py | 2 +- docs/license.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index dacee4f..c16ad9c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017-2019 Louie Lu +Copyright (c) 2017-2024 Louie Lu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/conf.py b/docs/conf.py index 1484d4f..77cb16c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ # General information about the project. project = "twstock" -copyright = "2017, Louie Lu" +copyright = "2017-2024, Louie Lu" author = "Louie Lu" # The version info for the project you're documenting, acts as replacement for diff --git a/docs/license.rst b/docs/license.rst index 4107d06..13c2a48 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -1,7 +1,7 @@ LICENSE --------------------- -Copyright (c) 2017-2019 Louie Lu +Copyright (c) 2017-2024 Louie Lu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 52beb157f899260cc62b8ebe0275106af70e7c77 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 11:27:22 -0400 Subject: [PATCH 02/18] Update example year month --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f0c35e..9a369ee 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ ma_p_cont = stock.continuous(ma_p) # 計算五日均價持續天 ma_br = stock.ma_bias_ratio(5, 10) # 計算五日、十日乖離值 ``` -擷取自 2015 年 1 月至今之資料 +擷取自 2024 年 3 月至今之資料 ```python stock = Stock('2330') -stock.fetch_from(2015, 1) +stock.fetch_from(2024, 3) ``` 基本資料之使用 From e6fd8dc001163eef31b0630f30ae8e4afd59b616 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 11:23:14 -0400 Subject: [PATCH 03/18] Remove appveyor CI --- appveyor.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b4cd2cd..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -environment: - global: - FLIT_ROOT: C:\projects\flit - matrix: - - PYTHON: 'C:\Python34' - - PYTHON: 'C:\Python35' - - PYTHON: 'C:\Python36' - - PYTHON: 'C:\Python36-x64' - PYTHON_VERSION: '3.6.2' - PYTHON_ARCH: '64' - -branches: - only: - - master - -init: - - echo %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% - -install: - - 'set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%' - - 'python -m pip install -U pip' - - 'python -m pip install pipenv' - -build_script: - - 'python -m pipenv install --dev' - -test_script: - - 'python -m pipenv run coverage run --source=twstock -m unittest' From 3848cbc435d6fcc67012b19643be17519e684c55 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 22:58:54 -0400 Subject: [PATCH 04/18] Update realtime mock data --- twstock/mock/__init__.py | 54 +++------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/twstock/mock/__init__.py b/twstock/mock/__init__.py index 87dbce1..fda0990 100644 --- a/twstock/mock/__init__.py +++ b/twstock/mock/__init__.py @@ -4,57 +4,9 @@ TSE_2330_TW = [ - """ -{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999778918", "tk1": -"2330.tw_tse_20170724_B_9999777950", "tlong": "1500860849000", "f": -"853_1193_972_1209_817_", "ex": "tse", "g": "1221_1530_817_1038_1193_", "d": -"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": -"2330", "mt": "264564", "a": "214.50_215.00_215.50_216.00_216.50_", "n": -"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", -"i": "24", "w": "193.00", "v": "5094", "u": "235.00", "t": "09:47:29", "s": -"1", "pz": "213.50", "tv": "1", "p": "0", "nf": -"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", -"ch": "2330.tw", -"z": "214.50", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": -"OK", "referer": "", "queryTime": {"sysTime": "09:47:30", "sessionLatestTime": --1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", -"sessionFromTime": -1, "stockInfoItem": 2065, "showChart": false, -"sessionStr": "UserSession", "stockInfo": 204322}, "rtcode": "0000"} -""", - """ -{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999766224", "tk1": -"2330.tw_tse_20170724_B_9999765954", "tlong": "1500861105000", "f": -"1059_1079_1014_1229_907_", "ex": "tse", "g": "1455_1598_797_1019_1134_", "d": -"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": -"2330", "mt": "778472", "a": "214.50_215.00_215.50_216.00_216.50_", "n": -"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", -"i": "24", "w": "193.00", "v": "5217", "u": "235.00", "t": "09:51:45", "s": -"0", "pz": "213.50", "tv": "1", "p": "0", "nf": -"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", -"ch": "2330.tw", -"z": "214.50", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": -"OK", "referer": "", "queryTime": {"sysTime": "09:51:48", "sessionLatestTime": --1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", -"sessionFromTime": -1, "stockInfoItem": 2055, "showChart": false, -"sessionStr": "UserSession", "stockInfo": 130895}, "rtcode": "0000"} -""", - """ -{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999760446", "tk1": -"2330.tw_tse_20170724_B_9999759382", "tlong": "1500861243000", "f": -"1034_1028_1009_1253_933_", "ex": "tse", "g": "1466_1625_798_987_1117_", "d": -"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": -"2330", "mt": "962863", "a": "214.50_215.00_215.50_216.00_216.50_", "n": -"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", -"i": "24", "w": "193.00", "v": "5268", "u": "235.00", "t": "09:54:03", "s": -"0", "pz": "213.50", "tv": "3", "p": "0", "nf": -"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", -"ch": "2330.tw", -"z": "214.00", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": -"OK", "referer": "", "queryTime": {"sysTime": "09:54:10", "sessionLatestTime": --1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", -"sessionFromTime": -1, "stockInfoItem": 1602, "showChart": false, -"sessionStr": "UserSession", "stockInfo": 119518}, "rtcode": "0000"} -""", + """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "849.0000_850.0000_851.0000_852.0000_853.0000_", "b": "848.0000_847.0000_846.0000_845.0000_844.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827494000", "f": "170_372_260_647_514_", "ip": "0", "g": "6_50_126_107_255_", "mt": "692836", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:44:54", "u": "922.0000", "v": "23350", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 2300, "stockInfo": 1107969, "sessionStr": "UserSession", "sysTime": "10:45:02", "showChart": false, "sessionFromTime": 1715827477731, "sessionLatestTime": 1715827477731}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 41360}""", + """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "848.0000_849.0000_850.0000_851.0000_852.0000_", "b": "847.0000_846.0000_845.0000_844.0000_843.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827560000", "f": "53_157_370_261_945_", "ip": "0", "g": "42_124_116_271_187_", "mt": "826330", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:46:00", "u": "922.0000", "v": "23384", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 762, "stockInfo": 270448, "sessionStr": "UserSession", "sysTime": "10:46:02", "showChart": false, "sessionFromTime": 1715827446503, "sessionLatestTime": 1715827446503}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 17846}""", + """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "848.0000_849.0000_850.0000_851.0000_852.0000_", "b": "847.0000_846.0000_845.0000_844.0000_843.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827579000", "f": "64_157_371_261_947_", "ip": "0", "g": "40_124_118_270_185_", "mt": "655374", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:46:19", "u": "922.0000", "v": "23388", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 2216, "stockInfo": 506844, "sessionStr": "UserSession", "sysTime": "10:46:25", "showChart": false, "sessionFromTime": -1, "sessionLatestTime": -1}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 21231}""", ] From 24a1712ca98fb707f6e3d9378af15d1b7e40e780 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 22:59:04 -0400 Subject: [PATCH 05/18] Update realtime test --- test/test_realtime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_realtime.py b/test/test_realtime.py index 1c84254..2f23702 100644 --- a/test/test_realtime.py +++ b/test/test_realtime.py @@ -55,10 +55,10 @@ def test_mock_one_stock_id(self): self.assertTrue(s["success"]) self.assertEqual(s["info"]["code"], "2330") - self.assertEqual(s["realtime"]["latest_trade_price"], "214.50") + self.assertEqual(s["realtime"]["latest_trade_price"], "-") self.assertEqual( s["realtime"]["best_bid_price"], - ["214.00", "213.50", "213.00", "212.50", "212.00"], + ["848.0000", "847.0000", "846.0000", "845.0000", "844.0000"], ) @unittest.skip("Dont want to fix this, is about the code in realtime") From 305577995eb1d446f443f28c13312857af856294 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:01:45 -0400 Subject: [PATCH 06/18] Update mock test --- test/test_mock.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_mock.py b/test/test_mock.py index 9f12ffa..f944ef8 100644 --- a/test/test_mock.py +++ b/test/test_mock.py @@ -9,7 +9,16 @@ def test_mock_get_stock_info_will_work(self): def test_mock_get_stock_info_raw_data(self): self.assertCountEqual( mock.get_stock_info("2330").keys(), - ["msgArray", "userDelay", "rtmessage", "referer", "queryTime", "rtcode"], + [ + "msgArray", + "userDelay", + "rtmessage", + "referer", + "queryTime", + "rtcode", + "exKey", + "cachedAlive", + ], ) def test_mock_get_stock_info_msgarray(self): From 885c9c5726c2d68fbed048b7a1d552c0200fa01e Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:06:32 -0400 Subject: [PATCH 07/18] Fix coveralls token --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bc76e9..5331901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,5 @@ jobs: | pipenv run coveralls pipenv run codecov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ac8794a1dd52c608dc8991fa326e053465801c67 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:14:06 -0400 Subject: [PATCH 08/18] Update CI to create only one report --- .github/workflows/ci.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5331901..e4a5059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,10 +19,25 @@ jobs: pipenv install --dev - name: Run tests run: pipenv run coverage run --source=twstock -m unittest + create-reports: + runs-on: ubuntu-latest + needs: build + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.12"] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup + run: | + pip install pipenv + pipenv install --dev + - name: Run tests + run: pipenv run coverage run --source=twstock -m unittest - name: Create reports - run: - | - pipenv run coveralls - pipenv run codecov + run: | + pipenv run coveralls + pipenv run codecov env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0b6e18f921e2e3f6062e125ec003ed63fbd1f275 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:18:11 -0400 Subject: [PATCH 09/18] Reduce strategy matrix to 3.7/3.12 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4a5059..dc844a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: - ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + ["3.7", "3.12"] runs-on: ${{ matrix.os }} name: ${{ matrix.os }} - ${{ github.event_name }} steps: From 1ab4b629bf96cc15c8604fc97136841d902e4ecb Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 10/18] Revert "Reduce strategy matrix to 3.7/3.12" This reverts commit 0b6e18f921e2e3f6062e125ec003ed63fbd1f275. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc844a1..e4a5059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: - ["3.7", "3.12"] + ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} name: ${{ matrix.os }} - ${{ github.event_name }} steps: From ff7aa3e83f24849e77a672ccf7cf9cf6c0c5c076 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 11/18] Revert "Update CI to create only one report" This reverts commit ac8794a1dd52c608dc8991fa326e053465801c67. --- .github/workflows/ci.yml | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4a5059..5331901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,25 +19,10 @@ jobs: pipenv install --dev - name: Run tests run: pipenv run coverage run --source=twstock -m unittest - create-reports: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.12"] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup - run: | - pip install pipenv - pipenv install --dev - - name: Run tests - run: pipenv run coverage run --source=twstock -m unittest - name: Create reports - run: | - pipenv run coveralls - pipenv run codecov + run: + | + pipenv run coveralls + pipenv run codecov env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 52d8687f06e258c3ada886ef7e98b8b2dc51bf4c Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 12/18] Revert "Fix coveralls token" This reverts commit 885c9c5726c2d68fbed048b7a1d552c0200fa01e. --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5331901..2bc76e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,5 +24,3 @@ jobs: | pipenv run coveralls pipenv run codecov - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ad6783f7b3df7e57c4953f91835e22c2164dfd58 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 13/18] Revert "Update mock test" This reverts commit 305577995eb1d446f443f28c13312857af856294. --- test/test_mock.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/test/test_mock.py b/test/test_mock.py index f944ef8..9f12ffa 100644 --- a/test/test_mock.py +++ b/test/test_mock.py @@ -9,16 +9,7 @@ def test_mock_get_stock_info_will_work(self): def test_mock_get_stock_info_raw_data(self): self.assertCountEqual( mock.get_stock_info("2330").keys(), - [ - "msgArray", - "userDelay", - "rtmessage", - "referer", - "queryTime", - "rtcode", - "exKey", - "cachedAlive", - ], + ["msgArray", "userDelay", "rtmessage", "referer", "queryTime", "rtcode"], ) def test_mock_get_stock_info_msgarray(self): From 3235ca444cdf92429a38cccaa5560699b3a3820c Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 14/18] Revert "Update realtime test" This reverts commit 24a1712ca98fb707f6e3d9378af15d1b7e40e780. --- test/test_realtime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_realtime.py b/test/test_realtime.py index 2f23702..1c84254 100644 --- a/test/test_realtime.py +++ b/test/test_realtime.py @@ -55,10 +55,10 @@ def test_mock_one_stock_id(self): self.assertTrue(s["success"]) self.assertEqual(s["info"]["code"], "2330") - self.assertEqual(s["realtime"]["latest_trade_price"], "-") + self.assertEqual(s["realtime"]["latest_trade_price"], "214.50") self.assertEqual( s["realtime"]["best_bid_price"], - ["848.0000", "847.0000", "846.0000", "845.0000", "844.0000"], + ["214.00", "213.50", "213.00", "212.50", "212.00"], ) @unittest.skip("Dont want to fix this, is about the code in realtime") From 4d89436f107c8950eb707b00b9c730e0ee40bd86 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 15/18] Revert "Update realtime mock data" This reverts commit 3848cbc435d6fcc67012b19643be17519e684c55. --- twstock/mock/__init__.py | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/twstock/mock/__init__.py b/twstock/mock/__init__.py index fda0990..87dbce1 100644 --- a/twstock/mock/__init__.py +++ b/twstock/mock/__init__.py @@ -4,9 +4,57 @@ TSE_2330_TW = [ - """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "849.0000_850.0000_851.0000_852.0000_853.0000_", "b": "848.0000_847.0000_846.0000_845.0000_844.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827494000", "f": "170_372_260_647_514_", "ip": "0", "g": "6_50_126_107_255_", "mt": "692836", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:44:54", "u": "922.0000", "v": "23350", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 2300, "stockInfo": 1107969, "sessionStr": "UserSession", "sysTime": "10:45:02", "showChart": false, "sessionFromTime": 1715827477731, "sessionLatestTime": 1715827477731}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 41360}""", - """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "848.0000_849.0000_850.0000_851.0000_852.0000_", "b": "847.0000_846.0000_845.0000_844.0000_843.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827560000", "f": "53_157_370_261_945_", "ip": "0", "g": "42_124_116_271_187_", "mt": "826330", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:46:00", "u": "922.0000", "v": "23384", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 762, "stockInfo": 270448, "sessionStr": "UserSession", "sysTime": "10:46:02", "showChart": false, "sessionFromTime": 1715827446503, "sessionLatestTime": 1715827446503}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 17846}""", - """{"msgArray": [{"tv": "-", "ps": "-", "pz": "-", "bp": "0", "a": "848.0000_849.0000_850.0000_851.0000_852.0000_", "b": "847.0000_846.0000_845.0000_844.0000_843.0000_", "c": "2330", "d": "20240516", "ch": "2330.tw", "tlong": "1715827579000", "f": "64_157_371_261_947_", "ip": "0", "g": "40_124_118_270_185_", "mt": "655374", "h": "856.0000", "i": "24", "it": "12", "l": "844.0000", "n": "\\u53f0\\u7a4d\\u96fb", "o": "852.0000", "p": "0", "ex": "tse", "s": "-", "t": "10:46:19", "u": "922.0000", "v": "23388", "w": "756.0000", "nf": "\\u53f0\\u7063\\u7a4d\\u9ad4\\u96fb\\u8def\\u88fd\\u9020\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8", "y": "839.0000", "z": "-", "ts": "0"}], "referer": "", "userDelay": 5000, "rtcode": "0000", "queryTime": {"sysDate": "20240516", "stockInfoItem": 2216, "stockInfo": 506844, "sessionStr": "UserSession", "sysTime": "10:46:25", "showChart": false, "sessionFromTime": -1, "sessionLatestTime": -1}, "rtmessage": "OK", "exKey": "if_tse_2330.tw_zh-tw.null", "cachedAlive": 21231}""", + """ +{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999778918", "tk1": +"2330.tw_tse_20170724_B_9999777950", "tlong": "1500860849000", "f": +"853_1193_972_1209_817_", "ex": "tse", "g": "1221_1530_817_1038_1193_", "d": +"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": +"2330", "mt": "264564", "a": "214.50_215.00_215.50_216.00_216.50_", "n": +"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", +"i": "24", "w": "193.00", "v": "5094", "u": "235.00", "t": "09:47:29", "s": +"1", "pz": "213.50", "tv": "1", "p": "0", "nf": +"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", +"ch": "2330.tw", +"z": "214.50", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": +"OK", "referer": "", "queryTime": {"sysTime": "09:47:30", "sessionLatestTime": +-1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", +"sessionFromTime": -1, "stockInfoItem": 2065, "showChart": false, +"sessionStr": "UserSession", "stockInfo": 204322}, "rtcode": "0000"} +""", + """ +{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999766224", "tk1": +"2330.tw_tse_20170724_B_9999765954", "tlong": "1500861105000", "f": +"1059_1079_1014_1229_907_", "ex": "tse", "g": "1455_1598_797_1019_1134_", "d": +"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": +"2330", "mt": "778472", "a": "214.50_215.00_215.50_216.00_216.50_", "n": +"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", +"i": "24", "w": "193.00", "v": "5217", "u": "235.00", "t": "09:51:45", "s": +"0", "pz": "213.50", "tv": "1", "p": "0", "nf": +"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", +"ch": "2330.tw", +"z": "214.50", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": +"OK", "referer": "", "queryTime": {"sysTime": "09:51:48", "sessionLatestTime": +-1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", +"sessionFromTime": -1, "stockInfoItem": 2055, "showChart": false, +"sessionStr": "UserSession", "stockInfo": 130895}, "rtcode": "0000"} +""", + """ +{"msgArray": [{"ts": "0", "tk0": "2330.tw_tse_20170724_B_9999760446", "tk1": +"2330.tw_tse_20170724_B_9999759382", "tlong": "1500861243000", "f": +"1034_1028_1009_1253_933_", "ex": "tse", "g": "1466_1625_798_987_1117_", "d": +"20170724", "it": "12", "b": "214.00_213.50_213.00_212.50_212.00_", "c": +"2330", "mt": "962863", "a": "214.50_215.00_215.50_216.00_216.50_", "n": +"\u53f0\u7a4d\u96fb", "o": "213.50", "l": "213.00", "h": "214.50", "ip": "0", +"i": "24", "w": "193.00", "v": "5268", "u": "235.00", "t": "09:54:03", "s": +"0", "pz": "213.50", "tv": "3", "p": "0", "nf": +"\u53f0\u7063\u7a4d\u9ad4\u96fb\u8def\u88fd\u9020\u80a1\u4efd\u6709\u9650\u516c\u53f8", +"ch": "2330.tw", +"z": "214.00", "y": "214.00", "ps": "1323"}], "userDelay": 5000, "rtmessage": +"OK", "referer": "", "queryTime": {"sysTime": "09:54:10", "sessionLatestTime": +-1, "sysDate": "20170724", "sessionKey": "tse_2330.tw_20170724|", +"sessionFromTime": -1, "stockInfoItem": 1602, "showChart": false, +"sessionStr": "UserSession", "stockInfo": 119518}, "rtcode": "0000"} +""", ] From 67bb26049e0e4a708b158ac09877759f8c1e3ade Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 16/18] Revert "Remove appveyor CI" This reverts commit e6fd8dc001163eef31b0630f30ae8e4afd59b616. --- appveyor.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..b4cd2cd --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,28 @@ +environment: + global: + FLIT_ROOT: C:\projects\flit + matrix: + - PYTHON: 'C:\Python34' + - PYTHON: 'C:\Python35' + - PYTHON: 'C:\Python36' + - PYTHON: 'C:\Python36-x64' + PYTHON_VERSION: '3.6.2' + PYTHON_ARCH: '64' + +branches: + only: + - master + +init: + - echo %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% + +install: + - 'set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%' + - 'python -m pip install -U pip' + - 'python -m pip install pipenv' + +build_script: + - 'python -m pipenv install --dev' + +test_script: + - 'python -m pipenv run coverage run --source=twstock -m unittest' From abe6e88f73e4b62f1b124a65aff85b6ac5810ccc Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 17/18] Revert "Update example year month" This reverts commit 52beb157f899260cc62b8ebe0275106af70e7c77. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a369ee..9f0c35e 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ ma_p_cont = stock.continuous(ma_p) # 計算五日均價持續天 ma_br = stock.ma_bias_ratio(5, 10) # 計算五日、十日乖離值 ``` -擷取自 2024 年 3 月至今之資料 +擷取自 2015 年 1 月至今之資料 ```python stock = Stock('2330') -stock.fetch_from(2024, 3) +stock.fetch_from(2015, 1) ``` 基本資料之使用 From c1a5ddba3bb7a9db8edb1d22e57637674e5e48c7 Mon Sep 17 00:00:00 2001 From: Louie Lu Date: Wed, 15 May 2024 23:28:54 -0400 Subject: [PATCH 18/18] Revert "Update copyright year" This reverts commit 1975deee096172ef23ab9b713d452bb64e322337. --- LICENSE | 2 +- docs/conf.py | 2 +- docs/license.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index c16ad9c..dacee4f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017-2024 Louie Lu +Copyright (c) 2017-2019 Louie Lu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/conf.py b/docs/conf.py index 77cb16c..1484d4f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ # General information about the project. project = "twstock" -copyright = "2017-2024, Louie Lu" +copyright = "2017, Louie Lu" author = "Louie Lu" # The version info for the project you're documenting, acts as replacement for diff --git a/docs/license.rst b/docs/license.rst index 13c2a48..4107d06 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -1,7 +1,7 @@ LICENSE --------------------- -Copyright (c) 2017-2024 Louie Lu +Copyright (c) 2017-2019 Louie Lu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal