Use
stack build
stack exec Exchange
to run the application.
Tests can be run with stack test
as usual.
As of now, orders are evaluated with partial filling; "all-or-none" or "fill-or-kill" style ordering complicates things and needs work.
By default, the exchange runs on localhost:8080
. The exchange handles requests
via HTTP POSTs adhering to the following format, by request type:
{ type : "limit"
, quantity : Int
, price : Float
, dir : String
, tid : String
, ticker : String
}
{ type : "market"
, quantity : Int
, dir : String
, tid : String
, ticker : String
}
{ type : "registers"
, ticker : String
}
{ type : "registert"
, trader : String
}
{ type : "status" }
{ type : "CANCEL"
, oid : String
, tid : String
, ticker : String
}