You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-26Lines changed: 35 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
# High level
4
4
5
-
Builds a live orderbook from http snapshots from N configurable exchanges and updates it through
6
-
websocket depth updates. After a update the best ten asks and bids aswell as well as the spread
7
-
are provided through a grpc server endpoint
5
+
Builds a live orderbook from http snapshots from N configurable exchanges and then updates the orderbook
6
+
through soft real time websocket depth updates. After a update the best ten asks and bids aswell as well
7
+
as the spread are provided through a grpc server endpoint
8
8
9
9
# Lower level
10
10
@@ -13,18 +13,24 @@ pinned threads.
13
13
14
14
Orderbook is ran with multiplie threads. One for writing to the book the others for reading it.
15
15
16
+
## Orderbook structure
17
+
18
+
// todo -- update my reasoning here ... on why i didn't just use a simple red black tree
19
+
or the previous [initial linked list idea](https://github.com/githubsands/liquidity-engine/pull/10)
20
+
16
21
# Configuration
17
22
18
23
Exchange boots through a config by running `./orderbook-quoter-server --config=$(CONFIG_LOCATION)`. The
19
24
amount of exchanges in the exchange array must be equal to the orderbook's `exchange_count`. Every
20
25
`depth` field must be equal in the exchanges and orderbook's depth field should cover the entire
21
-
expected trading range for the lifetime of this service. The larger expected volatility the higher the orderbook's
22
-
depth needs to be.
26
+
expected trading range for the lifetime of this service.
27
+
28
+
The larger expected volatility the higher the orderbook's depth needs to be.
23
29
24
30
```
25
31
exchanges:
26
32
- client_name: "binance_usa_1"
27
-
exchange_name: 1
33
+
exchange_name: 0
28
34
snapshot_enabled: true
29
35
http_client: true
30
36
snapshot_uri: "http://localhost:5000"
@@ -34,7 +40,7 @@ exchanges:
34
40
depth: 5000
35
41
buffer_size: 6000
36
42
- client_name: "binance_usa_2"
37
-
exchange_name: 2
43
+
exchange_name: 1
38
44
snapshot_enabled: true
39
45
http_client: true
40
46
snapshot_uri: "http://localhost:6000"
@@ -71,30 +77,30 @@ Files changed by the build script are:
71
77
72
78
## Components
73
79
74
-
### ExchangeStream
80
+
### 1. ExchangeStream
75
81
76
82
Runs both http snapshot streams and websocket streams. Can handle retriggering the http snapshot stream
77
83
but it currently is not implemented in the Orderbook/DepthDriver.
78
84
79
85
Future work: Ideally these streams are done purely on the stack but this must be verified. Correct
80
86
sequencing of orderbook snapshots and depth updates through their timestamps
81
87
82
-
### Exchange
88
+
### 2. Exchange
83
89
84
90
Wrapper around exchange stream to handle websocket sinks and other functionality
85
91
86
-
### DepthDriver
92
+
### 3. DepthDriver
87
93
88
-
Provides a controlling interface to all exchange streams.
94
+
Provides a controlling interface to all exchange streams that push depths.
89
95
90
-
Future work:
96
+
#### Future work:
91
97
92
98
(1) Needs to handle orderbook reset and orderbook snapshot
93
99
retriggering with correct sequencing (https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md#how-to-manage-a-local-order-book-correctly)
94
100
95
101
(2) Exchange Stream websocket failure states.
96
102
97
-
### Orderbook
103
+
### 4. Orderbook
98
104
99
105
Handles orderbook writing and reading.
100
106
@@ -104,7 +110,15 @@ Has 2 states:
104
110
105
111
(2) Updating the the orderbook with ws depths and then reading the orderbook for best deals
106
112
107
-
Future work:
113
+
### 5. Quote GRPC Server
114
+
115
+
Takes the spread and provides the best ten deals and asks to a grpc client
116
+
117
+
#### Future work:
118
+
119
+
TBD
120
+
121
+
#### Future work:
108
122
109
123
(1) A state when the orderbook is needs rebuilding if a ExchangeStream websocket connection fails.
110
124
@@ -122,24 +136,19 @@ Future work:
122
136
123
137
#### 1. Depth Generator
124
138
125
-
Generates depths in many different sequences.
139
+
Generates depths in many different sequences: upward, downward through
140
+
hacking a brownian motion stochastic process.
126
141
127
-
Future Work:
142
+
##### Future Work:
128
143
129
144
Oscillating Depths rather then just upward and downward trends
130
145
131
146
#### 2. Exchange Stubs
132
147
133
-
Provides both HTTP and websocket endpoints for depths. Leverages depth generator.
148
+
Provides both HTTP and websocket endpoints for depths. Leverages depth generator
149
+
as a dependency.
134
150
135
151
#### 3. Exchange Server
136
152
137
-
Dockerized exchange stub for full integration testing.
138
-
139
-
### Quote GRPC Server
140
-
141
-
Takes the spread and provides the best ten deals and asks to a grpc client
142
-
143
-
Future work:
144
-
145
-
TBD
153
+
Dockerized exchange stub for full integration testing. Leverages exchange stub as a
0 commit comments