webull-openapi-python-sdk 2.0.4__py3-none-any.whl → 2.0.6__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 (44) hide show
  1. samples/__init__.py +1 -1
  2. samples/data/data_client.py +33 -1
  3. samples/screener/__init__.py +15 -0
  4. samples/screener/screener_client.py +118 -0
  5. samples/watchlist/__init__.py +13 -0
  6. samples/watchlist/watchlist_client.py +87 -0
  7. webull/__init__.py +1 -1
  8. webull/core/__init__.py +1 -1
  9. webull/core/utils/common.py +3 -1
  10. webull/data/__init__.py +1 -1
  11. webull/data/data_client.py +4 -0
  12. webull/data/quotes/instrument.py +77 -4
  13. webull/data/quotes/market_data.py +65 -3
  14. webull/data/quotes/screener.py +116 -0
  15. webull/data/quotes/watchlist.py +148 -0
  16. webull/data/request/get_analyst_rating_request.py +38 -0
  17. webull/data/request/get_analyst_target_price_request.py +38 -0
  18. webull/data/request/get_batch_historical_bars_request.py +19 -1
  19. webull/data/request/get_company_profile_request.py +38 -0
  20. webull/data/request/get_futures_instruments_request.py +6 -0
  21. webull/data/request/get_futures_product_class.py +24 -0
  22. webull/data/request/get_futures_products_request.py +3 -0
  23. webull/data/request/get_historical_bars_request.py +18 -0
  24. webull/data/request/get_noii_bars_request.py +55 -0
  25. webull/data/request/get_noii_snapshot_request.py +59 -0
  26. webull/data/request/screener/__init__.py +15 -0
  27. webull/data/request/screener/get_gainers_losers_request.py +109 -0
  28. webull/data/request/screener/get_most_active_request.py +110 -0
  29. webull/data/request/watchlist/__init__.py +13 -0
  30. webull/data/request/watchlist/add_watchlist_instruments_request.py +41 -0
  31. webull/data/request/watchlist/create_watchlist_request.py +39 -0
  32. webull/data/request/watchlist/delete_watchlist_request.py +30 -0
  33. webull/data/request/watchlist/get_watchlist_instruments_request.py +30 -0
  34. webull/data/request/watchlist/get_watchlist_request.py +22 -0
  35. webull/data/request/watchlist/remove_watchlist_instruments_request.py +40 -0
  36. webull/data/request/watchlist/update_watchlist_instruments_request.py +41 -0
  37. webull/data/request/watchlist/update_watchlist_request.py +48 -0
  38. webull/trade/__init__.py +1 -1
  39. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/METADATA +1 -1
  40. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/RECORD +44 -20
  41. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/WHEEL +0 -0
  42. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/licenses/LICENSE +0 -0
  43. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/licenses/NOTICE +0 -0
  44. {webull_openapi_python_sdk-2.0.4.dist-info → webull_openapi_python_sdk-2.0.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,109 @@
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 GetGainersLosersRequest(ApiRequest):
21
+ """
22
+ Request class for Stock Top Gainers/Losers Rank API.
23
+
24
+ This API returns stocks ranked by price change percentage over different time periods.
25
+ Use direction=DESC for gainers (top performers) and direction=ASC for losers (worst performers).
26
+ """
27
+
28
+ def __init__(self):
29
+ ApiRequest.__init__(self, "/openapi/market-data/screener/gainers-losers", version="v2", method="GET", query_params={})
30
+
31
+ def set_rank_type(self, rank_type):
32
+ """
33
+ Set the ranking time dimension.
34
+
35
+ :param rank_type: Time period for ranking. Required.
36
+ Enum values:
37
+ - PRE_MARKET: Pre-market session
38
+ - AFTER_MARKET: After-market session
39
+ - MIN_3: 3 minutes
40
+ - MIN_5: 5 minutes
41
+ - DAY_1: 1 day
42
+ - DAY_5: 5 days
43
+ - MONTH_1: 1 month
44
+ - MONTH_3: 3 months
45
+ - WEEK_52: 52 weeks
46
+ """
47
+ if rank_type is not None:
48
+ self.add_query_param("rank_type", rank_type)
49
+
50
+ def set_category(self, category):
51
+ """
52
+ Set the security market category.
53
+
54
+ :param category: Security market category. Required.
55
+ Enum values: US_STOCK
56
+ """
57
+ if category is not None:
58
+ self.add_query_param("category", category)
59
+
60
+ def set_sort_by(self, sort_by):
61
+ """
62
+ Set the secondary sort field for further ordering within the ranking.
63
+
64
+ :param sort_by: Sort field. Required.
65
+ Enum values:
66
+ - CHANGE_RATIO: Price change percentage
67
+ - RELATIVE_VOLUME_10D: 10-day relative volume
68
+ - MARKET_VALUE: Market capitalization
69
+ - CLOSE: Closing price
70
+ - PRICE: Current price
71
+ - PE_TTM: Trailing twelve months P/E ratio
72
+ - HIGH: Intraday high
73
+ - LOW: Intraday low
74
+ - AMPLITUDE: Price amplitude
75
+ - TURNOVER: Turnover amount
76
+ - VOLUME: Trading volume
77
+ """
78
+ if sort_by is not None:
79
+ self.add_query_param("sort_by", sort_by)
80
+
81
+ def set_page_index(self, page_index):
82
+ """
83
+ Set the page number for pagination.
84
+
85
+ :param page_index: Page number, starting from 1. Optional.
86
+ """
87
+ if page_index is not None:
88
+ self.add_query_param("page_index", page_index)
89
+
90
+ def set_page_size(self, page_size):
91
+ """
92
+ Set the number of records per page.
93
+
94
+ :param page_size: Number of records returned per page. Optional.
95
+ """
96
+ if page_size is not None:
97
+ self.add_query_param("page_size", page_size)
98
+
99
+ def set_direction(self, direction):
100
+ """
101
+ Set the sort direction.
102
+
103
+ :param direction: Sort direction. Optional.
104
+ Enum values:
105
+ - ASC: Ascending order (for losers/worst performers)
106
+ - DESC: Descending order (for gainers/top performers)
107
+ """
108
+ if direction is not None:
109
+ self.add_query_param("direction", direction)
@@ -0,0 +1,110 @@
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 GetMostActiveRequest(ApiRequest):
21
+ """
22
+ Request class for Stock Top Active Rank API.
23
+
24
+ This API returns the most actively traded stocks ranked by volume, relative volume,
25
+ turnover, turnover rate, or amplitude.
26
+
27
+ Default sort: rank_type=VOLUME, order=VOLUME, direction=DESC
28
+
29
+ The relative_volume_10d field is unique to the Top Active response compared to
30
+ the Gainers/Losers endpoint.
31
+ """
32
+
33
+ def __init__(self):
34
+ ApiRequest.__init__(self, "/openapi/market-data/screener/most-active", version="v2", method="GET", query_params={})
35
+
36
+ def set_rank_type(self, rank_type):
37
+ """
38
+ Set the ranking dimension that determines which activity metric is used for filtering.
39
+
40
+ :param rank_type: Activity metric for ranking. Optional (defaults to VOLUME).
41
+ Enum values:
42
+ - VOLUME: Trading volume
43
+ - RELATIVE_VOLUME_10D: 10-day relative volume
44
+ - TURNOVER: Turnover amount
45
+ - TURNOVER_RATE: Turnover rate
46
+ - AMPLITUDE: Price amplitude
47
+ """
48
+ if rank_type is not None:
49
+ self.add_query_param("rank_type", rank_type)
50
+
51
+ def set_category(self, category):
52
+ """
53
+ Set the security market category.
54
+
55
+ :param category: Security market category. Required.
56
+ Enum values: US_STOCK
57
+ """
58
+ if category is not None:
59
+ self.add_query_param("category", category)
60
+
61
+ def set_sort_by(self, sort_by):
62
+ """
63
+ Set the secondary sort field for further ordering within the ranking.
64
+
65
+ :param sort_by: Sort field. Optional.
66
+ Enum values:
67
+ - CHANGE_RATIO: Price change percentage
68
+ - RELATIVE_VOLUME_10D: 10-day relative volume
69
+ - MARKET_VALUE: Market capitalization
70
+ - CLOSE: Closing price
71
+ - PRICE: Current price
72
+ - PE_TTM: Trailing twelve months P/E ratio
73
+ - HIGH: Intraday high
74
+ - LOW: Intraday low
75
+ - AMPLITUDE: Price amplitude
76
+ - TURNOVER: Turnover amount
77
+ - VOLUME: Trading volume
78
+ """
79
+ if sort_by is not None:
80
+ self.add_query_param("sort_by", sort_by)
81
+
82
+ def set_page_index(self, page_index):
83
+ """
84
+ Set the page number for pagination.
85
+
86
+ :param page_index: Page number, starting from 1. Optional.
87
+ """
88
+ if page_index is not None:
89
+ self.add_query_param("page_index", page_index)
90
+
91
+ def set_page_size(self, page_size):
92
+ """
93
+ Set the number of records per page.
94
+
95
+ :param page_size: Number of records returned per page. Optional.
96
+ """
97
+ if page_size is not None:
98
+ self.add_query_param("page_size", page_size)
99
+
100
+ def set_direction(self, direction):
101
+ """
102
+ Set the sort direction.
103
+
104
+ :param direction: Sort direction. Optional (defaults to DESC).
105
+ Enum values:
106
+ - ASC: Ascending order
107
+ - DESC: Descending order
108
+ """
109
+ if direction is not None:
110
+ self.add_query_param("direction", direction)
@@ -0,0 +1,13 @@
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.
@@ -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 AddWatchlistInstrumentsRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/instruments/add", version="v2", method="POST", body_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_body_params("watchlist_id", watchlist_id)
31
+
32
+ def set_instruments(self, instruments):
33
+ """
34
+ Set the list of instruments to add.
35
+
36
+ :param instruments: List of instruments to add. Each instrument should contain:
37
+ - symbol: Instrument symbol (e.g., AAPL)
38
+ - category: Instrument category (e.g., US_STOCK, US_CRYPTO)
39
+ - sort: Sort order number
40
+ """
41
+ self.add_body_params("instruments", instruments)
@@ -0,0 +1,39 @@
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 CreateWatchlistRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/create", version="v2", method="POST", body_params={})
23
+
24
+ def set_name(self, name):
25
+ """
26
+ Set the watchlist name.
27
+
28
+ :param name: Watchlist name. Maximum 1000 watchlists can be created.
29
+ """
30
+ self.add_body_params("name", name)
31
+
32
+ def set_sort(self, sort):
33
+ """
34
+ Set the sort order.
35
+
36
+ :param sort: Sort order number.
37
+ """
38
+ if sort is not None:
39
+ self.add_body_params("sort", sort)
@@ -0,0 +1,30 @@
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 DeleteWatchlistRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/delete", version="v2", method="POST", body_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_body_params("watchlist_id", watchlist_id)
@@ -0,0 +1,30 @@
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 GetWatchlistInstrumentsRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/instruments/list", version="v2", method="GET", query_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_query_param("watchlist_id", watchlist_id)
@@ -0,0 +1,22 @@
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 GetWatchlistRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/list", version="v2", method="GET", query_params={})
@@ -0,0 +1,40 @@
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 RemoveWatchlistInstrumentsRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/instruments/remove", version="v2", method="POST", body_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_body_params("watchlist_id", watchlist_id)
31
+
32
+ def set_instruments(self, instruments):
33
+ """
34
+ Set the list of instruments to remove.
35
+
36
+ :param instruments: List of instruments to remove. Each instrument should contain:
37
+ - symbol: Instrument symbol (e.g., AAPL)
38
+ - category: Instrument category (e.g., US_STOCK)
39
+ """
40
+ self.add_body_params("instruments", instruments)
@@ -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 UpdateWatchlistInstrumentsRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/instruments/update", version="v2", method="POST", body_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_body_params("watchlist_id", watchlist_id)
31
+
32
+ def set_instruments(self, instruments):
33
+ """
34
+ Set the list of instruments to update.
35
+
36
+ :param instruments: List of instruments to update. Each instrument should contain:
37
+ - symbol: Instrument symbol (for locating)
38
+ - category: Instrument category (for locating)
39
+ - sort: New sort order number
40
+ """
41
+ self.add_body_params("instruments", instruments)
@@ -0,0 +1,48 @@
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 UpdateWatchlistRequest(ApiRequest):
21
+ def __init__(self):
22
+ ApiRequest.__init__(self, "/openapi/market-data/watchlist/update", version="v2", method="POST", body_params={})
23
+
24
+ def set_watchlist_id(self, watchlist_id):
25
+ """
26
+ Set the watchlist unique identifier.
27
+
28
+ :param watchlist_id: Watchlist unique identifier.
29
+ """
30
+ self.add_body_params("watchlist_id", watchlist_id)
31
+
32
+ def set_name(self, name):
33
+ """
34
+ Set the new watchlist name.
35
+
36
+ :param name: New watchlist name.
37
+ """
38
+ if name is not None:
39
+ self.add_body_params("name", name)
40
+
41
+ def set_sort(self, sort):
42
+ """
43
+ Set the new sort order.
44
+
45
+ :param sort: New sort order number.
46
+ """
47
+ if sort is not None:
48
+ self.add_body_params("sort", sort)
webull/trade/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.0.4'
1
+ __version__ = '2.0.6'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webull-openapi-python-sdk
3
- Version: 2.0.4
3
+ Version: 2.0.6
4
4
  Summary: Webull Python SDK.
5
5
  Home-page:
6
6
  Author: Webull