Skip to content

Commit 8d0dbc4

Browse files
committed
feat:added security information interfaces
1 parent 4981d4e commit 8d0dbc4

File tree

14 files changed

+85
-13
lines changed

14 files changed

+85
-13
lines changed

webull-python-sdk-core/webullsdkcore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.6"
1+
__version__ = "0.1.7"
22

33
import logging
44

webull-python-sdk-demos/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
LONG_DESCRIPTION = fp.read()
1616

1717
requires = [
18-
"webull-python-sdk-mdata==0.1.6",
19-
"webull-python-sdk-trade==0.1.6"
18+
"webull-python-sdk-mdata==0.1.7",
19+
"webull-python-sdk-trade==0.1.7"
2020
]
2121

2222
setup_args = {

webull-python-sdk-demos/tests/trade/test_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
from webullsdkcore.client import ApiClient
1919
from webullsdkmdata.common.category import Category
2020
from webullsdktrade.api import API
21+
from webullsdktrade.common.markets import Markets
22+
from webullsdktrade.common.instrument_type import InstrumentType
23+
2124

2225
optional_api_endpoint = "<api_endpoint>"
2326
your_app_key = "<your_app_key>"
@@ -48,6 +51,9 @@ def test_api(self):
4851
if res.status_code == 200:
4952
print(res.json())
5053
res = api.trade_instrument.get_trade_instrument_detail("913244615")
54+
if res.status_code == 200:
55+
print(res.json())
56+
res = api.trade_instrument.get_trade_security_detail("SPX", Markets.US.name, "OPTION", InstrumentType.CALL_OPTION.name, "3400", "2024-12-20")
5157
if res.status_code == 200:
5258
print(res.json())
5359
res = api.market_data.get_snapshot('AAPL', 'US_STOCK')

webull-python-sdk-mdata/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
LONG_DESCRIPTION = fp.read()
1616

1717
requires = [
18-
"webull-python-sdk-core==0.1.6",
19-
"webull-python-sdk-quotes-core==0.1.6"
18+
"webull-python-sdk-core==0.1.7",
19+
"webull-python-sdk-quotes-core==0.1.7"
2020
]
2121

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

3-
__version__ = '0.1.6'
3+
__version__ = '0.1.7'

webull-python-sdk-quotes-core/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"grpcio==1.51.1",
2525
"grpcio-tools==1.51.1",
2626
"protobuf==4.21.12",
27-
"webull-python-sdk-core==0.1.6"
27+
"webull-python-sdk-core==0.1.7"
2828
]
2929

3030
setup_args = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.6"
1+
__version__ = "0.1.7"

webull-python-sdk-trade-events-core/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"grpcio==1.51.1",
2424
"grpcio-tools==1.51.1",
2525
"protobuf==4.21.12",
26-
"webull-python-sdk-core==0.1.6"
26+
"webull-python-sdk-core==0.1.7"
2727
]
2828

2929
setup_args = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.6"
1+
__version__ = "0.1.7"

webull-python-sdk-trade/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
LONG_DESCRIPTION = fp.read()
1616

1717
requires = [
18-
"webull-python-sdk-trade-events-core==0.1.6",
19-
"webull-python-sdk-core==0.1.6"
18+
"webull-python-sdk-trade-events-core==0.1.7",
19+
"webull-python-sdk-core==0.1.7"
2020
]
2121

2222
setup_args = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.1.6"
1+
__version__ = "0.1.7"
22

webull-python-sdk-trade/webullsdktrade/common/instrument_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ class InstrumentType(EasyEnum):
2323
UNIT = (3, "UNIT")
2424
WARRANT = (4, "WARRANT")
2525
RIGHT = (5, "RIGHT")
26+
CALL_OPTION = (6, "CALL_OPTION")
27+
PUT_OPTION = (7, "PUT_OPTION")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
from webullsdkcore.request import ApiRequest
17+
18+
19+
class TradeSecurityDetailRequest(ApiRequest):
20+
def __init__(self):
21+
ApiRequest.__init__(self, "/trade/security", version='v1', method="GET", query_params={})
22+
23+
def set_account_id(self, account_id):
24+
self.add_query_param("account_id", account_id)
25+
26+
def set_symbol(self, symbol):
27+
self.add_query_param("symbol", symbol)
28+
29+
def set_market(self, market):
30+
self.add_query_param("market", market)
31+
32+
def set_instrument_super_type(self, instrument_super_type):
33+
self.add_query_param("instrument_super_type", instrument_super_type)
34+
35+
def set_instrument_type(self, instrument_type):
36+
self.add_query_param("instrument_type", instrument_type)
37+
38+
def set_strike_price(self, strike_price):
39+
self.add_query_param("strike_price", strike_price)
40+
41+
def set_init_exp_date(self, init_exp_date):
42+
self.add_query_param("init_exp_date", init_exp_date)

webull-python-sdk-trade/webullsdktrade/trade/trade_instrument.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
from webullsdktrade.request.get_trade_instrument_detail_request import TradeInstrumentDetailRequest
15+
from webullsdktrade.request.get_trade_security_detail_request import TradeSecurityDetailRequest
1516

1617

1718
class TradeInstrument:
@@ -29,3 +30,24 @@ def get_trade_instrument_detail(self, instrument_id):
2930
instrument_detail_request.set_instrument_id(instrument_id)
3031
response = self.client.get_response(instrument_detail_request)
3132
return response
33+
34+
def get_trade_security_detail(self, symbol, market, instrument_super_type, instrument_type, strike_price, init_exp_date):
35+
"""
36+
Query the information of traded symbol.
37+
38+
:param symbol: The ticker symbol or code representing a specific financial instrument or security.
39+
:param market: e.g. US, HK.
40+
:param instrument_super_type: Asset Class (e.g. EQUITY, OPTION.)
41+
:param instrument_type: Type of underlying equity,required when querying for options information (e.g., WARRANT, UNITS, ETF, CALL_OPTION, PUT_OPTION).
42+
:param strike_price: Option Strike Price, required when querying for options information.
43+
:param init_exp_date: Option Expiration Date, Format: yyyy-MM-dd, required when querying for options information.
44+
"""
45+
security_detail_request = TradeSecurityDetailRequest()
46+
security_detail_request.set_symbol(symbol)
47+
security_detail_request.set_market(market)
48+
security_detail_request.set_instrument_super_type(instrument_super_type)
49+
security_detail_request.set_instrument_type(instrument_type)
50+
security_detail_request.set_strike_price(strike_price)
51+
security_detail_request.set_init_exp_date(init_exp_date)
52+
response = self.client.get_response(security_detail_request)
53+
return response

0 commit comments

Comments
 (0)