-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathqmt.proto
121 lines (102 loc) · 2.52 KB
/
qmt.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
syntax = "proto3";
package qmt;
// 价格请求消息
message PriceRequest {
string code = 1;
}
// 价格响应消息
message PriceResponse {
double last_price = 1;
}
// 每日信息请求消息
message DailyInfoRequest {
string code = 1;
}
// 每日信息响应消息
message DailyInfoResponse {
string ts_code = 1;
double open = 2;
double high = 3;
double low = 4;
double close = 5;
double volume = 6;
double amount = 7;
string name = 8;
double vwap = 9;
int32 stop = 10;
double up_limit = 11;
double down_limit = 12;
}
// 订单请求消息
message OrderRequest {
string code = 1;
int32 amount = 2;
double price = 3;
string strategy = 4;
string remark = 5;
}
// 订单响应消息
message OrderResponse {
int32 seq = 1;
}
// 查询订单请求消息
message QueryOrdersRequest {
}
// 订单详情消息
message OrderDetail {
string stock_code = 1;
string order_id = 2;
string order_sysid = 3;
string order_time = 4;
int32 order_type = 5;
int32 order_volume = 6;
int32 price_type = 7;
double price = 8;
int32 traded_volume = 9;
double traded_price = 10;
int32 order_status = 11;
string status_msg = 12;
string strategy_name = 13;
string order_remark = 14;
}
// 订单列表响应消息
message OrdersResponse {
repeated OrderDetail orders = 1;
}
// 资产请求消息
message AssetRequest {
}
// 资产响应消息
message AssetResponse {
string user = 1;
double cash = 2;
double frozen_cash = 3;
double market_value = 4;
double total_value = 5;
}
// 持仓响应消息
message PositionsResponse {
repeated PositionDetail positions = 1;
}
// 持仓详情消息
message PositionDetail {
string stock_code = 1;
int32 volume = 2;
int32 can_use_volume = 3;
double open_price = 4;
double market_value = 5;
int32 frozen_volume = 6;
double avg_price = 7;
}
// 定义服务
service QmtService {
rpc GetPrice(PriceRequest) returns (PriceResponse) {}
rpc GetDailyInfo(DailyInfoRequest) returns (DailyInfoResponse) {}
rpc OrderBuy(OrderRequest) returns (OrderResponse) {}
rpc OrderSell(OrderRequest) returns (OrderResponse) {}
rpc QueryOrders(QueryOrdersRequest) returns (OrdersResponse) {}
rpc CancelOrders(QueryOrdersRequest) returns (OrdersResponse) {}
rpc RetryOrders(QueryOrdersRequest) returns (OrdersResponse) {}
rpc GetAsset(AssetRequest) returns (AssetResponse) {}
rpc GetPositions(AssetRequest) returns (PositionsResponse) {}
}