Add message struct definitions

All message structs required to run the exchange
This commit is contained in:
Tim Kächele 2024-02-10 11:21:21 +01:00
parent dd1ac04fc7
commit dd0b83734d
2 changed files with 74 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "server/messages"
require_relative "server/message_broker" require_relative "server/message_broker"
module Rex module Rex
module Server module Server

View File

@ -0,0 +1,73 @@
module Rex
module Server
module Messages
AuthenticateRequest = Struct.new(:user_id)
FetchTradesRequest = Struct.new(:user_id)
FetchOrdersRequest = Struct.new(:user_id)
CreateOrderRequest = Struct.new(:user_id, :side, :price, :quantity)
CancelOrderRequest = Struct.new(:user_id, :order_id)
FetchOrderBookRequest = Struct.new(:user_id)
OrderBookUpdateEvent = Struct.new(
:side,
:price,
:quantity
)
OrderBookFetchEvent = Struct.new(
:user_id,
:side,
:price,
:quantity
)
OrderCancelledEvent = Struct.new(
:id,
:user_id,
:side,
:remaining_quantity,
:price
)
OrderFetchEvent = Struct.new(
:id,
:user_id,
:side,
:quantity,
:remaining_quantity,
:price
)
OrderCreatedEvent = Struct.new(
:id,
:user_id,
:side,
:quantity,
:remaining_quantity,
:price
)
OrderFillEvent = Struct.new(
:id,
:user_id,
:price,
:side,
:remaining_quantity
)
TradeEvent = Struct.new(
:id,
:price,
:quantity
)
TradeFetchEvent = Struct.new(
:id,
:user_id,
:price,
:quantity
)
end
end
end