Skip to content

Commit 77aaf1d

Browse files
committed
position query asset_quote_type
1 parent ebd9ab2 commit 77aaf1d

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

tigeropen/common/consts/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,11 @@ class OptionRankingIndicator(Enum):
246246
Volume = "volume"
247247
Amount = "amount"
248248
OpenInt = "openInt"
249+
250+
class AssetQuoteType(Enum):
251+
# Includes pre-market, intra-day, and after-hours trading data. For night session, the closing price of the previous after-hours trading is used for calculation.
252+
ETH = "ETH"
253+
# Only intra-day trading data. For pre-market, after-hours, and night session, the intra-day closing price is used for calculation.
254+
RTH = "RTH"
255+
# Includes night session trading data. For night session, the night session trading data is used for calculation.
256+
OVERNIGHT = "OVERNIGHT"

tigeropen/trade/request/model.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def __init__(self):
145145
self._expiry = None
146146
self._strike = None
147147
self._right = None
148+
self._asset_quote_type = None
148149

149150
@property
150151
def account(self):
@@ -226,6 +227,14 @@ def right(self):
226227
def right(self, value):
227228
self._right = value
228229

230+
@property
231+
def asset_quote_type(self):
232+
return self._asset_quote_type
233+
234+
@asset_quote_type.setter
235+
def asset_quote_type(self, value):
236+
self._asset_quote_type = value
237+
229238
def to_openapi_dict(self):
230239
params = super().to_openapi_dict()
231240
if self.account:
@@ -258,6 +267,9 @@ def to_openapi_dict(self):
258267
if self.right:
259268
params['right'] = self.right
260269

270+
if self.asset_quote_type:
271+
params['asset_quote_type'] = self.asset_quote_type
272+
261273
return params
262274

263275

tigeropen/trade/trade_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def get_derivative_contracts(self, symbol, sec_type, expiry, lang=None):
192192
return None
193193

194194
def get_positions(self, account=None, sec_type=SecurityType.STK, currency=Currency.ALL, market=Market.ALL,
195-
symbol=None, sub_accounts=None, expiry=None, strike=None, put_call=None):
195+
symbol=None, sub_accounts=None, expiry=None, strike=None, put_call=None, asset_quote_type=None):
196196
"""
197197
获取持仓数据
198198
:param account:
@@ -201,6 +201,7 @@ def get_positions(self, account=None, sec_type=SecurityType.STK, currency=Curren
201201
:param market:
202202
:param symbol:
203203
:param sub_accounts:
204+
:param asset_quote_type: 资产行情模式
204205
:return: 由 Position 对象构成的列表. Position 对象有如下属性:
205206
account: 所属账户
206207
contract: 合约对象
@@ -225,6 +226,8 @@ def get_positions(self, account=None, sec_type=SecurityType.STK, currency=Curren
225226
params.strike = strike
226227
if put_call:
227228
params.right = put_call
229+
if asset_quote_type:
230+
params.asset_quote_type = get_enum_value(asset_quote_type)
228231
params.lang = get_enum_value(self._lang)
229232
request = OpenApiRequest(POSITIONS, biz_model=params)
230233
response_content = self.__fetch_data(request)

0 commit comments

Comments
 (0)