settfex 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. settfex-0.1.0/.gitignore +203 -0
  2. settfex-0.1.0/.python-version +1 -0
  3. settfex-0.1.0/CHANGELOG.md +73 -0
  4. settfex-0.1.0/LICENSE +21 -0
  5. settfex-0.1.0/MANIFEST.in +31 -0
  6. settfex-0.1.0/PKG-INFO +597 -0
  7. settfex-0.1.0/README.md +558 -0
  8. settfex-0.1.0/docs/guide/PYTHON_LIBRARY_BEST_PRACTICES.md +290 -0
  9. settfex-0.1.0/docs/index.md +3 -0
  10. settfex-0.1.0/docs/settfex/services/set/API_PROTECTION_NOTE.md +128 -0
  11. settfex-0.1.0/docs/settfex/services/set/board_of_director.md +403 -0
  12. settfex-0.1.0/docs/settfex/services/set/corporate_action.md +546 -0
  13. settfex-0.1.0/docs/settfex/services/set/financial.md +586 -0
  14. settfex-0.1.0/docs/settfex/services/set/highlight_data.md +629 -0
  15. settfex-0.1.0/docs/settfex/services/set/list.md +691 -0
  16. settfex-0.1.0/docs/settfex/services/set/nvdr_holder.md +409 -0
  17. settfex-0.1.0/docs/settfex/services/set/price_performance.md +520 -0
  18. settfex-0.1.0/docs/settfex/services/set/profile_company.md +564 -0
  19. settfex-0.1.0/docs/settfex/services/set/profile_stock.md +450 -0
  20. settfex-0.1.0/docs/settfex/services/set/shareholder.md +404 -0
  21. settfex-0.1.0/docs/settfex/services/set/trading_stat.md +529 -0
  22. settfex-0.1.0/docs/settfex/services/tfex/list.md +497 -0
  23. settfex-0.1.0/docs/settfex/services/tfex/trading_statistics.md +484 -0
  24. settfex-0.1.0/docs/settfex/utils/data_fetcher.md +641 -0
  25. settfex-0.1.0/docs/settfex/utils/session_caching.md +476 -0
  26. settfex-0.1.0/docs/solution/FINDINGS.md +135 -0
  27. settfex-0.1.0/docs/solution/Performance Boost Session Caching Implementation.md +249 -0
  28. settfex-0.1.0/docs/solution/SESSION_CACHE_SUMMARY.md +370 -0
  29. settfex-0.1.0/docs/solution/SOLUTION_100_PERCENT.md +374 -0
  30. settfex-0.1.0/examples/README.md +276 -0
  31. settfex-0.1.0/examples/set/01_stock_list.ipynb +1185 -0
  32. settfex-0.1.0/examples/set/02_highlight_data.ipynb +918 -0
  33. settfex-0.1.0/examples/set/03_stock_profile.ipynb +414 -0
  34. settfex-0.1.0/examples/set/04_company_profile.ipynb +445 -0
  35. settfex-0.1.0/examples/set/05_corporate_action.ipynb +448 -0
  36. settfex-0.1.0/examples/set/06_shareholder.ipynb +339 -0
  37. settfex-0.1.0/examples/set/07_nvdr_holder.ipynb +280 -0
  38. settfex-0.1.0/examples/set/08_board_of_director.ipynb +295 -0
  39. settfex-0.1.0/examples/set/09_trading_statistics.ipynb +320 -0
  40. settfex-0.1.0/examples/set/10_price_performance.ipynb +359 -0
  41. settfex-0.1.0/examples/set/11_financial.ipynb +544 -0
  42. settfex-0.1.0/examples/set/README.md +388 -0
  43. settfex-0.1.0/examples/set/cpall_balance_sheet.csv +116 -0
  44. settfex-0.1.0/examples/set/market_dashboard_20251005_173221.csv +16 -0
  45. settfex-0.1.0/examples/set/market_dashboard_20251005_210737.csv +16 -0
  46. settfex-0.1.0/examples/set/market_dashboard_20251006_091440.csv +16 -0
  47. settfex-0.1.0/examples/set/thailand_banking_stocks.csv +1 -0
  48. settfex-0.1.0/examples/set/thailand_set_main_board.csv +2642 -0
  49. settfex-0.1.0/examples/set/thailand_stock_universe.csv +3125 -0
  50. settfex-0.1.0/examples/tfex/01_series_list.ipynb +1280 -0
  51. settfex-0.1.0/examples/tfex/02_trading_statistics.ipynb +1641 -0
  52. settfex-0.1.0/pyproject.toml +118 -0
  53. settfex-0.1.0/settfex/__init__.py +63 -0
  54. settfex-0.1.0/settfex/py.typed +0 -0
  55. settfex-0.1.0/settfex/services/__init__.py +1 -0
  56. settfex-0.1.0/settfex/services/set/__init__.py +130 -0
  57. settfex-0.1.0/settfex/services/set/constants.py +19 -0
  58. settfex-0.1.0/settfex/services/set/list.py +207 -0
  59. settfex-0.1.0/settfex/services/set/stock/__init__.py +114 -0
  60. settfex-0.1.0/settfex/services/set/stock/board_of_director.py +240 -0
  61. settfex-0.1.0/settfex/services/set/stock/corporate_action.py +310 -0
  62. settfex-0.1.0/settfex/services/set/stock/financial/__init__.py +25 -0
  63. settfex-0.1.0/settfex/services/set/stock/financial/financial.py +442 -0
  64. settfex-0.1.0/settfex/services/set/stock/highlight_data.py +282 -0
  65. settfex-0.1.0/settfex/services/set/stock/nvdr_holder.py +264 -0
  66. settfex-0.1.0/settfex/services/set/stock/price_performance.py +290 -0
  67. settfex-0.1.0/settfex/services/set/stock/profile_company.py +326 -0
  68. settfex-0.1.0/settfex/services/set/stock/profile_stock.py +290 -0
  69. settfex-0.1.0/settfex/services/set/stock/shareholder.py +278 -0
  70. settfex-0.1.0/settfex/services/set/stock/stock.py +196 -0
  71. settfex-0.1.0/settfex/services/set/stock/trading_stat.py +279 -0
  72. settfex-0.1.0/settfex/services/set/stock/utils.py +78 -0
  73. settfex-0.1.0/settfex/services/tfex/__init__.py +34 -0
  74. settfex-0.1.0/settfex/services/tfex/constants.py +8 -0
  75. settfex-0.1.0/settfex/services/tfex/list.py +307 -0
  76. settfex-0.1.0/settfex/services/tfex/trading_statistics.py +243 -0
  77. settfex-0.1.0/settfex/utils/__init__.py +18 -0
  78. settfex-0.1.0/settfex/utils/data_fetcher.py +376 -0
  79. settfex-0.1.0/settfex/utils/http.py +214 -0
  80. settfex-0.1.0/settfex/utils/logging.py +95 -0
  81. settfex-0.1.0/settfex/utils/session_cache.py +265 -0
  82. settfex-0.1.0/settfex/utils/session_manager.py +493 -0
  83. settfex-0.1.0/tests/__init__.py +1 -0
  84. settfex-0.1.0/tests/conftest.py +1 -0
  85. settfex-0.1.0/tests/services/__init__.py +1 -0
  86. settfex-0.1.0/tests/services/set/__init__.py +1 -0
  87. settfex-0.1.0/tests/services/set/stock/financial/__init__.py +1 -0
  88. settfex-0.1.0/tests/services/set/stock/financial/test_financial.py +654 -0
  89. settfex-0.1.0/tests/services/set/test_board_of_director.py +476 -0
  90. settfex-0.1.0/tests/services/set/test_client.py +1 -0
  91. settfex-0.1.0/tests/services/set/test_corporate_action.py +447 -0
  92. settfex-0.1.0/tests/services/set/test_historical.py +1 -0
  93. settfex-0.1.0/tests/services/set/test_realtime.py +1 -0
  94. settfex-0.1.0/tests/services/set/test_shareholder.py +492 -0
  95. settfex-0.1.0/tests/services/tfex/__init__.py +1 -0
  96. settfex-0.1.0/tests/services/tfex/test_client.py +1 -0
  97. settfex-0.1.0/tests/services/tfex/test_historical.py +1 -0
  98. settfex-0.1.0/tests/services/tfex/test_realtime.py +1 -0
  99. settfex-0.1.0/tests/utils/__init__.py +1 -0
  100. settfex-0.1.0/tests/utils/test_data_fetcher.py +404 -0
  101. settfex-0.1.0/tests/utils/test_formatting.py +1 -0
  102. settfex-0.1.0/tests/utils/test_http.py +1 -0
  103. settfex-0.1.0/tests/utils/test_logging.py +1 -0
  104. settfex-0.1.0/tests/utils/test_validation.py +1 -0
  105. settfex-0.1.0/uv.lock +2661 -0
@@ -0,0 +1,203 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webaskets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Debug files
153
+ debug/
154
+
155
+ # Cython debug symbols
156
+ cython_debug/
157
+
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be added to the global gitignore or merged into this project gitignore. For a PyCharm
162
+ # project, it is recommended to comment out this entry to enable type hinting by default.
163
+ #.idea/
164
+
165
+ # VS Code
166
+ .vscode/
167
+
168
+ # Settrade API specific
169
+ debug/
170
+ *.log
171
+ logs/
172
+ .env.local
173
+ .env.production
174
+ .env.sandbox
175
+
176
+ # Trading data and backups
177
+ data/
178
+ backups/
179
+ *.db
180
+ *.sqlite
181
+
182
+ # OS specific
183
+ .DS_Store
184
+ .DS_Store?
185
+ ._*
186
+ .Spotlight-V100
187
+ .Trashes
188
+ ehthumbs.db
189
+ Thumbs.db
190
+
191
+ # Configuration Files (exclude actual configs, include only samples/defaults)
192
+ config/*.yaml
193
+ config/*.yml
194
+ !config/*.sample.yaml
195
+ !config/*.sample.yml
196
+ !config/*.default.yaml
197
+ !config/*.default.yml
198
+
199
+ # AI Assistant and Meta Files
200
+ CLAUDE.md
201
+ .claude/
202
+ .github/
203
+ scripts/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,73 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-10-06
9
+
10
+ ### 🎉 First Public Release
11
+
12
+ This is the initial public release of **settfex**, a Python library for fetching real-time and historical data from the Stock Exchange of Thailand (SET) and Thailand Futures Exchange (TFEX).
13
+
14
+ #### ✨ Features
15
+
16
+ ##### SET (Stock Exchange of Thailand) Services
17
+
18
+ - **Stock List Service** - Fetch complete list of all stocks on SET/mai with filtering capabilities
19
+ - **Stock Highlight Data Service** - Get key metrics including market cap, P/E, P/B, dividend yield
20
+ - **Stock Profile Service** - Access listing details, IPO data, foreign ownership limits
21
+ - **Company Profile Service** - Comprehensive company info with ESG ratings, governance scores
22
+ - **Corporate Action Service** - Track dividends, shareholder meetings, and corporate events
23
+ - **Shareholder Service** - Monitor major shareholders and ownership distribution
24
+ - **NVDR Holder Service** - Track Non-Voting Depository Receipt holders
25
+ - **Board of Directors Service** - Access board composition and management structure
26
+ - **Trading Statistics Service** - Historical trading performance across multiple periods
27
+ - **Price Performance Service** - Compare stock performance vs sector and market
28
+ - **Financial Service** - Balance sheet, income statement, and cash flow data
29
+
30
+ ##### TFEX (Thailand Futures Exchange) Services
31
+
32
+ - **TFEX Series List Service** - Complete list of futures and options series with filtering
33
+ - **TFEX Trading Statistics Service** - Settlement prices, margin requirements, days to maturity
34
+
35
+ ##### Core Infrastructure
36
+
37
+ - **AsyncDataFetcher** - High-performance async HTTP client with browser impersonation
38
+ - **Session Caching** - Intelligent session management for 25x performance boost
39
+ - **Thai/Unicode Support** - Full UTF-8 support for Thai characters
40
+ - **Type Safety** - Complete type hints and Pydantic validation throughout
41
+ - **Smart Logging** - Beautiful logs with loguru, configurable levels
42
+
43
+ #### 📚 Documentation
44
+
45
+ - Comprehensive service documentation for all 13 services
46
+ - 13 interactive Jupyter notebook examples (11 SET + 2 TFEX)
47
+ - Complete API reference with usage examples
48
+ - Session caching and performance optimization guides
49
+
50
+ #### 🚀 Performance
51
+
52
+ - First request: ~2 seconds (session warmup)
53
+ - Subsequent requests: ~100ms (25x faster with session caching)
54
+ - Dual-site support: Separate optimized sessions for SET and TFEX APIs
55
+
56
+ #### 🔧 Technical Highlights
57
+
58
+ - **Python 3.11+** - Modern async/await patterns
59
+ - **curl_cffi** - Browser impersonation for reliable API access
60
+ - **Pydantic v2** - Runtime validation and settings management
61
+ - **loguru** - Beautiful, powerful logging with rotation and compression
62
+ - **diskcache** - Fast, persistent session caching
63
+
64
+ #### 📦 Package Information
65
+
66
+ - **License**: MIT
67
+ - **Python Support**: 3.11, 3.12, 3.13
68
+ - **Async-First**: Full async/await support throughout
69
+ - **Type Hints**: 100% type coverage for IDE support
70
+
71
+ ---
72
+
73
+ For upgrade instructions and migration guides for future releases, see the documentation.
settfex-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 settfex contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Include essential metadata files only
2
+ include README.md
3
+ include LICENSE
4
+ include CHANGELOG.md
5
+
6
+ # Include type marker for IDE support
7
+ include settfex/py.typed
8
+
9
+ # Exclude everything else by default, only include what's necessary
10
+ prune tests
11
+ prune scripts
12
+ prune debug
13
+ prune docs
14
+ prune examples
15
+ prune .github
16
+ prune .claude
17
+
18
+ # Exclude development files
19
+ exclude .gitignore
20
+ exclude .python-version
21
+ exclude CLAUDE.md
22
+ exclude MANIFEST.in
23
+ exclude uv.lock
24
+
25
+ # Exclude build and cache artifacts
26
+ global-exclude __pycache__
27
+ global-exclude *.py[co]
28
+ global-exclude *.so
29
+ global-exclude *.dylib
30
+ global-exclude .DS_Store
31
+ global-exclude .git*