1- # Orderbook Quoter Server
1+ # < span style = " color : #FF6B6B ; " >📈 Orderbook Quoter Server</ span >
22
3- # High level
3+ ## < span style = " color : #4ECDC4 ; " >🎯 High Level</ span >
44
55Builds a live orderbook from http snapshots from N configurable exchanges and then updates the orderbook
66through soft real time websocket depth updates. After a update the best ten asks and bids aswell as well
77as the spread are provided through a grpc server endpoint
88
9- # Lower level
9+ ## < span style = " color : #45B7D1 ; " >🔧 Lower Level</ span >
1010
1111IO components: ExchangeStreams, and Quote GRPC Server are ran on seperate tokio runtimes in their own
1212pinned threads.
@@ -16,12 +16,12 @@ pinned threads.
1616
1717Orderbook is ran with multiplie threads. One for writing to the book the others for reading it.
1818
19- ## Orderbook structure
19+ ### < span style = " color : #96CEB4 ; " >📊 Orderbook Structure</ span >
2020
2121// todo -- update my reasoning here ... on why i didn't just use a simple red black tree
2222 or the previous [ initial linked list idea] ( https://github.com/githubsands/liquidity-engine/pull/10 )
2323
24- # Configuration
24+ ## < span style = " color : #FFEAA7 ; " >⚙️ Configuration</ span >
2525
2626Exchange boots through a config by running ` ./orderbook-quoter-server --config=$(CONFIG_LOCATION) ` . The
2727amount of exchanges in the exchange array must be equal to the orderbook's ` exchange_count ` . Every
@@ -30,7 +30,7 @@ expected trading range for the lifetime of this service.
3030
3131The larger expected volatility the higher the orderbook's depth needs to be.
3232
33- ```
33+ ``` yaml
3434exchanges :
3535 - client_name : " binance_usa_1"
3636 exchange_name : 0
@@ -65,7 +65,7 @@ grpc_server:
6565 host_uri : " 127.0.0.1:5000"
6666` ` `
6767
68- # Building
68+ ## <span style="color: #74B9FF;">🔨 Building</span>
6969
7070Builds are done through the build script (build.rs). The script reads the config file and runs procedural macros on
7171the code base. The config file's "orderbook.exchange_count" and exchange's exchange array length must be equal or the
@@ -78,32 +78,32 @@ Files changed by the build script are:
7878
7979(1) orderbook/src/lib.rs
8080
81- ## Components
81+ # # <span style="color: #A29BFE;">🧩 Components</span>
8282
83- ### 1. ExchangeStream
83+ # ## <span style="color: #FD79A8;"> 1. ExchangeStream</span>
8484
8585Runs both http snapshot streams and websocket streams. Can handle retriggering the http snapshot stream
8686but it currently is not implemented in the Orderbook/DepthDriver.
8787
88- Future work: Ideally these streams are done purely on the stack but this must be verified. Correct
88+ ** Future work:** Ideally these streams are done purely on the stack but this must be verified. Correct
8989sequencing of orderbook snapshots and depth updates through their timestamps
9090
91- ### 2. Exchange
91+ # ## <span style="color: #FDCB6E;"> 2. Exchange</span>
9292
9393Wrapper around exchange stream to handle websocket sinks and other functionality
9494
95- ### 3. DepthDriver
95+ # ## <span style="color: #6C5CE7;"> 3. DepthDriver</span>
9696
9797Provides a controlling interface to all exchange streams that push depths.
9898
99- #### Future work:
99+ # ### <span style="color: #00B894;"> Future work:</span>
100100
101101(1) Needs to handle orderbook reset and orderbook snapshot
102- 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 )
102+ retriggering with correct sequencing ([Binance docs]( https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md#how-to-manage-a-local-order-book-correctly) )
103103
104104(2) Exchange Stream websocket failure states.
105105
106- ### 4. Orderbook
106+ # ## <span style="color: #E17055;"> 4. Orderbook</span>
107107
108108Handles orderbook writing and reading.
109109
@@ -113,15 +113,15 @@ Has 2 states:
113113
114114(2) Updating the the orderbook with ws depths and then reading the orderbook for best deals
115115
116- ### 5. Quote GRPC Server
116+ # ## <span style="color: #00CEC9;"> 5. Quote GRPC Server</span>
117117
118118Takes the spread and provides the best ten deals and asks to a grpc client
119119
120- #### Future work:
120+ # ### <span style="color: #00B894;"> Future work:</span>
121121
122122TBD
123123
124- #### Future work:
124+ # ### <span style="color: #00B894;"> Future work:</span>
125125
126126(1) A state when the orderbook is needs rebuilding if a ExchangeStream websocket connection fails.
127127
@@ -135,23 +135,25 @@ TBD
135135
136136(6) Possibly more performant atomic memory ordering
137137
138- ### Testing
138+ # # <span style="color: #FF7675;">🧪 Testing</span>
139139
140- #### 1. Depth Generator
140+ # ## <span style="color: #55A3FF;"> 1. Depth Generator</span>
141141
142142Generates depths in many different sequences : upward, downward through
143143hacking a brownian motion stochastic process.
144144
145- ##### Future Work:
145+ # ### <span style="color: #00B894;"> Future Work:</span>
146146
147147Oscillating Depths rather then just upward and downward trends
148148
149- #### 2. Exchange Stubs
149+ # ## <span style="color: #FD79A8;"> 2. Exchange Stubs</span>
150150
151151Provides both HTTP and websocket endpoints for depths. Leverages depth generator
152152as a dependency.
153153
154- #### 3. Exchange Server
154+ # ## <span style="color: #FDCB6E;"> 3. Exchange Server</span>
155155
156156Dockerized exchange stub for full integration testing. Leverages exchange stub as a
157157dependency.
158+
159+ ---
0 commit comments