Skip to content

Commit 8a0956e

Browse files
author
方佳
committed
Merge branch 'main_merge_20260613' into 'main'
feat: Add MY/UK mcp functions See merge request webull/webull-openapi-mcp!6
2 parents 7295836 + 01245b5 commit 8a0956e

7 files changed

Lines changed: 186 additions & 82 deletions

File tree

‎.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, or th
23+
# Region ID: us, hk, jp, sg, th, my, or uk
2424
# Default: us
2525
# WEBULL_REGION_ID=us
2626

‎README.md‎

Lines changed: 98 additions & 76 deletions
Large diffs are not rendered by default.

‎pyproject.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "webull-openapi-mcp"
7-
version = "1.1.2"
7+
version = "1.1.3"
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"
11-
requires-python = ">=3.10"
11+
requires-python = ">=3.10,<3.13"
1212
keywords = ["webull", "mcp", "openapi", "trading", "ai"]
1313
classifiers = [
1414
"Development Status :: 4 - Beta",
@@ -24,7 +24,7 @@ dependencies = [
2424
"fastmcp==3.0.2",
2525
"click",
2626
"python-dotenv",
27-
"webull-openapi-python-sdk==2.0.8",
27+
"webull-openapi-python-sdk==2.0.9",
2828
]
2929

3030
[project.urls]

‎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.1.2"
3+
__version__ = "1.1.3"

‎webull_openapi_mcp/formatters.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@
5151
"Trading involves risk; please make decisions carefully.\n\n"
5252
)
5353

54+
_DISCLAIMER_MY = (
55+
"⚠️ Disclaimer: "
56+
"The information provided by this tool is for reference only "
57+
"and does not constitute investment advice. "
58+
"Trading involves risk; please make decisions carefully.\n\n"
59+
)
60+
61+
_DISCLAIMER_UK = (
62+
"⚠️ Disclaimer: "
63+
"The information provided by this tool is for reference only "
64+
"and does not constitute investment advice. "
65+
"Trading involves risk; please make decisions carefully.\n\n"
66+
)
67+
5468
# Default (backward compatibility)
5569
DISCLAIMER = _DISCLAIMER_US
5670

@@ -70,6 +84,10 @@ def set_disclaimer_region(region_id: str) -> None:
7084
DISCLAIMER = _DISCLAIMER_SG
7185
elif _current_region == "th":
7286
DISCLAIMER = _DISCLAIMER_TH
87+
elif _current_region == "my":
88+
DISCLAIMER = _DISCLAIMER_MY
89+
elif _current_region == "uk":
90+
DISCLAIMER = _DISCLAIMER_UK
7391
else:
7492
DISCLAIMER = _DISCLAIMER_US
7593

‎webull_openapi_mcp/region_config.py‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,56 @@ class RegionConfig:
170170
)
171171

172172

173+
# =============================================================================
174+
# MY Region Configuration
175+
# =============================================================================
176+
MY_REGION_CONFIG = RegionConfig(
177+
region_id="my",
178+
supports_futures=False,
179+
supports_crypto=False,
180+
supports_event_contracts=False,
181+
supports_combo_orders=False,
182+
supports_option_strategies=False,
183+
supports_algo_orders=False,
184+
valid_order_types=frozenset({
185+
"MARKET", "LIMIT", "STOP_LOSS", "STOP_LOSS_LIMIT"
186+
}),
187+
valid_time_in_force=frozenset({"DAY", "GTC"}),
188+
valid_trading_sessions=frozenset({"NIGHT", "ALL", "CORE", "ALL_DAY"}),
189+
valid_combo_types=frozenset({"NORMAL"}),
190+
valid_option_strategies=frozenset({"SINGLE"}),
191+
valid_market_categories=frozenset({"US"}),
192+
valid_order_markets=frozenset({"US"}),
193+
valid_instrument_categories=frozenset({"US_STOCK", "US_ETF"}),
194+
supports_options=False,
195+
)
196+
197+
198+
# =============================================================================
199+
# UK Region Configuration
200+
# =============================================================================
201+
UK_REGION_CONFIG = RegionConfig(
202+
region_id="uk",
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+
)
221+
222+
173223
# =============================================================================
174224
# Region Configuration Registry
175225
# =============================================================================
@@ -179,6 +229,8 @@ class RegionConfig:
179229
"jp": JP_REGION_CONFIG,
180230
"sg": SG_REGION_CONFIG,
181231
"th": TH_REGION_CONFIG,
232+
"my": MY_REGION_CONFIG,
233+
"uk": UK_REGION_CONFIG,
182234
}
183235

184236
SUPPORTED_REGIONS: frozenset[str] = frozenset(REGION_CONFIGS.keys())

‎webull_openapi_mcp/sdk_client.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
_2FA_GUIDE_LINKS: dict[str, str] = {
2121
"hk": "https://developer.webull.hk/apis/docs/authentication/token",
2222
"jp": "https://developer.webull.co.jp/apis/docs/authentication/token",
23+
"my": "https://developer.webull.com.my/apis/docs/authentication/token",
2324
"sg": "https://developer.webull.com.sg/apis/docs/authentication/token",
2425
"th": "https://developer.webull.co.th/apis/docs/authentication/token",
26+
"uk": "https://developer.webull-uk.com/apis/docs/authentication/token",
2527
"us": "https://developer.webull.com/apis/docs/authentication/token",
2628
}
2729

@@ -134,7 +136,7 @@ def __init__(self, region_id: str, environment: str) -> None:
134136
# based on each request's api_type - no add_endpoint() calls needed.
135137
UAT_ENDPOINTS: dict = {
136138
"default_region": "us",
137-
"regions": ["us", "hk", "jp", "sg", "th"],
139+
"regions": ["us", "hk", "jp", "sg", "th", "my", "uk"],
138140
"region_mapping": {
139141
"us": {
140142
"api": "us-openapi-alb.uat.webullbroker.com",
@@ -161,6 +163,16 @@ def __init__(self, region_id: str, environment: str) -> None:
161163
"quotes-api": "data-api.uat.webullbroker.com",
162164
"events-api": "th-events-api.uat.webullbroker.com",
163165
},
166+
"my": {
167+
"api": "my-api.uat.webullbroker.com",
168+
"quotes-api": "data-api.uat.webullbroker.com",
169+
"events-api": "my-events-api.uat.webullbroker.com",
170+
},
171+
"uk": {
172+
"api": "uk-api.uat.webullbroker.com",
173+
"quotes-api": "data-api.uat.webullbroker.com",
174+
"events-api": "uk-events-api.uat.webullbroker.com",
175+
},
164176
},
165177
}
166178

0 commit comments

Comments
 (0)