Skip to content

Commit edc6679

Browse files
author
方佳
committed
Merge branch 'main_merge_261017' into 'main'
feat:th mcp open See merge request webull/webull-openapi-mcp!23
2 parents 95598cd + 93dbab9 commit edc6679

11 files changed

Lines changed: 59 additions & 14 deletions

‎.env.example‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ WEBULL_APP_SECRET=
2020
# Set to 'prod' for live trading (use with caution)
2121
# WEBULL_ENVIRONMENT=uat
2222

23-
# Region ID: us, hk, jp, sg, my, uk, mx, br, or za
23+
# Region ID: us, hk, jp, sg, th, my, uk, mx, br, or za
2424
# Default: us
2525
# WEBULL_REGION_ID=us
2626

‎mcpb/build_manifest.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def build_manifest(
194194
"region_id": {
195195
"type": "string",
196196
"title": "Region",
197-
"description": "Webull region: us, hk, jp, sg, my, uk, mx, br, or za.",
197+
"description": "Webull region: us, hk, jp, sg, th, my, uk, mx, br, or za.",
198198
"default": "us",
199199
"required": True,
200200
},

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "webull-openapi-mcp"
7-
version = "1.2.4"
7+
version = "1.2.5"
88
description = "MCP Server for Webull OpenAPI - enables AI assistants to securely access Webull trading and market data"
99
readme = "README.md"
1010
license = "Apache-2.0"

‎server.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "io.github.webull-inc/webull-openapi-mcp",
44
"title": "Webull OpenAPI",
55
"description": "MCP server for Webull OpenAPI: trading and market data access for AI assistants",
6-
"version": "1.2.4",
6+
"version": "1.2.5",
77
"repository": {
88
"url": "https://github.com/webull-inc/webull-openapi-mcp",
99
"source": "github"
@@ -13,7 +13,7 @@
1313
"registryType": "pypi",
1414
"registryBaseUrl": "https://pypi.org",
1515
"identifier": "webull-openapi-mcp",
16-
"version": "1.2.4",
16+
"version": "1.2.5",
1717
"runtimeHint": "uvx",
1818
"transport": {
1919
"type": "stdio"

‎tests/test_fundamental_screener_registration.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ def test_new_tools_registered_for_supported_regions(region):
199199
assert not missing, f"{region} missing: {missing}"
200200

201201

202-
@pytest.mark.parametrize("region", ["sg", "my", "uk", "mx", "br"])
202+
@pytest.mark.parametrize("region", ["sg", "th", "my", "uk", "mx", "br"])
203203
def test_new_tools_absent_for_unsupported_regions(region):
204204
names = _build_server_tools(region)
205205
present = [t for t in EXPECTED_TOOLS if t in names]
206206
assert present, f"{region} should not expose: {present}"
207207

208208

209-
@pytest.mark.parametrize("region", ["us", "hk", "jp", "sg", "my", "uk", "mx", "br"])
209+
@pytest.mark.parametrize("region", ["us", "hk", "jp", "sg", "th", "my", "uk", "mx", "br"])
210210
def test_legacy_tools_available_in_all_regions(region):
211211
names = _build_server_tools(region)
212212
missing = [t for t in LEGACY_TOOLS if t not in names]

‎tests/test_sdk_client.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def test_default_region_is_us(self):
2727
assert UAT_ENDPOINTS["default_region"] == "us"
2828

2929
def test_regions_list(self):
30-
assert set(UAT_ENDPOINTS["regions"]) == {"us", "hk", "jp", "sg", "my", "uk", "mx", "br", "za"}
30+
assert set(UAT_ENDPOINTS["regions"]) == {"us", "hk", "jp", "sg", "th", "my", "uk", "mx", "br", "za"}
3131

3232
def test_each_region_has_all_api_types(self):
33-
for region in ("us", "hk", "jp", "sg", "my", "uk", "mx", "br", "za"):
33+
for region in ("us", "hk", "jp", "sg", "th", "my", "uk", "mx", "br", "za"):
3434
mapping = UAT_ENDPOINTS["region_mapping"][region]
3535
assert "api" in mapping
3636
assert "quotes-api" in mapping

‎webull_openapi_mcp/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Webull OpenAPI MCP Server - AI assistant integration for Webull OpenAPI."""
22

3-
__version__ = "1.2.4"
3+
__version__ = "1.2.5"

‎webull_openapi_mcp/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _build_env_content(app_key: str, app_secret: str, environment: str) -> str:
152152
# API environment: uat or prod (default: uat)
153153
WEBULL_ENVIRONMENT={environment}
154154
155-
# Optional: Region ID (default: us). Supported: us, hk, jp, sg, my, uk, mx, br, za
155+
# Optional: Region ID (default: us). Supported: us, hk, jp, sg, th, my, uk, mx, br, za
156156
# WEBULL_REGION_ID=us
157157
158158
# Optional: Risk control parameters

‎webull_openapi_mcp/formatters.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ def format_decimal(value: float | int) -> str:
5555
"Trading involves risk; please make decisions carefully.\n\n"
5656
)
5757

58+
_DISCLAIMER_TH = (
59+
"⚠️ Disclaimer: "
60+
"The information provided by this tool is for reference only "
61+
"and does not constitute investment advice. "
62+
"Trading involves risk; please make decisions carefully.\n\n"
63+
)
64+
5865
_DISCLAIMER_MY = (
5966
"⚠️ Disclaimer: "
6067
"The information provided by this tool is for reference only "
@@ -86,6 +93,8 @@ def set_disclaimer_region(region_id: str) -> None:
8693
DISCLAIMER = _DISCLAIMER_JP
8794
elif _current_region == "sg":
8895
DISCLAIMER = _DISCLAIMER_SG
96+
elif _current_region == "th":
97+
DISCLAIMER = _DISCLAIMER_TH
8998
elif _current_region == "my":
9099
DISCLAIMER = _DISCLAIMER_MY
91100
elif _current_region == "uk":

‎webull_openapi_mcp/region_config.py‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Region-specific configuration for Webull MCP Server.
22
3-
Defines region configurations for US, HK, JP, SG, MY, UK, MX, BR, and ZA markets with:
3+
Defines region configurations for US, HK, JP, SG, TH, MY, UK, MX, BR, and ZA markets with:
44
- Feature flags (futures, crypto, event contracts, etc.)
55
- Valid enum sets for order types, time-in-force, trading sessions, etc.
66
@@ -195,6 +195,35 @@ def __post_init__(self) -> None:
195195
)
196196

197197

198+
# =============================================================================
199+
# TH Region Configuration
200+
# =============================================================================
201+
TH_REGION_CONFIG = RegionConfig(
202+
region_id="th",
203+
supports_futures=False,
204+
supports_crypto=False,
205+
supports_event_contracts=False,
206+
supports_combo_orders=False,
207+
supports_option_strategies=False,
208+
supports_algo_orders=False,
209+
valid_order_types=frozenset({
210+
"MARKET", "LIMIT", "STOP_LOSS", "STOP_LOSS_LIMIT"
211+
}),
212+
valid_time_in_force=frozenset({"DAY", "GTC"}),
213+
valid_trading_sessions=frozenset({"NIGHT", "ALL", "CORE", "ALL_DAY"}),
214+
valid_combo_types=frozenset({"NORMAL"}),
215+
valid_option_strategies=frozenset({"SINGLE"}),
216+
valid_market_categories=frozenset({"US"}),
217+
valid_order_markets=frozenset({"US"}),
218+
valid_instrument_categories=frozenset({"US_STOCK", "US_ETF"}),
219+
supports_options=False,
220+
supports_fundamentals=True,
221+
asset_type_account_classes={
222+
"stock": frozenset({"INDIVIDUAL_CASH"}),
223+
},
224+
)
225+
226+
198227
# =============================================================================
199228
# MY Region Configuration
200229
# =============================================================================
@@ -406,12 +435,13 @@ def __post_init__(self) -> None:
406435
"hk": HK_REGION_CONFIG,
407436
"jp": JP_REGION_CONFIG,
408437
"sg": SG_REGION_CONFIG,
438+
"th": TH_REGION_CONFIG,
409439
"my": MY_REGION_CONFIG,
410440
"uk": UK_REGION_CONFIG,
411441
"mx": MX_REGION_CONFIG,
412442
"br": BR_REGION_CONFIG,
413443
"za": ZA_REGION_CONFIG,
414-
# Note: TH, EU, and AU are not supported yet due to compliance
444+
# Note: EU and AU are not supported yet due to compliance
415445
# requirements and are intentionally not registered, so selecting these
416446
# regions raises UnsupportedRegionError. Their RegionConfig objects are
417447
# kept defined above for quick re-enablement once compliance clears.

0 commit comments

Comments
 (0)