webull-openapi-python-sdk 2.0.18__py3-none-any.whl → 3.0.0__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.
Files changed (161) hide show
  1. samples/screener/screener_client.py +55 -2
  2. webull/__init__.py +1 -1
  3. webull/core/__init__.py +1 -1
  4. webull/core/http/initializer/config/bean/query_config_request.py +1 -1
  5. webull/core/http/initializer/token/bean/check_token_request.py +1 -1
  6. webull/core/http/initializer/token/bean/create_token_request.py +1 -1
  7. webull/core/http/initializer/token/bean/refresh_token_request.py +1 -1
  8. webull/data/__init__.py +1 -1
  9. webull/data/data_streaming_client.py +3 -1
  10. webull/data/internal/quotes_client.py +2 -2
  11. webull/data/quotes/fundamentals.py +19 -0
  12. webull/data/quotes/instrument.py +148 -1
  13. webull/data/quotes/screener.py +179 -0
  14. webull/data/quotes/subscribe/notice_decoder.py +34 -0
  15. webull/data/quotes/subscribe/payload_type.py +2 -1
  16. webull/data/request/get_analyst_rating_request.py +2 -1
  17. webull/data/request/get_analyst_target_price_request.py +2 -1
  18. webull/data/request/get_batch_historical_bars_request.py +1 -1
  19. webull/data/request/get_capital_flow_request.py +1 -1
  20. webull/data/request/get_company_profile_request.py +2 -1
  21. webull/data/request/get_corp_action_request.py +1 -1
  22. webull/data/request/get_crypto_historical_bars_request.py +1 -1
  23. webull/data/request/get_crypto_instruments_request.py +5 -1
  24. webull/data/request/get_crypto_instruments_request_v2.py +41 -0
  25. webull/data/request/get_crypto_snapshot_request.py +1 -1
  26. webull/data/request/get_dividend_calendar_request.py +1 -1
  27. webull/data/request/get_earnings_calendar_request.py +1 -1
  28. webull/data/request/get_eod_bars_request.py +1 -1
  29. webull/data/request/get_event_bars_request.py +1 -1
  30. webull/data/request/get_event_depth_request.py +2 -1
  31. webull/data/request/get_event_events_request.py +2 -1
  32. webull/data/request/get_event_instrument_request.py +5 -1
  33. webull/data/request/get_event_instrument_request_v2.py +45 -0
  34. webull/data/request/get_event_series_categories.py +2 -1
  35. webull/data/request/get_event_series_request.py +5 -1
  36. webull/data/request/get_event_series_request_v2.py +37 -0
  37. webull/data/request/get_event_snapshot_request.py +2 -1
  38. webull/data/request/get_event_tick_request.py +2 -1
  39. webull/data/request/get_financials_alert_request.py +1 -1
  40. webull/data/request/get_financials_balance_sheet_request.py +1 -1
  41. webull/data/request/get_financials_cashflow_request.py +1 -1
  42. webull/data/request/get_financials_income_request.py +1 -1
  43. webull/data/request/get_financials_indicators_request.py +1 -1
  44. webull/data/request/get_footprint_request.py +1 -1
  45. webull/data/request/get_forecast_eps_request.py +1 -1
  46. webull/data/request/get_fund_allocation_request.py +1 -1
  47. webull/data/request/get_fund_brief_request.py +1 -1
  48. webull/data/request/get_fund_dividends_request.py +5 -1
  49. webull/data/request/get_fund_dividends_request_v2.py +35 -0
  50. webull/data/request/get_fund_files_request.py +1 -1
  51. webull/data/request/get_fund_holdings_request.py +1 -1
  52. webull/data/request/get_fund_net_value_request.py +1 -1
  53. webull/data/request/get_fund_performance_request.py +1 -1
  54. webull/data/request/get_fund_rating_request.py +1 -1
  55. webull/data/request/get_fund_splits_request.py +1 -1
  56. webull/data/request/get_futures_depth_request.py +1 -1
  57. webull/data/request/get_futures_footprint_request.py +1 -1
  58. webull/data/request/get_futures_historical_bars_request.py +1 -1
  59. webull/data/request/get_futures_instruments_by_code_request.py +1 -1
  60. webull/data/request/get_futures_instruments_request.py +2 -1
  61. webull/data/request/get_futures_product_class.py +2 -1
  62. webull/data/request/get_futures_products_request.py +2 -1
  63. webull/data/request/get_futures_snapshot_request.py +1 -1
  64. webull/data/request/get_futures_tick_request.py +1 -1
  65. webull/data/request/get_historical_bars_request.py +1 -1
  66. webull/data/request/get_industry_comparison_request.py +1 -1
  67. webull/data/request/get_instruments_request.py +5 -1
  68. webull/data/request/get_instruments_request_v2.py +44 -0
  69. webull/data/request/get_noii_bars_request.py +1 -1
  70. webull/data/request/get_noii_snapshot_request.py +2 -1
  71. webull/data/request/get_option_bars_request.py +1 -1
  72. webull/data/request/get_option_contracts_request.py +5 -1
  73. webull/data/request/get_option_contracts_request_v2.py +78 -0
  74. webull/data/request/get_option_snapshot_request.py +1 -1
  75. webull/data/request/get_option_tick_request.py +1 -1
  76. webull/data/request/get_quotes_request.py +1 -1
  77. webull/data/request/get_sec_filings_request.py +1 -1
  78. webull/data/request/get_snapshot_request.py +1 -1
  79. webull/data/request/get_tick_request.py +1 -1
  80. webull/data/request/screener/get_52whl_request.py +4 -0
  81. webull/data/request/screener/get_52whl_request_v2.py +45 -0
  82. webull/data/request/screener/get_gainers_losers_request.py +5 -1
  83. webull/data/request/screener/get_gainers_losers_request_v2.py +94 -0
  84. webull/data/request/screener/get_high_dividend_request.py +4 -0
  85. webull/data/request/screener/get_high_dividend_request_v2.py +41 -0
  86. webull/data/request/screener/get_market_sectors_detail_request.py +4 -0
  87. webull/data/request/screener/get_market_sectors_detail_request_v2.py +47 -0
  88. webull/data/request/screener/get_market_sectors_request.py +5 -1
  89. webull/data/request/screener/get_market_sectors_request_v2.py +43 -0
  90. webull/data/request/screener/get_most_active_request.py +5 -1
  91. webull/data/request/screener/get_most_active_request_v2.py +92 -0
  92. webull/data/request/subscribe_request.py +1 -1
  93. webull/data/request/unsubscribe_request.py +1 -1
  94. webull/data/request/watchlist/add_watchlist_instruments_request.py +2 -1
  95. webull/data/request/watchlist/create_watchlist_request.py +1 -1
  96. webull/data/request/watchlist/delete_watchlist_request.py +1 -1
  97. webull/data/request/watchlist/get_watchlist_instruments_request.py +2 -1
  98. webull/data/request/watchlist/get_watchlist_request.py +1 -1
  99. webull/data/request/watchlist/remove_watchlist_instruments_request.py +2 -1
  100. webull/data/request/watchlist/update_watchlist_instruments_request.py +2 -1
  101. webull/data/request/watchlist/update_watchlist_request.py +1 -1
  102. webull/trade/__init__.py +1 -1
  103. webull/trade/request/cancel_order_request.py +1 -1
  104. webull/trade/request/get_account_balance_request.py +1 -1
  105. webull/trade/request/get_account_positions_request.py +1 -1
  106. webull/trade/request/get_account_profile_request.py +1 -1
  107. webull/trade/request/get_activities_request.py +4 -0
  108. webull/trade/request/get_activities_request_v2.py +41 -0
  109. webull/trade/request/get_app_subscriptions.py +1 -1
  110. webull/trade/request/get_open_orders_request.py +1 -1
  111. webull/trade/request/get_order_detail_request.py +1 -1
  112. webull/trade/request/get_today_orders_request.py +1 -1
  113. webull/trade/request/get_trade_calendar_request.py +1 -1
  114. webull/trade/request/get_trade_instrument_detail_request.py +1 -1
  115. webull/trade/request/get_trade_security_detail_request.py +1 -1
  116. webull/trade/request/get_tradeable_instruments_request.py +1 -1
  117. webull/trade/request/palce_order_request.py +1 -1
  118. webull/trade/request/place_order_request.py +1 -1
  119. webull/trade/request/place_order_request_v2.py +1 -1
  120. webull/trade/request/replace_order_request.py +1 -1
  121. webull/trade/request/replace_order_request_v2.py +1 -1
  122. webull/trade/request/v2/cancel_option_request.py +1 -1
  123. webull/trade/request/v2/cancel_order_request.py +1 -1
  124. webull/trade/request/v2/get_account_balance_request.py +1 -1
  125. webull/trade/request/v2/get_account_list.py +1 -3
  126. webull/trade/request/v2/get_account_list_request.py +1 -3
  127. webull/trade/request/v2/get_account_position_details_request.py +4 -0
  128. webull/trade/request/v2/get_account_position_details_request_v2.py +31 -0
  129. webull/trade/request/v2/get_account_positions_request.py +1 -1
  130. webull/trade/request/v2/get_order_detail_request.py +1 -1
  131. webull/trade/request/v2/get_order_executions_request.py +5 -0
  132. webull/trade/request/v2/get_order_executions_request_v2.py +35 -0
  133. webull/trade/request/v2/get_order_history_request.py +1 -1
  134. webull/trade/request/v2/get_order_open_request.py +1 -1
  135. webull/trade/request/v2/palce_order_request.py +1 -1
  136. webull/trade/request/v2/place_option_request.py +1 -1
  137. webull/trade/request/v2/place_order_request.py +1 -1
  138. webull/trade/request/v2/preview_option_request.py +1 -1
  139. webull/trade/request/v2/preview_order_request.py +1 -1
  140. webull/trade/request/v2/replace_option_request.py +1 -1
  141. webull/trade/request/v2/replace_order_request.py +1 -1
  142. webull/trade/request/v3/batch_place_order_request.py +1 -1
  143. webull/trade/request/v3/cancel_order_request.py +1 -1
  144. webull/trade/request/v3/get_order_detail_request.py +1 -1
  145. webull/trade/request/v3/get_order_history_request.py +5 -1
  146. webull/trade/request/v3/get_order_history_request_v2.py +35 -0
  147. webull/trade/request/v3/get_order_open_request.py +5 -1
  148. webull/trade/request/v3/get_order_open_request_v2.py +27 -0
  149. webull/trade/request/v3/place_order_request.py +1 -1
  150. webull/trade/request/v3/preview_order_request.py +1 -1
  151. webull/trade/request/v3/replace_order_request.py +1 -1
  152. webull/trade/trade/activity.py +33 -0
  153. webull/trade/trade/v2/account_info_v2.py +24 -0
  154. webull/trade/trade/v3/{order_opration_v3.py → order_operation_v3.py} +94 -1
  155. webull/trade/trade_client.py +1 -1
  156. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/METADATA +1 -1
  157. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/RECORD +161 -143
  158. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/WHEEL +0 -0
  159. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/licenses/LICENSE +0 -0
  160. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/licenses/NOTICE +0 -0
  161. {webull_openapi_python_sdk-2.0.18.dist-info → webull_openapi_python_sdk-3.0.0.dist-info}/top_level.txt +0 -0
@@ -15,11 +15,17 @@
15
15
  # coding=utf-8
16
16
 
17
17
  from webull.data.request.screener.get_gainers_losers_request import GetGainersLosersRequest
18
+ from webull.data.request.screener.get_gainers_losers_request_v2 import GetGainersLosersRequestV2
18
19
  from webull.data.request.screener.get_most_active_request import GetMostActiveRequest
20
+ from webull.data.request.screener.get_most_active_request_v2 import GetMostActiveRequestV2
19
21
  from webull.data.request.screener.get_market_sectors_request import GetMarketSectorsRequest
22
+ from webull.data.request.screener.get_market_sectors_request_v2 import GetMarketSectorsRequestV2
20
23
  from webull.data.request.screener.get_market_sectors_detail_request import GetMarketSectorsDetailRequest
24
+ from webull.data.request.screener.get_market_sectors_detail_request_v2 import GetMarketSectorsDetailRequestV2
21
25
  from webull.data.request.screener.get_high_dividend_request import GetHighDividendRequest
26
+ from webull.data.request.screener.get_high_dividend_request_v2 import GetHighDividendRequestV2
22
27
  from webull.data.request.screener.get_52whl_request import Get52WHLRequest
28
+ from webull.data.request.screener.get_52whl_request_v2 import Get52WHLRequestV2
23
29
 
24
30
 
25
31
  class Screener:
@@ -36,6 +42,9 @@ class Screener:
36
42
 
37
43
  def get_gainers_losers(self, rank_type, category, sort_by, page_index=None, page_size=None, direction=None):
38
44
  """
45
+ .. deprecated::
46
+ Use :meth:`list_gainers_losers` instead.
47
+
39
48
  Get stock top gainers or losers ranking by price change percentage.
40
49
 
41
50
  This API returns stocks ranked by price change over different time periods.
@@ -76,8 +85,50 @@ class Screener:
76
85
  response = self.client.get_response(request)
77
86
  return response
78
87
 
88
+ def list_gainers_losers(self, rank_type, category, sort_by, direction=None):
89
+ """
90
+ Get stock top gainers or losers ranking by price change percentage.
91
+
92
+ This API returns stocks ranked by price change over different time periods.
93
+ Use direction='DESC' for gainers (top performers) and direction='ASC' for losers.
94
+ The ranking is not paginated and returns the top 200 results.
95
+
96
+ :param rank_type: Time period for ranking. Required.
97
+ Enum values:
98
+ - PRE_MARKET: Pre-market session
99
+ - AFTER_MARKET: After-market session
100
+ - MIN_3: 3 minutes
101
+ - MIN_5: 5 minutes
102
+ - DAY_1: 1 day
103
+ - DAY_5: 5 days
104
+ - MONTH_1: 1 month
105
+ - MONTH_3: 3 months
106
+ - WEEK_52: 52 weeks
107
+ :param category: Security market category. Required. (e.g., 'US_STOCK')
108
+ :param sort_by: Secondary sort field. Required.
109
+ Enum values: CHANGE_RATIO, RELATIVE_VOLUME_10D, MARKET_VALUE, CLOSE,
110
+ PRICE, PE_TTM, HIGH, LOW, AMPLITUDE, TURNOVER, VOLUME
111
+ :param direction: Sort direction. Optional (defaults to DESC).
112
+ - ASC: Ascending (for losers)
113
+ - DESC: Descending (for gainers)
114
+ :return: Response containing a list of ranked stocks with instrument_id,
115
+ symbol, name, exchange_code, currency_code, pre_close, open, high, low,
116
+ close, price, change, change_ratio, volume, turnover_rate, market_value,
117
+ amplitude, relative_volume_10d, pe_ttm.
118
+ """
119
+ request = GetGainersLosersRequestV2()
120
+ request.set_rank_type(rank_type)
121
+ request.set_category(category)
122
+ request.set_sort_by(sort_by)
123
+ request.set_direction(direction)
124
+ response = self.client.get_response(request)
125
+ return response
126
+
79
127
  def get_most_active(self, category, rank_type=None, sort_by=None, page_index=None, page_size=None, direction=None):
80
128
  """
129
+ .. deprecated::
130
+ Use :meth:`list_most_active` instead.
131
+
81
132
  Get most actively traded stocks ranking.
82
133
 
83
134
  This API returns stocks ranked by trading activity metrics such as volume,
@@ -119,8 +170,51 @@ class Screener:
119
170
  response = self.client.get_response(request)
120
171
  return response
121
172
 
173
+ def list_most_active(self, category, rank_type=None, sort_by=None, direction=None):
174
+ """
175
+ Get most actively traded stocks ranking.
176
+
177
+ This API returns stocks ranked by trading activity metrics such as volume,
178
+ relative volume, turnover amount, turnover rate, or amplitude.
179
+ The ranking is not paginated and returns the top 200 results.
180
+
181
+ Default sort: rank_type=VOLUME, sort_by=VOLUME, direction=DESC
182
+
183
+ The relative_volume_10d field is unique to this endpoint compared to
184
+ the gainers/losers endpoint.
185
+
186
+ :param category: Security market category. Required. (e.g., 'US_STOCK')
187
+ :param rank_type: Activity metric for ranking. Optional (defaults to VOLUME).
188
+ Enum values:
189
+ - VOLUME: Trading volume
190
+ - RELATIVE_VOLUME_10D: 10-day relative volume
191
+ - TURNOVER: Turnover amount
192
+ - TURNOVER_RATE: Turnover rate
193
+ - AMPLITUDE: Price amplitude
194
+ :param sort_by: Secondary sort field. Optional.
195
+ Enum values: CHANGE_RATIO, RELATIVE_VOLUME_10D, MARKET_VALUE, CLOSE,
196
+ PRICE, PE_TTM, HIGH, LOW, AMPLITUDE, TURNOVER, VOLUME
197
+ :param direction: Sort direction. Optional (defaults to DESC).
198
+ - ASC: Ascending order
199
+ - DESC: Descending order
200
+ :return: Response containing a list of ranked stocks with instrument_id,
201
+ symbol, name, exchange_code, currency_code, pre_close, open, high, low,
202
+ close, price, change, change_ratio, volume, turnover_rate, market_value,
203
+ amplitude, relative_volume_10d.
204
+ """
205
+ request = GetMostActiveRequestV2()
206
+ request.set_category(category)
207
+ request.set_rank_type(rank_type)
208
+ request.set_sort_by(sort_by)
209
+ request.set_direction(direction)
210
+ response = self.client.get_response(request)
211
+ return response
212
+
122
213
  def get_market_sectors(self, category, agg_type=None, period=None, page_index=None, page_size=None, direction=None):
123
214
  """
215
+ .. deprecated::
216
+ Use :meth:`list_market_sectors` instead.
217
+
124
218
  Get all sector overview data.
125
219
 
126
220
  :param category: Security category. Required. (e.g., 'US_STOCK')
@@ -140,8 +234,30 @@ class Screener:
140
234
  response = self.client.get_response(request)
141
235
  return response
142
236
 
237
+ def list_market_sectors(self, category, agg_type=None, period=None, direction=None, pagination_key=None):
238
+ """
239
+ Get all sector overview data.
240
+
241
+ :param category: Security category. Required. (e.g., 'US_STOCK')
242
+ :param agg_type: Statistics type, default is MARKET_VALUE. Enum: MARKET_VALUE, VOLUME.
243
+ :param period: Statistics period, default is D1. Enum: D1, D5, M01, M03.
244
+ :param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
245
+ :param pagination_key: Pagination key from the previous page response; not returned on the last page.
246
+ """
247
+ request = GetMarketSectorsRequestV2()
248
+ request.set_category(category)
249
+ request.set_agg_type(agg_type)
250
+ request.set_period(period)
251
+ request.set_direction(direction)
252
+ request.set_pagination_key(pagination_key)
253
+ response = self.client.get_response(request)
254
+ return response
255
+
143
256
  def get_market_sectors_detail(self, sector_id, category, period=None, page_index=None, page_size=None, sort_by=None, direction=None):
144
257
  """
258
+ .. deprecated::
259
+ Use :meth:`list_market_sectors_detail` instead.
260
+
145
261
  Get stock list and statistics for a specific sector.
146
262
 
147
263
  :param sector_id: Sector ID. Required.
@@ -163,8 +279,32 @@ class Screener:
163
279
  response = self.client.get_response(request)
164
280
  return response
165
281
 
282
+ def list_market_sectors_detail(self, sector_id, category, period=None, sort_by=None, direction=None, pagination_key=None):
283
+ """
284
+ Get stock list and statistics for a specific sector.
285
+
286
+ :param sector_id: Sector ID. Required.
287
+ :param category: Security category. Required. (e.g., 'US_STOCK')
288
+ :param period: Statistics period, default is D1. Enum: D1, D5, M01, M03.
289
+ :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.
290
+ :param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
291
+ :param pagination_key: Pagination key from the previous page response; not returned on the last page.
292
+ """
293
+ request = GetMarketSectorsDetailRequestV2()
294
+ request.set_sector_id(sector_id)
295
+ request.set_category(category)
296
+ request.set_period(period)
297
+ request.set_sort_by(sort_by)
298
+ request.set_direction(direction)
299
+ request.set_pagination_key(pagination_key)
300
+ response = self.client.get_response(request)
301
+ return response
302
+
166
303
  def get_high_dividend(self, category, sort_by=None, page_index=None, page_size=None, direction=None):
167
304
  """
305
+ .. deprecated::
306
+ Use :meth:`list_high_dividend` instead.
307
+
168
308
  Get high dividend rank list.
169
309
 
170
310
  :param category: Security category. Required. (e.g., 'US_STOCK')
@@ -182,8 +322,28 @@ class Screener:
182
322
  response = self.client.get_response(request)
183
323
  return response
184
324
 
325
+ def list_high_dividend(self, category, sort_by=None, direction=None):
326
+ """
327
+ Get high dividend rank list.
328
+
329
+ The ranking is not paginated and returns the top 200 results.
330
+
331
+ :param category: Security category. Required. (e.g., 'US_STOCK')
332
+ :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.
333
+ :param direction: Sorting direction, default is DESC. Enum: ASC (ascending), DESC (descending).
334
+ """
335
+ request = GetHighDividendRequestV2()
336
+ request.set_category(category)
337
+ request.set_sort_by(sort_by)
338
+ request.set_direction(direction)
339
+ response = self.client.get_response(request)
340
+ return response
341
+
185
342
  def get_52whl(self, category, rank_type=None, sort_by=None, page_index=None, page_size=None, direction=None):
186
343
  """
344
+ .. deprecated::
345
+ Use :meth:`list_52whl` instead.
346
+
187
347
  Get 52 week high/low rank list.
188
348
 
189
349
  :param category: Security category. Required. (e.g., 'US_STOCK')
@@ -202,3 +362,22 @@ class Screener:
202
362
  request.set_direction(direction)
203
363
  response = self.client.get_response(request)
204
364
  return response
365
+
366
+ def list_52whl(self, category, rank_type=None, sort_by=None, direction=None):
367
+ """
368
+ Get 52 week high/low rank list.
369
+
370
+ The ranking is not paginated and returns the top 200 results.
371
+
372
+ :param category: Security category. Required. (e.g., 'US_STOCK')
373
+ :param rank_type: Index code. Enum: NEW_HIGH, NEAR_HIGH, NEW_LOW, NEAR_LOW.
374
+ :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.
375
+ :param direction: Sorting direction. Enum: ASC (ascending), DESC (descending).
376
+ """
377
+ request = Get52WHLRequestV2()
378
+ request.set_rank_type(rank_type)
379
+ request.set_category(category)
380
+ request.set_sort_by(sort_by)
381
+ request.set_direction(direction)
382
+ response = self.client.get_response(request)
383
+ return response
@@ -0,0 +1,34 @@
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
+ import json
18
+
19
+ from webull.data.internal.quotes_payload_decoder import BaseQuotesPayloadDecoder
20
+
21
+
22
+ class NoticeDecoder(BaseQuotesPayloadDecoder):
23
+ """Decoder for notice messages from the server.
24
+
25
+ Notice messages are JSON-encoded and include:
26
+ - type '1001': status message with rtt, drop, sent fields
27
+ - type '1002': permission preemption with content field
28
+ """
29
+
30
+ def __init__(self):
31
+ super().__init__()
32
+
33
+ def parse(self, payload):
34
+ return json.loads(payload.decode("utf-8"))
@@ -19,4 +19,5 @@ PAYLOAD_TYPE_SHAPSHOT = 'snapshot'
19
19
  PAYLOAD_TYPE_TICK = 'tick'
20
20
  PAYLOAD_TYPE_EVENT_DEPTH = 'event-quote'
21
21
  PAYLOAD_TYPE_EVENT_SHAPSHOT = 'event-snapshot'
22
- PAYLOAD_TYPE_EVENT_TICK = 'event-tick'
22
+ PAYLOAD_TYPE_EVENT_TICK = 'event-tick'
23
+ PAYLOAD_TYPE_NOTICE = 'notice'
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetAnalystRatingRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/instrument/analyst/rating", version="v2", method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/analysis/ratings/get", version="v3", method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbol(self, symbol):
25
26
  """
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetAnalystTargetPriceRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/instrument/analyst/target-price", version="v2", method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/analysis/target-prices/get", version="v3", method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbol(self, symbol):
25
26
  """
@@ -17,7 +17,7 @@ from webull.core.request import ApiRequest
17
17
 
18
18
  class BatchHistoricalBarsRequest(ApiRequest):
19
19
  def __init__(self):
20
- ApiRequest.__init__(self, "/openapi/market-data/stock/batch-bars", version='v2', method="POST", body_params={})
20
+ ApiRequest.__init__(self, "/market-data/stocks/bars/list", version='v3', method="POST", body_params={})
21
21
 
22
22
  def set_symbols(self, symbol):
23
23
  self.add_body_params("symbols", symbol)
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetCapitalFlowRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/fundamentals/stock/capital-flow", version='v2', method="GET",
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/capital-flows/get", version='v3', method="GET",
23
23
  query_params={})
24
24
 
25
25
  def set_symbol(self, symbol):
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetCompanyProfileRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/instrument/company/profile", version="v2", method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/company-profiles/get", version="v3", method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbol(self, symbol):
25
26
  """
@@ -17,7 +17,7 @@ from webull.core.request import ApiRequest
17
17
 
18
18
  class GetCorpActionRequest(ApiRequest):
19
19
  def __init__(self):
20
- ApiRequest.__init__(self, "/instrument/corp-action", version='v2', method="GET", query_params={})
20
+ ApiRequest.__init__(self, "/instrument/corp-action", version='v3', method="GET", query_params={})
21
21
 
22
22
  def set_instrument_ids(self, instrument_ids):
23
23
  if isinstance(instrument_ids, str):
@@ -18,7 +18,7 @@ from webull.core.request import ApiRequest
18
18
 
19
19
  class GetCryptoHistoricalBarsRequest(ApiRequest):
20
20
  def __init__(self):
21
- ApiRequest.__init__(self, "/openapi/market-data/crypto/bars", version='v2', method="GET", query_params={})
21
+ ApiRequest.__init__(self, "/market-data/crypto/bars/list", version='v3', method="GET", query_params={})
22
22
 
23
23
  def set_symbols(self, symbols):
24
24
  if isinstance(symbols, str):
@@ -18,8 +18,12 @@ from webull.core.request import ApiRequest
18
18
 
19
19
 
20
20
  class GetCryptoInstrumentsRequest(ApiRequest):
21
+ """
22
+ .. deprecated::
23
+ Use :class:`GetCryptoInstrumentsRequestV2` instead.
24
+ """
21
25
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/instrument/crypto/list", version='v2', method="GET", query_params={})
26
+ ApiRequest.__init__(self, "/openapi/instrument/crypto/list", version='v3', method="GET", query_params={})
23
27
 
24
28
  def set_symbols(self, symbols):
25
29
  if isinstance(symbols, str):
@@ -0,0 +1,41 @@
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 GetCryptoInstrumentsRequestV2(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/trading/instruments/crypto/profiles/list", version='v3', method="GET",
23
+ query_params={})
24
+
25
+ def set_symbols(self, symbols):
26
+ if isinstance(symbols, str):
27
+ self.add_query_param("symbols", symbols)
28
+ elif isinstance(symbols, list):
29
+ self.add_query_param("symbols", ",".join(symbols))
30
+
31
+ def set_category(self, category):
32
+ if category:
33
+ self.add_query_param("category", category)
34
+
35
+ def set_status(self, status):
36
+ if status:
37
+ self.add_query_param("status", status)
38
+
39
+ def set_pagination_key(self, pagination_key):
40
+ if pagination_key:
41
+ self.add_query_param("pagination_key", pagination_key)
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetCryptoSnapshotRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/market-data/crypto/snapshot", version='v2', method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/crypto/snapshots/list", version='v3', method="GET", query_params={})
23
23
 
24
24
  def set_symbols(self, symbols):
25
25
  if isinstance(symbols, str):
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetDividendCalendarRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/fundamentals/stock/dividend-calendar", version='v2', method="GET",
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/dividend-calendars/list", version='v3', method="GET",
23
23
  query_params={})
24
24
 
25
25
  def set_symbol(self, symbol):
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetEarningsCalendarRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/fundamentals/stock/earnings-calendar", version='v2', method="GET",
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/earnings-calendars/list", version='v3', method="GET",
23
23
  query_params={})
24
24
 
25
25
  def set_symbol(self, symbol):
@@ -17,7 +17,7 @@ from webull.core.request import ApiRequest
17
17
 
18
18
  class GetEodBarsRequest(ApiRequest):
19
19
  def __init__(self):
20
- ApiRequest.__init__(self, "/market-data/eod-bars", version='v2', method="GET", query_params={})
20
+ ApiRequest.__init__(self, "/market-data/eod-bars", version='v3', method="GET", query_params={})
21
21
 
22
22
  def set_instrument_ids(self, instrument_ids):
23
23
  if isinstance(instrument_ids, str):
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetEventBarsRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/market-data/event/bars", version='v2', method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/event-contracts/bars/list", version='v3', method="GET", query_params={})
23
23
 
24
24
  def set_symbols(self, symbols):
25
25
  if isinstance(symbols, str):
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetEventDepthRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/market-data/event/depth", version='v2', method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/event-contracts/depths/list", version='v3', method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbol(self, symbol):
25
26
  self.add_query_param("symbol", symbol)
@@ -18,7 +18,8 @@ from webull.core.request import ApiRequest
18
18
 
19
19
  class GetEventEventsRequest(ApiRequest):
20
20
  def __init__(self):
21
- ApiRequest.__init__(self, "/openapi/instrument/event/events", version='v2', method="GET", query_params={})
21
+ ApiRequest.__init__(self, "/trading/instruments/event-contracts/events/list", version='v3', method="GET",
22
+ query_params={})
22
23
 
23
24
  def set_series_symbol(self, series_symbol):
24
25
  self.add_query_param("series_symbol", series_symbol)
@@ -17,8 +17,12 @@
17
17
  from webull.core.request import ApiRequest
18
18
 
19
19
  class GetEventInstrumentRequest(ApiRequest):
20
+ """
21
+ .. deprecated::
22
+ Use :class:`GetEventInstrumentRequestV2` instead.
23
+ """
20
24
  def __init__(self):
21
- ApiRequest.__init__(self, "/openapi/instrument/event/market/list", version='v2', method="GET", query_params={})
25
+ ApiRequest.__init__(self, "/openapi/instrument/event/market/list", version='v3', method="GET", query_params={})
22
26
 
23
27
  def set_series_symbol(self, series_symbol):
24
28
  self.add_query_param("series_symbol", series_symbol)
@@ -0,0 +1,45 @@
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 GetEventInstrumentRequestV2(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/trading/instruments/event-contracts/markets/list", version='v3', method="GET",
23
+ query_params={})
24
+
25
+ def set_series_symbol(self, series_symbol):
26
+ if series_symbol:
27
+ self.add_query_param("series_symbol", series_symbol)
28
+
29
+ def set_event_symbol(self, event_symbol):
30
+ if event_symbol:
31
+ self.add_query_param("event_symbol", event_symbol)
32
+
33
+ def set_symbols(self, symbols):
34
+ if isinstance(symbols, str):
35
+ self.add_query_param("symbols", symbols)
36
+ elif isinstance(symbols, list):
37
+ self.add_query_param("symbols", ",".join(symbols))
38
+
39
+ def set_expiration_date_after(self, expiration_date_after):
40
+ if expiration_date_after:
41
+ self.add_query_param("expiration_date_after", expiration_date_after)
42
+
43
+ def set_pagination_key(self, pagination_key):
44
+ if pagination_key:
45
+ self.add_query_param("pagination_key", pagination_key)
@@ -18,4 +18,5 @@ from webull.core.request import ApiRequest
18
18
 
19
19
  class GetEventCategoriesRequest(ApiRequest):
20
20
  def __init__(self):
21
- ApiRequest.__init__(self, "/openapi/instrument/event/categories", version='v2', method="GET", query_params={})
21
+ ApiRequest.__init__(self, "/trading/instruments/event-contracts/categories/list", version='v3', method="GET",
22
+ query_params={})
@@ -17,8 +17,12 @@
17
17
  from webull.core.request import ApiRequest
18
18
 
19
19
  class GetEventSeriesRequest(ApiRequest):
20
+ """
21
+ .. deprecated::
22
+ Use :class:`GetEventSeriesRequestV2` instead.
23
+ """
20
24
  def __init__(self):
21
- ApiRequest.__init__(self, "/openapi/instrument/event/series/list", version='v2', method="GET", query_params={})
25
+ ApiRequest.__init__(self, "/openapi/instrument/event/series/list", version='v3', method="GET", query_params={})
22
26
 
23
27
  def set_category(self, category):
24
28
  self.add_query_param("category", category)
@@ -0,0 +1,37 @@
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 GetEventSeriesRequestV2(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/trading/instruments/event-contracts/series/list", version='v3', method="GET",
23
+ query_params={})
24
+
25
+ def set_category(self, category):
26
+ if category:
27
+ self.add_query_param("category", category)
28
+
29
+ def set_symbols(self, symbols):
30
+ if isinstance(symbols, str):
31
+ self.add_query_param("symbols", symbols)
32
+ elif isinstance(symbols, list):
33
+ self.add_query_param("symbols", ",".join(symbols))
34
+
35
+ def set_pagination_key(self, pagination_key):
36
+ if pagination_key:
37
+ self.add_query_param("pagination_key", pagination_key)
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetEventSnapshotRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/market-data/event/snapshot", version='v2', method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/event-contracts/snapshots/list", version='v3', method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbols(self, symbols):
25
26
  if isinstance(symbols, str):
@@ -19,7 +19,8 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetEventTickRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/market-data/event/tick", version='v2', method="GET", query_params={})
22
+ ApiRequest.__init__(self, "/market-data/event-contracts/ticks/list", version='v3', method="GET",
23
+ query_params={})
23
24
 
24
25
  def set_symbol(self, symbol):
25
26
  self.add_query_param("symbol", symbol)
@@ -19,7 +19,7 @@ from webull.core.request import ApiRequest
19
19
 
20
20
  class GetFinancialsAlertRequest(ApiRequest):
21
21
  def __init__(self):
22
- ApiRequest.__init__(self, "/openapi/fundamentals/financial/alert", version='v2', method="GET",
22
+ ApiRequest.__init__(self, "/market-data/fundamentals/financial-alerts/get", version='v3', method="GET",
23
23
  query_params={})
24
24
 
25
25
  def set_symbol(self, symbol):