-
Notifications
You must be signed in to change notification settings - Fork 1
/
exchange.proto
69 lines (61 loc) · 1.51 KB
/
exchange.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
/* pan-exchange api.
*
* exposes exchange functionality.
*/
syntax = "proto3";
package exchange;
// java specific stuff
option java_package = "net.parasec.pan.exchange.wire";
option java_outer_classname = "ExchangeWire";
// exchange commands
enum Type {
PING = 0; // default (just responds pong: for testing)
OPEN_ORDERS = 1; // list of open orders (at the exchange)
CANCEL = 2; // cancel order(s)
LIMIT = 3; // place limit order
}
message Limit {
enum Side {
BID = 0;
ASK = 1;
}
string id = 1; // optional (used in response)
Side side = 2;
int64 price = 3;
int64 volume = 4;
string asset = 5; // btcusd
}
// Command encapsulates an exchange API command.
message Command {
// so deserialiser can match payload type.
Type type = 1;
// Command payload (only 1 will be set.)
// note: proto2 uses "extensions":
// https://developers.google.com/protocol-buffers/docs/proto#extensions
// to do this. proto3 uses "any":
// https://developers.google.com/protocol-buffers/docs/proto3#any
// need to check this out.
// CANCEL request payload
message Cancel {
string order_id = 1; // optional: if null, cancel all.
}
Cancel cancel = 2;
// LIMIT request payload
Limit limit = 3;
}
message Response {
Type type = 1;
enum Status {
OK = 0;
NOK = 1;
NOT_SUPPORTED = 2;
}
Status status = 2;
// OPEN_ORDERS response payload
message OpenOrders {
repeated Limit limits = 1;
}
OpenOrders open_orders = 3;
// LIMIT response payload
string order_id = 4;
}