-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrading.yaml
95 lines (90 loc) · 2.52 KB
/
trading.yaml
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
traits:
- name: TestServer
description: test server network connection
methods:
- name: ping
description: test ping
return_type: bool
- name: get_server_time
description: get server local time
return_type: i64
- name: GetMarketData
description: get market data such as symbol, price and volume
methods:
- name: get_symbol
description: get symbol, such as BTCUSD
return_type: Vec<String>
- name: get_price
description: get mid-price of a symbol (e.g. BTCUSD -> 67000.0)
return_type: f64
args:
- name: symbol
type: String
- name: get_orderbook
description: get orderbook
return_type: Orderbook
args:
- name: symbol
type: String
# TODO define get_ohlcv,
# first check what is the common API
# and then see if we can map this with yaml
# - name: get_ohlcv
# return_type: String # return type I assume is a little more complex
# - name: get_ohlcv
# return_type: String
# args:
# - name: name
- name: ManageOrder
description: place, change, cancel order
methods:
- name: place_order
description: place order, return cloid
args:
- name: symbol
type: String
- name: price
type: i32
- name: volume
type: i32
return_type: i64
- name: change_order_by_cloid
description: change order
args:
- name: cloid
type: i64
- name: price
type: i32
- name: volume
type: i32
return_type: i64
- name: cancel_order
description: cancel order by cloid
args:
- name: cloid
type: i64
return_type: i64
- name: cancel_all_order
description: cancel all order regardless of cloid/symbol
return_type: bool
# enum: keep it primitive
enums:
- name: Status
values:
- name: Success
description: "The task is pending."
- name: InProgress
description: "The task is currently in progress."
- name: Completed
description: "The task has been completed."
- name: Failed
description: "The task has failed."
# struct: either primitive or enum
structs:
- name: Orderbook
description: "order book, with asks and bids (key: price, value: volume)"
values:
- name: asks
type: HashMap<f64, f64>
- name: bids
type: HashMap<f64, f64>