Skip to content

Commit 23c2aa7

Browse files
committed
order user remark
1 parent 77860a3 commit 23c2aa7

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.1.1 (2022-05-25)
2+
### New
3+
- 新增批量分页获取k线接口
4+
股票:`QuoteClient.get_bars_by_page`
5+
期货:`QuoteClient.get_future_bars_by_page`
6+
- `QuoteClient.get_future_bars`, `QuoteClient.get_bars` 增加 `page_token` 参数,可用于分页请求定位下一页位置
7+
- `tigeropen.trade.domain.order.Order` 新增 `user_mark` 属性,用户下单时可传入一定长度的备注信息,该属性值在查询订单时会返回。(需用户提前向平台申请配置)
8+
19
## 2.1.0 (2022-05-07)
210
### New
311
- 动态获取服务域名;更改默认域名

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__ = '2.1.0'
7+
__VERSION__ = '2.1.1'

tigeropen/trade/domain/order.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Order:
1616
"quantity", "filled", "_remaining", "avg_fill_price", "commission", "realized_pnl", "_status",
1717
"trail_stop_price", "limit_price", "aux_price", "trailing_percent", "percent_offset", "action",
1818
"order_type", "time_in_force", "outside_rth", "order_legs", "algo_params", "algo_strategy",
19-
"secret_key", "liquidation", "discount", "attr_desc", "source", 'adjust_limit', 'sub_ids']
19+
"secret_key", "liquidation", "discount", "attr_desc", "source", 'adjust_limit', 'sub_ids', "user_mark"]
2020

2121
def __init__(self, account, contract, action, order_type, quantity, limit_price=None, aux_price=None,
2222
trail_stop_price=None, trailing_percent=None, percent_offset=None, time_in_force=None,
@@ -57,6 +57,7 @@ def __init__(self, account, contract, action, order_type, quantity, limit_price=
5757
- adjust_limit 价格微调幅度(默认为0表示不调整,正数为向上调整,负数向下调整),对传入价格自动调整到合法价位上.
5858
例如:0.001 代表向上调整且幅度不超过 0.1%;-0.001 代表向下调整且幅度不超过 0.1%。默认 0 表示不调整
5959
- sub_ids id list of sub orders.
60+
- user_mark: user's remark
6061
"""
6162

6263
self.id = id
@@ -93,6 +94,7 @@ def __init__(self, account, contract, action, order_type, quantity, limit_price=
9394
self.source = kwargs.get('source')
9495
self.adjust_limit = kwargs.get('adjust_limit')
9596
self.sub_ids = kwargs.get('sub_ids')
97+
self.user_mark = kwargs.get('user_mark')
9698

9799
def to_dict(self):
98100
dct = {name: getattr(self, name) for name in self.__slots__ if name not in ORDER_FIELDS_TO_IGNORE}

tigeropen/trade/request/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ def __init__(self):
737737
self.order_legs = None
738738
self.algo_params = None
739739
self.adjust_limit = None
740+
self.user_mark = None
740741

741742
def to_openapi_dict(self):
742743
params = dict()
@@ -792,6 +793,8 @@ def to_openapi_dict(self):
792793
params['outside_rth'] = self.outside_rth
793794
if self.adjust_limit is not None:
794795
params['adjust_limit'] = self.adjust_limit
796+
if self.user_mark is not None:
797+
params['user_mark'] = self.user_mark
795798

796799
if self.order_legs:
797800
if len(self.order_legs) > 2:

tigeropen/trade/response/orders_response.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
'timeInForce': 'time_in_force', 'openTime': 'order_time', 'latestTime': 'trade_time',
2222
'contractId': 'contract_id', 'algoStrategy': 'algo_strategy',
2323
'trailStopPrice': 'trail_stop_price', 'trailingPercent': 'trailing_percent',
24-
'percentOffset': 'percent_offset', 'identifier': 'identifier', 'algoParameters': 'algo_params'
24+
'percentOffset': 'percent_offset', 'identifier': 'identifier', 'algoParameters': 'algo_params',
25+
'userMark': 'user_mark'
2526
}
2627

2728

@@ -101,14 +102,15 @@ def parse_order(item, secret_key=None):
101102
discount = order_fields.get('discount')
102103
attr_desc = order_fields.get('attr_desc')
103104
source = order_fields.get('source')
105+
user_mark = order_fields.get('user_mark')
104106

105107
order = Order(account, contract, action, order_type, quantity, limit_price=limit_price, aux_price=aux_price,
106108
trail_stop_price=trail_stop_price, trailing_percent=trailing_percent,
107109
percent_offset=percent_offset, time_in_force=time_in_force, outside_rth=outside_rth,
108110
filled=filled, avg_fill_price=avg_fill_price, commission=commission,
109111
realized_pnl=realized_pnl, id=id_, order_id=order_id, parent_id=parent_id,
110112
algo_params=algo_params, liquidation=liquidation, algo_strategy=algo_strategy, discount=discount,
111-
attr_desc=attr_desc, source=source)
113+
attr_desc=attr_desc, source=source, user_mark=user_mark)
112114
if 'order_time' in order_fields:
113115
order.order_time = order_fields.get('order_time')
114116
if 'trade_time' in order_fields:

tigeropen/trade/trade_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ def place_order(self, order):
533533
params.algo_params = order.algo_params
534534
params.secret_key = order.secret_key if order.secret_key else self._secret_key
535535
params.adjust_limit = order.adjust_limit
536+
params.user_mark = order.user_mark
536537

537538
request = OpenApiRequest(PLACE_ORDER, biz_model=params)
538539
response_content = self.__fetch_data(request)

0 commit comments

Comments
 (0)