webull-openapi-python-sdk 2.0.11__py3-none-any.whl → 2.0.12__py3-none-any.whl
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.
- samples/__init__.py +1 -1
- samples/data/data_client.py +120 -0
- webull/__init__.py +1 -1
- webull/core/__init__.py +1 -1
- webull/data/__init__.py +1 -1
- webull/data/data_client.py +2 -0
- webull/data/quotes/fundamentals.py +335 -0
- webull/data/quotes/screener.py +88 -0
- webull/data/request/get_capital_flow_request.py +35 -0
- webull/data/request/get_dividend_calendar_request.py +31 -0
- webull/data/request/get_earnings_calendar_request.py +31 -0
- webull/data/request/get_financials_alert_request.py +31 -0
- webull/data/request/get_financials_balance_sheet_request.py +39 -0
- webull/data/request/get_financials_cashflow_request.py +39 -0
- webull/data/request/get_financials_income_request.py +39 -0
- webull/data/request/get_financials_indicators_request.py +39 -0
- webull/data/request/get_forecast_eps_request.py +31 -0
- webull/data/request/get_fund_allocation_request.py +31 -0
- webull/data/request/get_fund_brief_request.py +31 -0
- webull/data/request/get_fund_dividends_request.py +39 -0
- webull/data/request/get_fund_files_request.py +31 -0
- webull/data/request/get_fund_holdings_request.py +31 -0
- webull/data/request/get_fund_net_value_request.py +39 -0
- webull/data/request/get_fund_performance_request.py +31 -0
- webull/data/request/get_fund_rating_request.py +31 -0
- webull/data/request/get_fund_splits_request.py +31 -0
- webull/data/request/get_industry_comparison_request.py +35 -0
- webull/data/request/get_sec_filings_request.py +31 -0
- webull/data/request/screener/get_52whl_request.py +47 -0
- webull/data/request/screener/get_high_dividend_request.py +43 -0
- webull/data/request/screener/get_market_sectors_detail_request.py +51 -0
- webull/data/request/screener/get_market_sectors_request.py +47 -0
- webull/trade/__init__.py +1 -1
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/METADATA +1 -1
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/RECORD +39 -14
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/WHEEL +0 -0
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/licenses/LICENSE +0 -0
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/licenses/NOTICE +0 -0
- {webull_openapi_python_sdk-2.0.11.dist-info → webull_openapi_python_sdk-2.0.12.dist-info}/top_level.txt +0 -0
samples/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.0.
|
|
1
|
+
__version__ = '2.0.12'
|
samples/data/data_client.py
CHANGED
|
@@ -164,3 +164,123 @@ if __name__ == '__main__':
|
|
|
164
164
|
res = data_client.option_market_data.get_option_snapshot("AAPL260522C00300000", Category.US_OPTION.name)
|
|
165
165
|
if res.status_code == 200:
|
|
166
166
|
print('get_option_snapshot:', res.json())
|
|
167
|
+
|
|
168
|
+
# Fundamentals - Capital Flow
|
|
169
|
+
res = data_client.fundamentals.get_capital_flow("AAPL", Category.US_STOCK.name)
|
|
170
|
+
if res.status_code == 200:
|
|
171
|
+
print('get_capital_flow:', res.json())
|
|
172
|
+
|
|
173
|
+
# Fundamentals - Industry Comparison
|
|
174
|
+
res = data_client.fundamentals.get_industry_comparison("AAPL", Category.US_STOCK.name)
|
|
175
|
+
if res.status_code == 200:
|
|
176
|
+
print('get_industry_comparison:', res.json())
|
|
177
|
+
|
|
178
|
+
# Fundamentals - SEC Filings
|
|
179
|
+
res = data_client.fundamentals.get_sec_filings("AAPL", Category.US_STOCK.name)
|
|
180
|
+
if res.status_code == 200:
|
|
181
|
+
print('get_sec_filings:', res.json())
|
|
182
|
+
|
|
183
|
+
# Fundamentals - Earnings Calendar
|
|
184
|
+
res = data_client.fundamentals.get_earnings_calendar("AAPL", Category.US_STOCK.name)
|
|
185
|
+
if res.status_code == 200:
|
|
186
|
+
print('get_earnings_calendar:', res.json())
|
|
187
|
+
|
|
188
|
+
# Fundamentals - Dividend Calendar
|
|
189
|
+
res = data_client.fundamentals.get_dividend_calendar("TSLA", Category.US_STOCK.name)
|
|
190
|
+
if res.status_code == 200:
|
|
191
|
+
print('get_dividend_calendar:', res.json())
|
|
192
|
+
|
|
193
|
+
# Fundamentals - Fund Splits
|
|
194
|
+
res = data_client.fundamentals.get_fund_splits("QQQ", Category.US_STOCK.name)
|
|
195
|
+
if res.status_code == 200:
|
|
196
|
+
print('get_fund_splits:', res.json())
|
|
197
|
+
|
|
198
|
+
# Fundamentals - Fund Rating
|
|
199
|
+
res = data_client.fundamentals.get_fund_rating("QQQ", Category.US_STOCK.name)
|
|
200
|
+
if res.status_code == 200:
|
|
201
|
+
print('get_fund_rating:', res.json())
|
|
202
|
+
|
|
203
|
+
# Fundamentals - Fund Performance
|
|
204
|
+
res = data_client.fundamentals.get_fund_performance("QQQ", Category.US_STOCK.name)
|
|
205
|
+
if res.status_code == 200:
|
|
206
|
+
print('get_fund_performance:', res.json())
|
|
207
|
+
|
|
208
|
+
# Fundamentals - Fund Net Value
|
|
209
|
+
res = data_client.fundamentals.get_fund_net_value("QQQ", Category.US_STOCK.name)
|
|
210
|
+
if res.status_code == 200:
|
|
211
|
+
print('get_fund_net_value:', res.json())
|
|
212
|
+
|
|
213
|
+
# Fundamentals - Fund Holdings
|
|
214
|
+
res = data_client.fundamentals.get_fund_holdings("QQQ", Category.US_STOCK.name)
|
|
215
|
+
if res.status_code == 200:
|
|
216
|
+
print('get_fund_holdings:', res.json())
|
|
217
|
+
|
|
218
|
+
# Fundamentals - Fund Files
|
|
219
|
+
res = data_client.fundamentals.get_fund_files("QQQ", Category.US_STOCK.name)
|
|
220
|
+
if res.status_code == 200:
|
|
221
|
+
print('get_fund_files:', res.json())
|
|
222
|
+
|
|
223
|
+
# Fundamentals - Fund Dividends
|
|
224
|
+
res = data_client.fundamentals.get_fund_dividends("QQQ", Category.US_STOCK.name)
|
|
225
|
+
if res.status_code == 200:
|
|
226
|
+
print('get_fund_dividends:', res.json())
|
|
227
|
+
|
|
228
|
+
# Fundamentals - Fund Brief
|
|
229
|
+
res = data_client.fundamentals.get_fund_brief("QQQ", Category.US_STOCK.name)
|
|
230
|
+
if res.status_code == 200:
|
|
231
|
+
print('get_fund_brief:', res.json())
|
|
232
|
+
|
|
233
|
+
# Fundamentals - Fund Allocation
|
|
234
|
+
res = data_client.fundamentals.get_fund_allocation("QQQ", Category.US_STOCK.name)
|
|
235
|
+
if res.status_code == 200:
|
|
236
|
+
print('get_fund_allocation:', res.json())
|
|
237
|
+
|
|
238
|
+
# Fundamentals - Financials Indicators
|
|
239
|
+
res = data_client.fundamentals.get_financials_indicators("TSLA", Category.US_STOCK.name)
|
|
240
|
+
if res.status_code == 200:
|
|
241
|
+
print('get_financials_indicators:', res.json())
|
|
242
|
+
|
|
243
|
+
# Fundamentals - Financials Income
|
|
244
|
+
res = data_client.fundamentals.get_financials_income("TSLA", Category.US_STOCK.name)
|
|
245
|
+
if res.status_code == 200:
|
|
246
|
+
print('get_financials_income:', res.json())
|
|
247
|
+
|
|
248
|
+
# Fundamentals - Financials Cashflow
|
|
249
|
+
res = data_client.fundamentals.get_financials_cashflow("TSLA", Category.US_STOCK.name)
|
|
250
|
+
if res.status_code == 200:
|
|
251
|
+
print('get_financials_cashflow:', res.json())
|
|
252
|
+
|
|
253
|
+
# Fundamentals - Financials Balance Sheet
|
|
254
|
+
res = data_client.fundamentals.get_financials_balance_sheet("TSLA", Category.US_STOCK.name)
|
|
255
|
+
if res.status_code == 200:
|
|
256
|
+
print('get_financials_balance_sheet:', res.json())
|
|
257
|
+
|
|
258
|
+
# Fundamentals - Financials Alert
|
|
259
|
+
res = data_client.fundamentals.get_financials_alert("AAPL", Category.US_STOCK.name)
|
|
260
|
+
if res.status_code == 200:
|
|
261
|
+
print('get_financials_alert:', res.json())
|
|
262
|
+
|
|
263
|
+
# Fundamentals - Forecast EPS
|
|
264
|
+
res = data_client.fundamentals.get_forecast_eps("AAPL", Category.US_STOCK.name)
|
|
265
|
+
if res.status_code == 200:
|
|
266
|
+
print('get_forecast_eps:', res.json())
|
|
267
|
+
|
|
268
|
+
# Screener - Market Sectors
|
|
269
|
+
res = data_client.screener.get_market_sectors(Category.US_STOCK.name)
|
|
270
|
+
if res.status_code == 200:
|
|
271
|
+
print('get_market_sectors:', res.json())
|
|
272
|
+
|
|
273
|
+
# Screener - Market Sectors Detail
|
|
274
|
+
res = data_client.screener.get_market_sectors_detail("6391", Category.US_STOCK.name)
|
|
275
|
+
if res.status_code == 200:
|
|
276
|
+
print('get_market_sectors_detail:', res.json())
|
|
277
|
+
|
|
278
|
+
# Screener - High Dividend Rank
|
|
279
|
+
res = data_client.screener.get_high_dividend(Category.US_STOCK.name)
|
|
280
|
+
if res.status_code == 200:
|
|
281
|
+
print('get_high_dividend:', res.json())
|
|
282
|
+
|
|
283
|
+
# Screener - 52 Week High/Low
|
|
284
|
+
res = data_client.screener.get_52whl(Category.US_STOCK.name, rank_type="NEW_HIGH")
|
|
285
|
+
if res.status_code == 200:
|
|
286
|
+
print('get_52whl:', res.json())
|
webull/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.0.
|
|
1
|
+
__version__ = '2.0.12'
|
webull/core/__init__.py
CHANGED
webull/data/__init__.py
CHANGED
webull/data/data_client.py
CHANGED
|
@@ -24,6 +24,7 @@ from webull.data.quotes.futures_market_data import FuturesMarketData
|
|
|
24
24
|
from webull.data.quotes.instrument import Instrument
|
|
25
25
|
from webull.data.quotes.market_data import MarketData
|
|
26
26
|
from webull.data.quotes.option_market_data import OptionMarketData
|
|
27
|
+
from webull.data.quotes.fundamentals import Fundamentals
|
|
27
28
|
from webull.data.quotes.screener import Screener
|
|
28
29
|
from webull.data.quotes.watchlist import Watchlist
|
|
29
30
|
|
|
@@ -38,6 +39,7 @@ class DataClient:
|
|
|
38
39
|
self.futures_market_data = FuturesMarketData(api_client)
|
|
39
40
|
self.option_market_data = OptionMarketData(api_client)
|
|
40
41
|
self.event_market_data = EventMarketData(api_client)
|
|
42
|
+
self.fundamentals = Fundamentals(api_client)
|
|
41
43
|
self.screener = Screener(api_client)
|
|
42
44
|
self.watchlist = Watchlist(api_client)
|
|
43
45
|
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# Copyright 2022 Webull
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding=utf-8
|
|
16
|
+
|
|
17
|
+
from webull.data.common.category import Category
|
|
18
|
+
from webull.data.request.get_capital_flow_request import GetCapitalFlowRequest
|
|
19
|
+
from webull.data.request.get_industry_comparison_request import GetIndustryComparisonRequest
|
|
20
|
+
from webull.data.request.get_sec_filings_request import GetSecFilingsRequest
|
|
21
|
+
from webull.data.request.get_earnings_calendar_request import GetEarningsCalendarRequest
|
|
22
|
+
from webull.data.request.get_dividend_calendar_request import GetDividendCalendarRequest
|
|
23
|
+
from webull.data.request.get_fund_splits_request import GetFundSplitsRequest
|
|
24
|
+
from webull.data.request.get_fund_rating_request import GetFundRatingRequest
|
|
25
|
+
from webull.data.request.get_fund_performance_request import GetFundPerformanceRequest
|
|
26
|
+
from webull.data.request.get_fund_net_value_request import GetFundNetValueRequest
|
|
27
|
+
from webull.data.request.get_fund_holdings_request import GetFundHoldingsRequest
|
|
28
|
+
from webull.data.request.get_fund_files_request import GetFundFilesRequest
|
|
29
|
+
from webull.data.request.get_fund_dividends_request import GetFundDividendsRequest
|
|
30
|
+
from webull.data.request.get_fund_brief_request import GetFundBriefRequest
|
|
31
|
+
from webull.data.request.get_fund_allocation_request import GetFundAllocationRequest
|
|
32
|
+
from webull.data.request.get_financials_indicators_request import GetFinancialsIndicatorsRequest
|
|
33
|
+
from webull.data.request.get_financials_income_request import GetFinancialsIncomeRequest
|
|
34
|
+
from webull.data.request.get_financials_cashflow_request import GetFinancialsCashflowRequest
|
|
35
|
+
from webull.data.request.get_financials_balance_sheet_request import GetFinancialsBalanceSheetRequest
|
|
36
|
+
from webull.data.request.get_financials_alert_request import GetFinancialsAlertRequest
|
|
37
|
+
from webull.data.request.get_forecast_eps_request import GetForecastEpsRequest
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Fundamentals:
|
|
41
|
+
def __init__(self, api_client):
|
|
42
|
+
self.client = api_client
|
|
43
|
+
|
|
44
|
+
def get_capital_flow(self, symbol, category=Category.US_STOCK.name, count=None):
|
|
45
|
+
"""
|
|
46
|
+
Query the capital flow distribution for a stock.
|
|
47
|
+
|
|
48
|
+
:param symbol: Security symbol, e.g. AAPL, TSLA.
|
|
49
|
+
:param category: Security type. Supported: US_STOCK, HK_STOCK, CN_STOCK, JP_STOCK.
|
|
50
|
+
:param count: Number of distribution records (default 5), range 1-5.
|
|
51
|
+
"""
|
|
52
|
+
request = GetCapitalFlowRequest()
|
|
53
|
+
request.set_symbol(symbol)
|
|
54
|
+
request.set_category(category)
|
|
55
|
+
request.set_count(count)
|
|
56
|
+
response = self.client.get_response(request)
|
|
57
|
+
return response
|
|
58
|
+
|
|
59
|
+
def get_industry_comparison(self, symbol, category=Category.US_STOCK.name, sort_by=None):
|
|
60
|
+
"""
|
|
61
|
+
Query industry comparison data for a stock. Shows up to 20 stocks in the same industry, including the target stock.
|
|
62
|
+
|
|
63
|
+
:param symbol: Security symbol, e.g. AAPL, TSLA.
|
|
64
|
+
:param category: Security type. Supported: US_STOCK, HK_STOCK, CN_STOCK.
|
|
65
|
+
:param sort_by: Sort by a certain type. Default: EPS_TTM. Options: EPS_TTM, NAPS, DPS_TTM, ROE, DEBT_TO_ASSETS, NET_MARGIN, DIV_YIELD_TTM, PE_TTM, PB_RATIO.
|
|
66
|
+
"""
|
|
67
|
+
request = GetIndustryComparisonRequest()
|
|
68
|
+
request.set_symbol(symbol)
|
|
69
|
+
request.set_category(category)
|
|
70
|
+
request.set_sort_by(sort_by)
|
|
71
|
+
response = self.client.get_response(request)
|
|
72
|
+
return response
|
|
73
|
+
|
|
74
|
+
def get_sec_filings(self, symbol, category=Category.US_STOCK.name):
|
|
75
|
+
"""
|
|
76
|
+
Query SEC filings for a stock. Only supports US stocks. Returns data within the last 3 years.
|
|
77
|
+
|
|
78
|
+
:param symbol: Security symbol, e.g. AAPL, TSLA.
|
|
79
|
+
:param category: Security type. Only supports US_STOCK.
|
|
80
|
+
"""
|
|
81
|
+
request = GetSecFilingsRequest()
|
|
82
|
+
request.set_symbol(symbol)
|
|
83
|
+
request.set_category(category)
|
|
84
|
+
response = self.client.get_response(request)
|
|
85
|
+
return response
|
|
86
|
+
|
|
87
|
+
def get_earnings_calendar(self, symbol, category=Category.US_STOCK.name):
|
|
88
|
+
"""
|
|
89
|
+
Query earnings calendar for a stock. Returns earnings reports within half a year before and after the current date.
|
|
90
|
+
Sorted by date in ascending order (oldest to newest).
|
|
91
|
+
Use eps_actual to distinguish published reports (has eps_actual value) from upcoming ones (no eps_actual value).
|
|
92
|
+
|
|
93
|
+
:param symbol: Security symbol, e.g. AAPL, TSLA.
|
|
94
|
+
:param category: Security type. Supported: US_STOCK, HK_STOCK, CN_STOCK, JP_STOCK.
|
|
95
|
+
"""
|
|
96
|
+
request = GetEarningsCalendarRequest()
|
|
97
|
+
request.set_symbol(symbol)
|
|
98
|
+
request.set_category(category)
|
|
99
|
+
response = self.client.get_response(request)
|
|
100
|
+
return response
|
|
101
|
+
|
|
102
|
+
def get_dividend_calendar(self, symbol, category=Category.US_STOCK.name):
|
|
103
|
+
"""
|
|
104
|
+
Query dividend calendar for a stock. Returns dividends within half a year before and after the current date.
|
|
105
|
+
Sorted by date in ascending order (oldest to newest).
|
|
106
|
+
|
|
107
|
+
:param symbol: Security symbol, e.g. AAPL, TSLA.
|
|
108
|
+
:param category: Security type. Supported: US_STOCK, HK_STOCK, CN_STOCK, JP_STOCK.
|
|
109
|
+
"""
|
|
110
|
+
request = GetDividendCalendarRequest()
|
|
111
|
+
request.set_symbol(symbol)
|
|
112
|
+
request.set_category(category)
|
|
113
|
+
response = self.client.get_response(request)
|
|
114
|
+
return response
|
|
115
|
+
|
|
116
|
+
def get_fund_splits(self, symbol, category=Category.US_STOCK.name):
|
|
117
|
+
"""
|
|
118
|
+
Query fund splits for a stock.
|
|
119
|
+
|
|
120
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
121
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
122
|
+
"""
|
|
123
|
+
request = GetFundSplitsRequest()
|
|
124
|
+
request.set_symbol(symbol)
|
|
125
|
+
request.set_category(category)
|
|
126
|
+
response = self.client.get_response(request)
|
|
127
|
+
return response
|
|
128
|
+
|
|
129
|
+
def get_fund_rating(self, symbol, category=Category.US_STOCK.name):
|
|
130
|
+
"""
|
|
131
|
+
Query fund rating for a security.
|
|
132
|
+
|
|
133
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
134
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
135
|
+
"""
|
|
136
|
+
request = GetFundRatingRequest()
|
|
137
|
+
request.set_symbol(symbol)
|
|
138
|
+
request.set_category(category)
|
|
139
|
+
response = self.client.get_response(request)
|
|
140
|
+
return response
|
|
141
|
+
|
|
142
|
+
def get_fund_performance(self, symbol, category=Category.US_STOCK.name):
|
|
143
|
+
"""
|
|
144
|
+
Query fund performance for a security.
|
|
145
|
+
|
|
146
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
147
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
148
|
+
"""
|
|
149
|
+
request = GetFundPerformanceRequest()
|
|
150
|
+
request.set_symbol(symbol)
|
|
151
|
+
request.set_category(category)
|
|
152
|
+
response = self.client.get_response(request)
|
|
153
|
+
return response
|
|
154
|
+
|
|
155
|
+
def get_fund_net_value(self, symbol, category=Category.US_STOCK.name, last_date=None, count=None):
|
|
156
|
+
"""
|
|
157
|
+
Query fund net value for a security.
|
|
158
|
+
|
|
159
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
160
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
161
|
+
:param last_date: Last query date, e.g. 2026-04-01.
|
|
162
|
+
:param count: The number of each query, default 5, maximum 20.
|
|
163
|
+
"""
|
|
164
|
+
request = GetFundNetValueRequest()
|
|
165
|
+
request.set_symbol(symbol)
|
|
166
|
+
request.set_category(category)
|
|
167
|
+
request.set_last_date(last_date)
|
|
168
|
+
request.set_count(count)
|
|
169
|
+
response = self.client.get_response(request)
|
|
170
|
+
return response
|
|
171
|
+
|
|
172
|
+
def get_fund_holdings(self, symbol, category=Category.US_STOCK.name):
|
|
173
|
+
"""
|
|
174
|
+
Query fund top 10 holdings.
|
|
175
|
+
|
|
176
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
177
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
178
|
+
"""
|
|
179
|
+
request = GetFundHoldingsRequest()
|
|
180
|
+
request.set_symbol(symbol)
|
|
181
|
+
request.set_category(category)
|
|
182
|
+
response = self.client.get_response(request)
|
|
183
|
+
return response
|
|
184
|
+
|
|
185
|
+
def get_fund_files(self, symbol, category=Category.US_STOCK.name):
|
|
186
|
+
"""
|
|
187
|
+
Query fund files for a security.
|
|
188
|
+
|
|
189
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
190
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
191
|
+
"""
|
|
192
|
+
request = GetFundFilesRequest()
|
|
193
|
+
request.set_symbol(symbol)
|
|
194
|
+
request.set_category(category)
|
|
195
|
+
response = self.client.get_response(request)
|
|
196
|
+
return response
|
|
197
|
+
|
|
198
|
+
def get_fund_dividends(self, symbol, category=Category.US_STOCK.name, page_index=None, page_size=None):
|
|
199
|
+
"""
|
|
200
|
+
Query fund dividends for a security.
|
|
201
|
+
|
|
202
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
203
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
204
|
+
:param page_index: Page index, default 1. If not passed, the first page will be searched by default.
|
|
205
|
+
:param page_size: Number of entries per page, default 10, maximum 20.
|
|
206
|
+
"""
|
|
207
|
+
request = GetFundDividendsRequest()
|
|
208
|
+
request.set_symbol(symbol)
|
|
209
|
+
request.set_category(category)
|
|
210
|
+
request.set_page_index(page_index)
|
|
211
|
+
request.set_page_size(page_size)
|
|
212
|
+
response = self.client.get_response(request)
|
|
213
|
+
return response
|
|
214
|
+
|
|
215
|
+
def get_fund_brief(self, symbol, category=Category.US_STOCK.name):
|
|
216
|
+
"""
|
|
217
|
+
Query fund brief information.
|
|
218
|
+
|
|
219
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
220
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
221
|
+
"""
|
|
222
|
+
request = GetFundBriefRequest()
|
|
223
|
+
request.set_symbol(symbol)
|
|
224
|
+
request.set_category(category)
|
|
225
|
+
response = self.client.get_response(request)
|
|
226
|
+
return response
|
|
227
|
+
|
|
228
|
+
def get_fund_allocation(self, symbol, category=Category.US_STOCK.name):
|
|
229
|
+
"""
|
|
230
|
+
Query fund asset allocation.
|
|
231
|
+
|
|
232
|
+
:param symbol: Security symbol, e.g. QQQ.
|
|
233
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
234
|
+
"""
|
|
235
|
+
request = GetFundAllocationRequest()
|
|
236
|
+
request.set_symbol(symbol)
|
|
237
|
+
request.set_category(category)
|
|
238
|
+
response = self.client.get_response(request)
|
|
239
|
+
return response
|
|
240
|
+
|
|
241
|
+
def get_financials_indicators(self, symbol, category=Category.US_STOCK.name, type=None, count=None):
|
|
242
|
+
"""
|
|
243
|
+
Query financials indicators for a stock.
|
|
244
|
+
|
|
245
|
+
:param symbol: Security symbol, e.g. TSLA.
|
|
246
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
247
|
+
:param type: Financial type, default QUARTERLY. Options: ANNUAL, QUARTERLY.
|
|
248
|
+
:param count: The number of each query, default 5, maximum 20.
|
|
249
|
+
"""
|
|
250
|
+
request = GetFinancialsIndicatorsRequest()
|
|
251
|
+
request.set_symbol(symbol)
|
|
252
|
+
request.set_category(category)
|
|
253
|
+
request.set_type(type)
|
|
254
|
+
request.set_count(count)
|
|
255
|
+
response = self.client.get_response(request)
|
|
256
|
+
return response
|
|
257
|
+
|
|
258
|
+
def get_financials_income(self, symbol, category=Category.US_STOCK.name, type=None, count=None):
|
|
259
|
+
"""
|
|
260
|
+
Query financials income statement for a stock.
|
|
261
|
+
|
|
262
|
+
:param symbol: Security symbol, e.g. TSLA.
|
|
263
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
264
|
+
:param type: Financial type, default QUARTERLY. Options: ANNUAL, QUARTERLY.
|
|
265
|
+
:param count: The number of each query, default 5, maximum 20.
|
|
266
|
+
"""
|
|
267
|
+
request = GetFinancialsIncomeRequest()
|
|
268
|
+
request.set_symbol(symbol)
|
|
269
|
+
request.set_category(category)
|
|
270
|
+
request.set_type(type)
|
|
271
|
+
request.set_count(count)
|
|
272
|
+
response = self.client.get_response(request)
|
|
273
|
+
return response
|
|
274
|
+
|
|
275
|
+
def get_financials_cashflow(self, symbol, category=Category.US_STOCK.name, type=None, count=None):
|
|
276
|
+
"""
|
|
277
|
+
Query financials cashflow statement for a stock.
|
|
278
|
+
|
|
279
|
+
:param symbol: Security symbol, e.g. TSLA.
|
|
280
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
281
|
+
:param type: Financial type, default QUARTERLY. Options: ANNUAL, QUARTERLY.
|
|
282
|
+
:param count: The number of each query, default 5, maximum 20.
|
|
283
|
+
"""
|
|
284
|
+
request = GetFinancialsCashflowRequest()
|
|
285
|
+
request.set_symbol(symbol)
|
|
286
|
+
request.set_category(category)
|
|
287
|
+
request.set_type(type)
|
|
288
|
+
request.set_count(count)
|
|
289
|
+
response = self.client.get_response(request)
|
|
290
|
+
return response
|
|
291
|
+
|
|
292
|
+
def get_financials_balance_sheet(self, symbol, category=Category.US_STOCK.name, type=None, count=None):
|
|
293
|
+
"""
|
|
294
|
+
Query financials balance sheet for a stock.
|
|
295
|
+
|
|
296
|
+
:param symbol: Security symbol, e.g. TSLA.
|
|
297
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
298
|
+
:param type: Financial type, default QUARTERLY. Options: ANNUAL, QUARTERLY.
|
|
299
|
+
:param count: The number of each query, default 5, maximum 20.
|
|
300
|
+
"""
|
|
301
|
+
request = GetFinancialsBalanceSheetRequest()
|
|
302
|
+
request.set_symbol(symbol)
|
|
303
|
+
request.set_category(category)
|
|
304
|
+
request.set_type(type)
|
|
305
|
+
request.set_count(count)
|
|
306
|
+
response = self.client.get_response(request)
|
|
307
|
+
return response
|
|
308
|
+
|
|
309
|
+
def get_financials_alert(self, symbol, category=Category.US_STOCK.name):
|
|
310
|
+
"""
|
|
311
|
+
Query financials alert for a stock.
|
|
312
|
+
|
|
313
|
+
:param symbol: Security symbol, e.g. TSLA.
|
|
314
|
+
:param category: Security type. Category values are as shown in the enum.
|
|
315
|
+
"""
|
|
316
|
+
request = GetFinancialsAlertRequest()
|
|
317
|
+
request.set_symbol(symbol)
|
|
318
|
+
request.set_category(category)
|
|
319
|
+
response = self.client.get_response(request)
|
|
320
|
+
return response
|
|
321
|
+
|
|
322
|
+
def get_forecast_eps(self, symbol, category=Category.US_STOCK.name):
|
|
323
|
+
"""
|
|
324
|
+
Query forecast EPS for a stock. Returns the historical actual EPS of the most recent four disclosed
|
|
325
|
+
fiscal periods, plus the latest analyst consensus forecast EPS (if available).
|
|
326
|
+
Sorted by time in ascending order, returns up to 5 records.
|
|
327
|
+
|
|
328
|
+
:param symbol: Security symbol, e.g. AAPL. Only supports a single symbol.
|
|
329
|
+
:param category: Security type. Supported: US_STOCK, HK_STOCK, CN_STOCK.
|
|
330
|
+
"""
|
|
331
|
+
request = GetForecastEpsRequest()
|
|
332
|
+
request.set_symbol(symbol)
|
|
333
|
+
request.set_category(category)
|
|
334
|
+
response = self.client.get_response(request)
|
|
335
|
+
return response
|
webull/data/quotes/screener.py
CHANGED
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
from webull.data.request.screener.get_gainers_losers_request import GetGainersLosersRequest
|
|
18
18
|
from webull.data.request.screener.get_most_active_request import GetMostActiveRequest
|
|
19
|
+
from webull.data.request.screener.get_market_sectors_request import GetMarketSectorsRequest
|
|
20
|
+
from webull.data.request.screener.get_market_sectors_detail_request import GetMarketSectorsDetailRequest
|
|
21
|
+
from webull.data.request.screener.get_high_dividend_request import GetHighDividendRequest
|
|
22
|
+
from webull.data.request.screener.get_52whl_request import Get52WHLRequest
|
|
19
23
|
|
|
20
24
|
|
|
21
25
|
class Screener:
|
|
@@ -114,3 +118,87 @@ class Screener:
|
|
|
114
118
|
request.set_direction(direction)
|
|
115
119
|
response = self.client.get_response(request)
|
|
116
120
|
return response
|
|
121
|
+
|
|
122
|
+
def get_market_sectors(self, category, agg_type=None, period=None, page_index=None, page_size=None, direction=None):
|
|
123
|
+
"""
|
|
124
|
+
Get all sector overview data.
|
|
125
|
+
|
|
126
|
+
:param category: Security category. Required. (e.g., 'US_STOCK')
|
|
127
|
+
:param agg_type: Statistics type, default is MARKET_VALUE. Enum: MARKET_VALUE, VOLUME.
|
|
128
|
+
:param period: Statistics period, default is D1. Enum: D1, D5, M01, M03.
|
|
129
|
+
:param page_index: Page index.
|
|
130
|
+
:param page_size: Number of records per page.
|
|
131
|
+
:param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
|
|
132
|
+
"""
|
|
133
|
+
request = GetMarketSectorsRequest()
|
|
134
|
+
request.set_category(category)
|
|
135
|
+
request.set_agg_type(agg_type)
|
|
136
|
+
request.set_period(period)
|
|
137
|
+
request.set_page_index(page_index)
|
|
138
|
+
request.set_page_size(page_size)
|
|
139
|
+
request.set_direction(direction)
|
|
140
|
+
response = self.client.get_response(request)
|
|
141
|
+
return response
|
|
142
|
+
|
|
143
|
+
def get_market_sectors_detail(self, sector_id, category, period=None, page_index=None, page_size=None, sort_by=None, direction=None):
|
|
144
|
+
"""
|
|
145
|
+
Get stock list and statistics for a specific sector.
|
|
146
|
+
|
|
147
|
+
:param sector_id: Sector ID. Required.
|
|
148
|
+
:param category: Security category. Required. (e.g., 'US_STOCK')
|
|
149
|
+
:param period: Statistics period, default is D1. Enum: D1, D5, M01, M03.
|
|
150
|
+
:param page_index: Page index.
|
|
151
|
+
:param page_size: Number of records per page.
|
|
152
|
+
:param sort_by: Sort field, default is CHANGE_RATIO. Enum: CHANGE_RATIO, RELATIVE_VOLUME_10D, MARKET_VALUE, CLOSE, PRICE, PE_TTM, HIGH, LOW, AMPLITUDE, TURNOVER, VOLUME, YIELD, DIVIDEND.
|
|
153
|
+
:param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
|
|
154
|
+
"""
|
|
155
|
+
request = GetMarketSectorsDetailRequest()
|
|
156
|
+
request.set_sector_id(sector_id)
|
|
157
|
+
request.set_category(category)
|
|
158
|
+
request.set_period(period)
|
|
159
|
+
request.set_page_index(page_index)
|
|
160
|
+
request.set_page_size(page_size)
|
|
161
|
+
request.set_sort_by(sort_by)
|
|
162
|
+
request.set_direction(direction)
|
|
163
|
+
response = self.client.get_response(request)
|
|
164
|
+
return response
|
|
165
|
+
|
|
166
|
+
def get_high_dividend(self, category, sort_by=None, page_index=None, page_size=None, direction=None):
|
|
167
|
+
"""
|
|
168
|
+
Get high dividend rank list.
|
|
169
|
+
|
|
170
|
+
:param category: Security category. Required. (e.g., 'US_STOCK')
|
|
171
|
+
:param sort_by: Sort field, default is YIELD. Enum: CHANGE_RATIO, RELATIVE_VOLUME_10D, MARKET_VALUE, CLOSE, PRICE, PE_TTM, HIGH, LOW, AMPLITUDE, TURNOVER, VOLUME, YIELD, DIVIDEND.
|
|
172
|
+
:param page_index: Page index.
|
|
173
|
+
:param page_size: Number of records per page.
|
|
174
|
+
:param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
|
|
175
|
+
"""
|
|
176
|
+
request = GetHighDividendRequest()
|
|
177
|
+
request.set_category(category)
|
|
178
|
+
request.set_sort_by(sort_by)
|
|
179
|
+
request.set_page_index(page_index)
|
|
180
|
+
request.set_page_size(page_size)
|
|
181
|
+
request.set_direction(direction)
|
|
182
|
+
response = self.client.get_response(request)
|
|
183
|
+
return response
|
|
184
|
+
|
|
185
|
+
def get_52whl(self, category, rank_type=None, sort_by=None, page_index=None, page_size=None, direction=None):
|
|
186
|
+
"""
|
|
187
|
+
Get 52 week high/low rank list.
|
|
188
|
+
|
|
189
|
+
:param category: Security category. Required. (e.g., 'US_STOCK')
|
|
190
|
+
:param rank_type: Index code. Enum: NEW_HIGH, NEAR_HIGH, NEW_LOW, NEAR_LOW.
|
|
191
|
+
:param sort_by: Sort field, default is CHANGE_RATIO_52W. Enum: CHANGE_RATIO, RELATIVE_VOLUME_10D, MARKET_VALUE, CLOSE, PRICE, PE_TTM, HIGH, LOW, AMPLITUDE, TURNOVER, VOLUME, YIELD, DIVIDEND.
|
|
192
|
+
:param page_index: Page index.
|
|
193
|
+
:param page_size: Number of records per page.
|
|
194
|
+
:param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
|
|
195
|
+
"""
|
|
196
|
+
request = Get52WHLRequest()
|
|
197
|
+
request.set_rank_type(rank_type)
|
|
198
|
+
request.set_category(category)
|
|
199
|
+
request.set_sort_by(sort_by)
|
|
200
|
+
request.set_page_index(page_index)
|
|
201
|
+
request.set_page_size(page_size)
|
|
202
|
+
request.set_direction(direction)
|
|
203
|
+
response = self.client.get_response(request)
|
|
204
|
+
return response
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright 2022 Webull
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding=utf-8
|
|
16
|
+
|
|
17
|
+
from webull.core.request import ApiRequest
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class GetCapitalFlowRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/openapi/fundamentals/stock/capital-flow", version='v2', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_symbol(self, symbol):
|
|
26
|
+
if symbol:
|
|
27
|
+
self.add_query_param("symbol", symbol)
|
|
28
|
+
|
|
29
|
+
def set_category(self, category):
|
|
30
|
+
if category:
|
|
31
|
+
self.add_query_param("category", category)
|
|
32
|
+
|
|
33
|
+
def set_count(self, count):
|
|
34
|
+
if count:
|
|
35
|
+
self.add_query_param("count", count)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright 2022 Webull
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding=utf-8
|
|
16
|
+
|
|
17
|
+
from webull.core.request import ApiRequest
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class GetDividendCalendarRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/openapi/fundamentals/stock/dividend-calendar", version='v2', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_symbol(self, symbol):
|
|
26
|
+
if symbol:
|
|
27
|
+
self.add_query_param("symbol", symbol)
|
|
28
|
+
|
|
29
|
+
def set_category(self, category):
|
|
30
|
+
if category:
|
|
31
|
+
self.add_query_param("category", category)
|