webull-openapi-python-sdk 3.0.2__py3-none-any.whl → 3.0.4__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/community.py +62 -0
- samples/data/data_client.py +79 -0
- samples/data/data_client_event.py +7 -0
- webull/__init__.py +1 -1
- webull/core/__init__.py +1 -1
- webull/data/__init__.py +1 -1
- webull/data/data_client.py +4 -0
- webull/data/quotes/community.py +105 -0
- webull/data/quotes/crypto_market_data.py +6 -1
- webull/data/quotes/event_market_data.py +6 -1
- webull/data/quotes/fundamentals.py +99 -0
- webull/data/quotes/futures_market_data.py +6 -1
- webull/data/quotes/news.py +70 -0
- webull/data/quotes/option_market_data.py +6 -1
- webull/data/quotes/screener.py +34 -0
- webull/data/request/create_comment_request.py +33 -0
- webull/data/request/create_post_request.py +39 -0
- webull/data/request/get_crypto_historical_bars_request.py +8 -0
- webull/data/request/get_economic_calendar_request.py +39 -0
- webull/data/request/get_event_bars_request.py +9 -1
- webull/data/request/get_futures_historical_bars_request.py +9 -1
- webull/data/request/get_insider_holdings_request.py +35 -0
- webull/data/request/get_insider_transactions_request.py +39 -0
- webull/data/request/get_institution_holding_changes_request.py +39 -0
- webull/data/request/get_institution_holdings_request.py +31 -0
- webull/data/request/get_institution_search_request.py +31 -0
- webull/data/request/get_news_detail_request.py +27 -0
- webull/data/request/get_news_search_request.py +39 -0
- webull/data/request/get_option_bars_request.py +21 -0
- webull/data/request/get_post_request.py +29 -0
- webull/data/request/get_stock_news_request.py +39 -0
- webull/data/request/list_hot_stocks_request.py +25 -0
- webull/data/request/list_my_posts_request.py +30 -0
- webull/data/request/list_posts_by_symbol_request.py +43 -0
- webull/data/request/screener/get_fear_and_greed_index_request.py +27 -0
- webull/data/request/screener/get_stock_unusual_activities_request.py +43 -0
- webull/trade/__init__.py +1 -1
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/METADATA +1 -1
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/RECORD +44 -24
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/WHEEL +0 -0
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/licenses/LICENSE +0 -0
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/licenses/NOTICE +0 -0
- {webull_openapi_python_sdk-3.0.2.dist-info → webull_openapi_python_sdk-3.0.4.dist-info}/top_level.txt +0 -0
webull/data/quotes/screener.py
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
# coding=utf-8
|
|
16
16
|
|
|
17
|
+
from webull.data.common.category import Category
|
|
17
18
|
from webull.data.request.screener.get_gainers_losers_request import GetGainersLosersRequest
|
|
18
19
|
from webull.data.request.screener.get_gainers_losers_request_v2 import GetGainersLosersRequestV2
|
|
19
20
|
from webull.data.request.screener.get_most_active_request import GetMostActiveRequest
|
|
@@ -26,6 +27,8 @@ from webull.data.request.screener.get_high_dividend_request import GetHighDivide
|
|
|
26
27
|
from webull.data.request.screener.get_high_dividend_request_v2 import GetHighDividendRequestV2
|
|
27
28
|
from webull.data.request.screener.get_52whl_request import Get52WHLRequest
|
|
28
29
|
from webull.data.request.screener.get_52whl_request_v2 import Get52WHLRequestV2
|
|
30
|
+
from webull.data.request.screener.get_fear_and_greed_index_request import GetFearAndGreedIndexRequest
|
|
31
|
+
from webull.data.request.screener.get_stock_unusual_activities_request import GetStockUnusualActivitiesRequest
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
class Screener:
|
|
@@ -381,3 +384,34 @@ class Screener:
|
|
|
381
384
|
request.set_direction(direction)
|
|
382
385
|
response = self.client.get_response(request)
|
|
383
386
|
return response
|
|
387
|
+
|
|
388
|
+
def get_fear_and_greed_index(self, category=Category.US_STOCK.name):
|
|
389
|
+
"""
|
|
390
|
+
Query the market fear & greed sentiment index, with current and historical
|
|
391
|
+
comparison points (previous day, one week ago, one month ago).
|
|
392
|
+
:param category: Market category. Supported: US_STOCK (default), HK_STOCK.
|
|
393
|
+
"""
|
|
394
|
+
request = GetFearAndGreedIndexRequest()
|
|
395
|
+
request.set_category(category)
|
|
396
|
+
response = self.client.get_response(request)
|
|
397
|
+
return response
|
|
398
|
+
|
|
399
|
+
def get_stock_unusual_activities(self, symbol=None, category=Category.US_STOCK.name, count=None,
|
|
400
|
+
alert_types=None, extended_hours_required=None):
|
|
401
|
+
"""
|
|
402
|
+
Query recent unusual activity alerts for a stock (volume surge, price spike, etc.).
|
|
403
|
+
Returns up to count most recent events within the last 90 calendar days.
|
|
404
|
+
:param symbol: Stock symbol, e.g. NVDA (optional).
|
|
405
|
+
:param category: Market category, default US_STOCK.
|
|
406
|
+
:param count: Number of most recent events, default 10, max 30.
|
|
407
|
+
:param alert_types: Comma-separated alert type filter, None to return all.
|
|
408
|
+
:param extended_hours_required: Whether to include pre-market and after-hours alerts.
|
|
409
|
+
"""
|
|
410
|
+
request = GetStockUnusualActivitiesRequest()
|
|
411
|
+
request.set_symbol(symbol)
|
|
412
|
+
request.set_category(category)
|
|
413
|
+
request.set_count(count)
|
|
414
|
+
request.set_alert_types(alert_types)
|
|
415
|
+
request.set_extended_hours_required(extended_hours_required)
|
|
416
|
+
response = self.client.get_response(request)
|
|
417
|
+
return response
|
|
@@ -0,0 +1,33 @@
|
|
|
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 CreateCommentRequest(ApiRequest):
|
|
21
|
+
"""Request for creating a plain-text comment on a community post."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/comments/create", version="v3", method="POST",
|
|
25
|
+
body_params={})
|
|
26
|
+
|
|
27
|
+
def set_post_id(self, post_id):
|
|
28
|
+
"""Set the parent post identifier."""
|
|
29
|
+
self.add_body_params("post_id", post_id)
|
|
30
|
+
|
|
31
|
+
def set_text(self, text):
|
|
32
|
+
"""Set the comment text."""
|
|
33
|
+
self.add_body_params("text", text)
|
|
@@ -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 CreatePostRequest(ApiRequest):
|
|
21
|
+
"""Request for creating a plain-text community post."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/posts/create", version="v3", method="POST",
|
|
25
|
+
body_params={})
|
|
26
|
+
|
|
27
|
+
def set_text(self, text):
|
|
28
|
+
"""Set the post text."""
|
|
29
|
+
self.add_body_params("text", text)
|
|
30
|
+
|
|
31
|
+
def set_symbol(self, symbol):
|
|
32
|
+
"""Set the optional ticker symbol."""
|
|
33
|
+
if symbol is not None:
|
|
34
|
+
self.add_body_params("symbol", symbol)
|
|
35
|
+
|
|
36
|
+
def set_category(self, category):
|
|
37
|
+
"""Set the optional ticker market category."""
|
|
38
|
+
if category is not None:
|
|
39
|
+
self.add_body_params("category", category)
|
|
@@ -38,3 +38,11 @@ class GetCryptoHistoricalBarsRequest(ApiRequest):
|
|
|
38
38
|
def set_real_time_required(self, real_time_required):
|
|
39
39
|
if real_time_required:
|
|
40
40
|
self.add_query_param("real_time_required", real_time_required)
|
|
41
|
+
|
|
42
|
+
def set_start_time(self, start_time):
|
|
43
|
+
if start_time is not None:
|
|
44
|
+
self.add_query_param("start_time", start_time)
|
|
45
|
+
|
|
46
|
+
def set_end_time(self, end_time):
|
|
47
|
+
if end_time is not None:
|
|
48
|
+
self.add_query_param("end_time", end_time)
|
|
@@ -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 GetEconomicCalendarRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/economic-calendars/list", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_region(self, region):
|
|
26
|
+
if region:
|
|
27
|
+
self.add_query_param("region", region)
|
|
28
|
+
|
|
29
|
+
def set_start_date(self, start_date):
|
|
30
|
+
if start_date:
|
|
31
|
+
self.add_query_param("start_date", start_date)
|
|
32
|
+
|
|
33
|
+
def set_end_date(self, end_date):
|
|
34
|
+
if end_date:
|
|
35
|
+
self.add_query_param("end_date", end_date)
|
|
36
|
+
|
|
37
|
+
def set_pagination_key(self, pagination_key):
|
|
38
|
+
if pagination_key:
|
|
39
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -40,4 +40,12 @@ class GetEventBarsRequest(ApiRequest):
|
|
|
40
40
|
|
|
41
41
|
def set_real_time_required(self, real_time_required):
|
|
42
42
|
if real_time_required:
|
|
43
|
-
self.add_query_param("real_time_required", real_time_required)
|
|
43
|
+
self.add_query_param("real_time_required", real_time_required)
|
|
44
|
+
|
|
45
|
+
def set_start_time(self, start_time):
|
|
46
|
+
if start_time is not None:
|
|
47
|
+
self.add_query_param("start_time", start_time)
|
|
48
|
+
|
|
49
|
+
def set_end_time(self, end_time):
|
|
50
|
+
if end_time is not None:
|
|
51
|
+
self.add_query_param("end_time", end_time)
|
|
@@ -33,4 +33,12 @@ class GetFuturesHistoricalBarsRequest(ApiRequest):
|
|
|
33
33
|
|
|
34
34
|
def set_real_time_required(self, real_time_required):
|
|
35
35
|
if real_time_required:
|
|
36
|
-
self.add_query_param("real_time_required", real_time_required)
|
|
36
|
+
self.add_query_param("real_time_required", real_time_required)
|
|
37
|
+
|
|
38
|
+
def set_start_time(self, start_time):
|
|
39
|
+
if start_time is not None:
|
|
40
|
+
self.add_query_param("start_time", start_time)
|
|
41
|
+
|
|
42
|
+
def set_end_time(self, end_time):
|
|
43
|
+
if end_time is not None:
|
|
44
|
+
self.add_query_param("end_time", end_time)
|
|
@@ -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 GetInsiderHoldingsRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/insider-holdings/get", version='v3', 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_compare_months(self, compare_months):
|
|
34
|
+
if compare_months:
|
|
35
|
+
self.add_query_param("compare_months", compare_months)
|
|
@@ -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 GetInsiderTransactionsRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/insider-transactions/list", version='v3', 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_side(self, side):
|
|
34
|
+
if side:
|
|
35
|
+
self.add_query_param("side", side)
|
|
36
|
+
|
|
37
|
+
def set_pagination_key(self, pagination_key):
|
|
38
|
+
if pagination_key:
|
|
39
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -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 GetInstitutionHoldingChangesRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/institutions/holding-changes/list", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_cik(self, cik):
|
|
26
|
+
if cik is not None:
|
|
27
|
+
self.add_query_param("cik", cik)
|
|
28
|
+
|
|
29
|
+
def set_position(self, position):
|
|
30
|
+
if position:
|
|
31
|
+
self.add_query_param("position", position)
|
|
32
|
+
|
|
33
|
+
def set_count(self, count):
|
|
34
|
+
if count:
|
|
35
|
+
self.add_query_param("count", count)
|
|
36
|
+
|
|
37
|
+
def set_pagination_key(self, pagination_key):
|
|
38
|
+
if pagination_key:
|
|
39
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -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 GetInstitutionHoldingsRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/institutions/holdings/list", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_cik(self, cik):
|
|
26
|
+
if cik is not None:
|
|
27
|
+
self.add_query_param("cik", cik)
|
|
28
|
+
|
|
29
|
+
def set_pagination_key(self, pagination_key):
|
|
30
|
+
if pagination_key:
|
|
31
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -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 GetInstitutionSearchRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/fundamentals/institutions/list", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_keyword(self, keyword):
|
|
26
|
+
if keyword is not None:
|
|
27
|
+
self.add_query_param("keyword", keyword)
|
|
28
|
+
|
|
29
|
+
def set_pagination_key(self, pagination_key):
|
|
30
|
+
if pagination_key:
|
|
31
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -0,0 +1,27 @@
|
|
|
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 GetNewsDetailRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/news/detail/get", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_news_id(self, news_id):
|
|
26
|
+
if news_id is not None:
|
|
27
|
+
self.add_query_param("news_id", news_id)
|
|
@@ -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 GetNewsSearchRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/news/search/list", version='v3', method="GET",
|
|
23
|
+
query_params={})
|
|
24
|
+
|
|
25
|
+
def set_keyword(self, keyword):
|
|
26
|
+
if keyword is not None:
|
|
27
|
+
self.add_query_param("keyword", keyword)
|
|
28
|
+
|
|
29
|
+
def set_start_date(self, start_date):
|
|
30
|
+
if start_date:
|
|
31
|
+
self.add_query_param("start_date", start_date)
|
|
32
|
+
|
|
33
|
+
def set_end_date(self, end_date):
|
|
34
|
+
if end_date:
|
|
35
|
+
self.add_query_param("end_date", end_date)
|
|
36
|
+
|
|
37
|
+
def set_pagination_key(self, pagination_key):
|
|
38
|
+
if pagination_key:
|
|
39
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -71,3 +71,24 @@ class GetOptionBarsRequest(ApiRequest):
|
|
|
71
71
|
"""
|
|
72
72
|
if real_time_required is not None:
|
|
73
73
|
self.add_query_param("real_time_required", real_time_required)
|
|
74
|
+
|
|
75
|
+
def set_start_time(self, start_time):
|
|
76
|
+
"""
|
|
77
|
+
Set the start time of the query range.
|
|
78
|
+
|
|
79
|
+
:param start_time: Start time as a timestamp in milliseconds, used to specify
|
|
80
|
+
the beginning of the time range for bar data. Example: 1711262998500
|
|
81
|
+
"""
|
|
82
|
+
if start_time is not None:
|
|
83
|
+
self.add_query_param("start_time", start_time)
|
|
84
|
+
|
|
85
|
+
def set_end_time(self, end_time):
|
|
86
|
+
"""
|
|
87
|
+
Set the end time of the query range.
|
|
88
|
+
|
|
89
|
+
:param end_time: End time as a timestamp in milliseconds, used to specify the end
|
|
90
|
+
of the time range for bar data. Delayed permission will automatically
|
|
91
|
+
offset the time. Example: 1711349398500
|
|
92
|
+
"""
|
|
93
|
+
if end_time is not None:
|
|
94
|
+
self.add_query_param("end_time", end_time)
|
|
@@ -0,0 +1,29 @@
|
|
|
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 GetPostRequest(ApiRequest):
|
|
21
|
+
"""Request for retrieving a community post by identifier."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/posts/get", version="v3", method="GET",
|
|
25
|
+
query_params={})
|
|
26
|
+
|
|
27
|
+
def set_post_id(self, post_id):
|
|
28
|
+
"""Set the post identifier."""
|
|
29
|
+
self.add_query_param("post_id", post_id)
|
|
@@ -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 GetStockNewsRequest(ApiRequest):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
ApiRequest.__init__(self, "/market-data/news/stock-news/list", version='v3', 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_sentiment(self, sentiment):
|
|
34
|
+
if sentiment:
|
|
35
|
+
self.add_query_param("sentiment", sentiment)
|
|
36
|
+
|
|
37
|
+
def set_pagination_key(self, pagination_key):
|
|
38
|
+
if pagination_key:
|
|
39
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -0,0 +1,25 @@
|
|
|
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 ListHotStocksRequest(ApiRequest):
|
|
21
|
+
"""Request for listing stocks ranked by community activity."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/stock-rankings/list", version="v3", method="GET",
|
|
25
|
+
query_params={})
|
|
@@ -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 ListMyPostsRequest(ApiRequest):
|
|
21
|
+
"""Request for listing posts created by the current user."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/my-posts/list", version="v3", method="GET",
|
|
25
|
+
query_params={})
|
|
26
|
+
|
|
27
|
+
def set_pagination_key(self, pagination_key):
|
|
28
|
+
"""Set the optional pagination key from the previous response."""
|
|
29
|
+
if pagination_key is not None:
|
|
30
|
+
self.add_query_param("pagination_key", pagination_key)
|
|
@@ -0,0 +1,43 @@
|
|
|
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 ListPostsBySymbolRequest(ApiRequest):
|
|
21
|
+
"""Request for listing community posts associated with a symbol."""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
ApiRequest.__init__(self, "/market-data/communities/posts/symbols/list", version="v3", method="GET",
|
|
25
|
+
query_params={})
|
|
26
|
+
|
|
27
|
+
def set_symbol(self, symbol):
|
|
28
|
+
"""Set the stock symbol."""
|
|
29
|
+
self.add_query_param("symbol", symbol)
|
|
30
|
+
|
|
31
|
+
def set_category(self, category):
|
|
32
|
+
"""Set the market category."""
|
|
33
|
+
self.add_query_param("category", category)
|
|
34
|
+
|
|
35
|
+
def set_keyword(self, keyword):
|
|
36
|
+
"""Set the optional search keyword."""
|
|
37
|
+
if keyword is not None:
|
|
38
|
+
self.add_query_param("keyword", keyword)
|
|
39
|
+
|
|
40
|
+
def set_pagination_key(self, pagination_key):
|
|
41
|
+
"""Set the optional pagination key from the previous response."""
|
|
42
|
+
if pagination_key is not None:
|
|
43
|
+
self.add_query_param("pagination_key", pagination_key)
|