# Order对象
获取示例策略
def init(context):
context.stock = ["000001.SZ"]
context.oid = None
def handle_bar(context, bar_dict):
if not context.oid:
context.oid = order_target_value("000001.SZ", 10000)
order = get_order(context.oid)
if order:
try:
log.info("order_id : %s", order.order_id)
except Exception as e:
log.info("order_id : ERR=%s", str(e))
try:
log.info("symbol : %s", order.symbol)
except Exception as e:
log.info("symbol : ERR=%s", str(e))
try:
log.info("amount : %s", order.amount)
except Exception as e:
log.info("amount : ERR=%s", str(e))
try:
log.info("price : %s", order.price)
except Exception as e:
log.info("price : ERR=%s", str(e))
try:
log.info("filled : %s", order.filled)
except Exception as e:
log.info("filled : ERR=%s", str(e))
try:
log.info("status : %s", order.status)
except Exception as e:
log.info("status : ERR=%s", str(e))
try:
log.info("side : %s", order.side)
except Exception as e:
log.info("side : ERR=%s", str(e))
try:
log.info("datetime : %s", order.datetime)
except Exception as e:
log.info("datetime : ERR=%s", str(e))
try:
log.info("filled_dt : %s", order.filled_dt)
except Exception as e:
log.info("filled_dt : ERR=%s", str(e))
try:
log.info("avg_price : %s", order.avg_price)
except Exception as e:
log.info("avg_price : ERR=%s", str(e))
try:
log.info("message : %s", order.message)
except Exception as e:
log.info("message : ERR=%s", str(e))
try:
log.info("cancelable : %s", order.cancelable)
except Exception as e:
log.info("cancelable : ERR=%s", str(e))
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
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