Skip to content

Commit 8e970db

Browse files
author
方佳
committed
Merge branch 'main_merge_0908' into 'main'
feat:Update pagination for some query APIs See merge request webull/webull-openapi-python-sdk!44
2 parents 97ef8eb + b0ce030 commit 8e970db

152 files changed

Lines changed: 1571 additions & 131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎samples/screener/screener_client.py‎

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
# Get most active stocks by turnover amount
9999
res = data_client.screener.get_most_active(
100100
category="US_STOCK",
101-
rank_type="TURNOVER",
102-
sort_by="TURNOVER",
101+
rank_type="RELATIVE_VOLUME_10D",
102+
sort_by="RELATIVE_VOLUME_10D",
103103
direction="DESC",
104104
page_size=10
105105
)
@@ -116,3 +116,56 @@
116116
)
117117
if res.status_code == 200:
118118
print('get_high_amplitude_stocks:', res.json())
119+
120+
# ------------------------------------------------------------------
121+
# New endpoints. These rankings are not paginated and return top 200.
122+
# ------------------------------------------------------------------
123+
124+
# Get top gainers for today (new endpoint, no pagination)
125+
res = data_client.screener.list_gainers_losers(
126+
rank_type="DAY_1",
127+
category="US_STOCK",
128+
sort_by="CHANGE_RATIO",
129+
direction="DESC"
130+
)
131+
if res.status_code == 200:
132+
print('list_gainers (day):', res.json())
133+
134+
# Get top losers for today (new endpoint, no pagination)
135+
res = data_client.screener.list_gainers_losers(
136+
rank_type="DAY_1",
137+
category="US_STOCK",
138+
sort_by="CHANGE_RATIO",
139+
direction="ASC"
140+
)
141+
if res.status_code == 200:
142+
print('list_losers (day):', res.json())
143+
144+
# Get most active stocks by volume (new endpoint, no pagination)
145+
res = data_client.screener.list_most_active(
146+
category="US_STOCK",
147+
rank_type="VOLUME",
148+
sort_by="VOLUME",
149+
direction="DESC"
150+
)
151+
if res.status_code == 200:
152+
print('list_most_active_by_volume:', res.json())
153+
154+
# Get high dividend rank list (new endpoint, no pagination)
155+
res = data_client.screener.list_high_dividend(
156+
category="US_STOCK",
157+
sort_by="YIELD",
158+
direction="DESC"
159+
)
160+
if res.status_code == 200:
161+
print('list_high_dividend:', res.json())
162+
163+
# Get 52 week new highs (new endpoint, no pagination)
164+
res = data_client.screener.list_52whl(
165+
category="US_STOCK",
166+
rank_type="NEW_HIGH",
167+
sort_by="CHANGE_RATIO_52W",
168+
direction="DESC"
169+
)
170+
if res.status_code == 200:
171+
print('list_52whl_new_high:', res.json())

‎tests/core/log/test_log.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_set_stream_logger(self):
3434
api_client.set_stream_logger(stream=sys.stdout, format_string=log_format)
3535
request = ApiRequest("/sign", protocol="http")
3636
request.add_query_param("k1", " zhong国=&")
37-
request.add_query_param("k2", "v2")
37+
request.add_query_param("k2", "v3")
3838
api_client.get_response(request)
3939

4040
def test_set_file_logger(self):
@@ -43,5 +43,5 @@ def test_set_file_logger(self):
4343
api_client.set_file_logger(path=log_file_path, format_string=log_format)
4444
request = ApiRequest("/sign", protocol="http")
4545
request.add_query_param("k1", " zhong国=&")
46-
request.add_query_param("k2", "v2")
46+
request.add_query_param("k2", "v3")
4747
api_client.get_response(request)

‎webull/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.19'
1+
__version__ = '3.0.0'

‎webull/core/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '2.0.17'
1+
__version__ = '3.0.0'
22

33
import logging
44

‎webull/core/http/initializer/config/bean/query_config_request.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838

3939
class GetConfigRequest(ApiRequest):
4040
def __init__(self):
41-
super().__init__("/openapi/config", version='v2', method="GET", query_params={})
41+
super().__init__("/openapi/config", version='v3', method="GET", query_params={})

‎webull/core/http/initializer/token/bean/check_token_request.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
class CheckTokenRequest(ApiRequest):
4040
def __init__(self):
41-
super().__init__("/openapi/auth/token/check", version='v2', method="POST", body_params={})
41+
super().__init__("/auth/tokens/check", version='v3', method="POST", body_params={})
4242

4343
def set_token(self, token):
4444
self.add_body_params("token", token)

‎webull/core/http/initializer/token/bean/create_token_request.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
class CreateTokenRequest(ApiRequest):
4040
def __init__(self):
41-
super().__init__("/openapi/auth/token/create", version='v2', method="POST", body_params={})
41+
super().__init__("/auth/tokens/create", version='v3', method="POST", body_params={})
4242

4343
def set_token(self, token):
4444
if token:

‎webull/core/http/initializer/token/bean/refresh_token_request.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
class RefreshTokenRequest(ApiRequest):
4040
def __init__(self):
41-
super().__init__("/openapi/auth/token/refresh", version='v2', method="POST", body_params={})
41+
super().__init__("/openapi/auth/token/refresh", version='v3', method="POST", body_params={})
4242

4343
def set_token(self, token):
4444
self.add_body_params("token", token)

‎webull/data/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# coding=utf-8
22

3-
__version__ = '2.0.17'
3+
__version__ = '3.0.0'

‎webull/data/quotes/fundamentals.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from webull.data.request.get_fund_holdings_request import GetFundHoldingsRequest
2828
from webull.data.request.get_fund_files_request import GetFundFilesRequest
2929
from webull.data.request.get_fund_dividends_request import GetFundDividendsRequest
30+
from webull.data.request.get_fund_dividends_request_v2 import GetFundDividendsRequestV2
3031
from webull.data.request.get_fund_brief_request import GetFundBriefRequest
3132
from webull.data.request.get_fund_allocation_request import GetFundAllocationRequest
3233
from webull.data.request.get_financials_indicators_request import GetFinancialsIndicatorsRequest
@@ -197,6 +198,9 @@ def get_fund_files(self, symbol, category=Category.US_STOCK.name):
197198

198199
def get_fund_dividends(self, symbol, category=Category.US_STOCK.name, page_index=None, page_size=None):
199200
"""
201+
.. deprecated::
202+
Use :meth:`list_fund_dividends` instead.
203+
200204
Query fund dividends for a security.
201205
202206
:param symbol: Security symbol, e.g. QQQ.
@@ -212,6 +216,21 @@ def get_fund_dividends(self, symbol, category=Category.US_STOCK.name, page_index
212216
response = self.client.get_response(request)
213217
return response
214218

219+
def list_fund_dividends(self, symbol, category=Category.US_STOCK.name, pagination_key=None):
220+
"""
221+
Query fund dividends for a security.
222+
223+
:param symbol: Security symbol, e.g. QQQ.
224+
:param category: Security type. Category values are as shown in the enum.
225+
:param pagination_key: Pagination key from the previous page response; not returned on the last page.
226+
"""
227+
request = GetFundDividendsRequestV2()
228+
request.set_symbol(symbol)
229+
request.set_category(category)
230+
request.set_pagination_key(pagination_key)
231+
response = self.client.get_response(request)
232+
return response
233+
215234
def get_fund_brief(self, symbol, category=Category.US_STOCK.name):
216235
"""
217236
Query fund brief information.

0 commit comments

Comments
 (0)