alexey-ernest / go-hft-orderbook

Golang implementation of a Limit Order Book (LOB) for high frequency trading in crypto exchanges
MIT License
211 stars 56 forks source link

Match orderbook logic for orders inserted into orderbook #10

Open nikhilsaraf opened 6 months ago

nikhilsaraf commented 6 months ago

Is there any orderbook matching logic included?

if I add an ask at price = 100.0 (volume = 5.0) and a bid at price 101.0 (volume = 9.0) then I'd expect that these offers would "cross" and the orderbook would have remaining 1 bid order at price = 101.0 with volume = 4.0 along with one trade which is a sell at price = 100.0 for volume = 5.0

Can you please comment on whether "matching" an orderbook is part of the scope of this project?

mutalisk999 commented 6 months ago
if I add an ask at price = 100.0 (volume = 5.0) and a bid at price 101.0 (volume = 9.0) then I'd expect
that these offers would "cross" and the orderbook would have remaining 1 bid order at price = 101.0 
with volume = 4.0 along with one trade which is a sell at price = 100.0 for volume = 5.0

In order book trading systems, this is very common trading logic. In the case of crossings, the price of the pending order in the order book will be the final price.