Skip to content

Commit 5624810

Browse files
committed
Merge branch 'feat_sub_id' into 'master'
subscribe request return id See merge request server/openapi/openapi-python-sdk!240
2 parents e50a5ab + 2a562a3 commit 5624810

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## 3.3.7 (2025-05-08)
1+
## 3.3.7 (2025-05-12)
22
### New
33
- 订单回调添加属性 `attrList`
4-
4+
- `QuoteClient` 各订阅方法返回订阅id
55

66
## 3.3.6 (2025-04-28)
77
### New

tigeropen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
55
@author: gaoan
66
"""
7-
__VERSION__ = '3.3.6'
7+
__VERSION__ = '3.3.7'

tigeropen/push/protobuf_push_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def subscribe_asset(self, account=None):
213213
"""
214214
req = ProtoMessageUtil.build_subscribe_trade_message(SocketCommon.DataType.Asset, account)
215215
self._connection.send_frame(req)
216+
return req.id
216217

217218
def unsubscribe_asset(self, account=None):
218219
"""
@@ -221,6 +222,7 @@ def unsubscribe_asset(self, account=None):
221222
"""
222223
req = ProtoMessageUtil.build_unsubscribe_trade_message(SocketCommon.DataType.Asset, account)
223224
self._connection.send_frame(req)
225+
return req.id
224226

225227
def subscribe_position(self, account=None):
226228
"""
@@ -229,6 +231,7 @@ def subscribe_position(self, account=None):
229231
"""
230232
req = ProtoMessageUtil.build_subscribe_trade_message(SocketCommon.DataType.Position, account)
231233
self._connection.send_frame(req)
234+
return req.id
232235

233236
def unsubscribe_position(self, account=None):
234237
"""
@@ -237,6 +240,7 @@ def unsubscribe_position(self, account=None):
237240
"""
238241
req = ProtoMessageUtil.build_unsubscribe_trade_message(SocketCommon.DataType.Position, account)
239242
self._connection.send_frame(req)
243+
return req.id
240244

241245
def subscribe_order(self, account=''):
242246
"""
@@ -245,6 +249,7 @@ def subscribe_order(self, account=''):
245249
"""
246250
req = ProtoMessageUtil.build_subscribe_trade_message(SocketCommon.DataType.OrderStatus, account)
247251
self._connection.send_frame(req)
252+
return req.id
248253

249254
def unsubscribe_order(self, account=None):
250255
"""
@@ -253,6 +258,7 @@ def unsubscribe_order(self, account=None):
253258
"""
254259
req = ProtoMessageUtil.build_unsubscribe_trade_message(SocketCommon.DataType.OrderStatus, account)
255260
self._connection.send_frame(req)
261+
return req.id
256262

257263
def subscribe_transaction(self, account=None):
258264
"""
@@ -261,6 +267,7 @@ def subscribe_transaction(self, account=None):
261267
"""
262268
req = ProtoMessageUtil.build_subscribe_trade_message(SocketCommon.DataType.OrderTransaction, account)
263269
self._connection.send_frame(req)
270+
return req.id
264271

265272
def unsubscribe_transaction(self, account=None):
266273
"""
@@ -269,6 +276,7 @@ def unsubscribe_transaction(self, account=None):
269276
"""
270277
req = ProtoMessageUtil.build_unsubscribe_trade_message(SocketCommon.DataType.OrderTransaction, account)
271278
self._connection.send_frame(req)
279+
return req.id
272280

273281
def subscribe_quote(self, symbols):
274282
"""
@@ -278,6 +286,7 @@ def subscribe_quote(self, symbols):
278286
"""
279287
req = ProtoMessageUtil.build_subscribe_quote_message(symbols)
280288
self._connection.send_frame(req)
289+
return req.id
281290

282291
def subscribe_tick(self, symbols):
283292
"""
@@ -287,6 +296,7 @@ def subscribe_tick(self, symbols):
287296
"""
288297
req = ProtoMessageUtil.build_subscribe_tick_quote_message(symbols)
289298
self._connection.send_frame(req)
299+
return req.id
290300

291301
def subscribe_depth_quote(self, symbols):
292302
"""
@@ -296,6 +306,7 @@ def subscribe_depth_quote(self, symbols):
296306
"""
297307
req = ProtoMessageUtil.build_subscribe_depth_quote_message(symbols)
298308
self._connection.send_frame(req)
309+
return req.id
299310

300311
def subscribe_option(self, symbols):
301312
"""
@@ -305,6 +316,7 @@ def subscribe_option(self, symbols):
305316
"""
306317
req = ProtoMessageUtil.build_subscribe_quote_message(symbols)
307318
self._connection.send_frame(req)
319+
return req.id
308320

309321
def subscribe_future(self, symbols):
310322
"""
@@ -314,6 +326,7 @@ def subscribe_future(self, symbols):
314326
"""
315327
req = ProtoMessageUtil.build_subscribe_quote_message(symbols, data_type=SocketCommon.Future)
316328
self._connection.send_frame(req)
329+
return req.id
317330

318331
def subscribe_stock_top(self, market, indicators):
319332
"""
@@ -328,6 +341,7 @@ def subscribe_stock_top(self, market, indicators):
328341
req = ProtoMessageUtil.build_subscribe_quote_message(symbols=indicator_names, data_type=SocketCommon.StockTop,
329342
market=market)
330343
self._connection.send_frame(req)
344+
return req.id
331345

332346
def unsubscribe_stock_top(self, market, indicators):
333347
"""
@@ -342,6 +356,7 @@ def unsubscribe_stock_top(self, market, indicators):
342356
req = ProtoMessageUtil.build_unsubscribe_quote_message(symbols=indicator_names, data_type=SocketCommon.StockTop,
343357
market=market)
344358
self._connection.send_frame(req)
359+
return req.id
345360

346361
def subscribe_option_top(self, market, indicators):
347362
"""
@@ -356,6 +371,7 @@ def subscribe_option_top(self, market, indicators):
356371
req = ProtoMessageUtil.build_subscribe_quote_message(symbols=indicator_names, data_type=SocketCommon.OptionTop,
357372
market=market)
358373
self._connection.send_frame(req)
374+
return req.id
359375

360376
def unsubscribe_option_top(self, market, indicators):
361377
"""
@@ -370,6 +386,7 @@ def unsubscribe_option_top(self, market, indicators):
370386
req = ProtoMessageUtil.build_unsubscribe_quote_message(symbols=indicator_names, data_type=SocketCommon.OptionTop,
371387
market=market)
372388
self._connection.send_frame(req)
389+
return req.id
373390

374391
def query_subscribed_quote(self):
375392
"""
@@ -378,6 +395,7 @@ def query_subscribed_quote(self):
378395
"""
379396
req = ProtoMessageUtil.build_subscribe_query_message()
380397
self._connection.send_frame(req)
398+
return req.id
381399

382400
def unsubscribe_quote(self, symbols=None):
383401
"""
@@ -386,6 +404,7 @@ def unsubscribe_quote(self, symbols=None):
386404
"""
387405
req = ProtoMessageUtil.build_unsubscribe_quote_message(symbols)
388406
self._connection.send_frame(req)
407+
return req.id
389408

390409
def unsubscribe_tick(self, symbols=None):
391410
"""
@@ -394,6 +413,7 @@ def unsubscribe_tick(self, symbols=None):
394413
"""
395414
req = ProtoMessageUtil.build_unsubscribe_tick_quote_message(symbols)
396415
self._connection.send_frame(req)
416+
return req.id
397417

398418
def unsubscribe_depth_quote(self, symbols=None):
399419
"""
@@ -402,6 +422,7 @@ def unsubscribe_depth_quote(self, symbols=None):
402422
"""
403423
req = ProtoMessageUtil.build_unsubscribe_depth_quote_message(symbols)
404424
self._connection.send_frame(req)
425+
return req.id
405426

406427
def subscribe_kline(self, symbols=None):
407428
"""
@@ -411,6 +432,7 @@ def subscribe_kline(self, symbols=None):
411432
"""
412433
req = ProtoMessageUtil.build_subscribe_kline_message(symbols)
413434
self._connection.send_frame(req)
435+
return req.id
414436

415437
def unsubscribe_kline(self, symbols=None):
416438
"""
@@ -420,14 +442,17 @@ def unsubscribe_kline(self, symbols=None):
420442
"""
421443
req = ProtoMessageUtil.build_unsubscribe_kline_message(symbols)
422444
self._connection.send_frame(req)
445+
return req.id
423446

424447
def subscribe_market(self, market):
425448
req = ProtoMessageUtil.build_subscribe_market_message(market)
426449
self._connection.send_frame(req)
450+
return req.id
427451

428452
def unsubscribe_market(self, market):
429453
req = ProtoMessageUtil.build_unsubscribe_market_message(market)
430454
self._connection.send_frame(req)
455+
return req.id
431456

432457
def _convert_tick(self, data: TradeTickData):
433458
symbol = data.symbol

0 commit comments

Comments
 (0)