Back to the Book Lab

Go source: injective-booklab

14 files, 2035 lines, of which 457 are tests. Standard library only, plus coder/websocket in bookd. Run go test -race ./...; build the browser binary with GOOS=js GOARCH=wasm go build ./cmd/wasm.

PackageWhat it does
dec18-digit fixed-point decimal (LegacyDec precision), half-up rounding, tick floor/ceil, fuzz test
bookL2 book, validation, mid/spread/depth, taker walk, O(n) level diff, exchange tick and min-notional checks
fbaFrequent batch auction: stage 1 market orders, stage 2 limit orders with uniform clearing price; tests are the two worked examples in the Injective API docs
clientLCD client: hedged requests across 4 public endpoints, seq guard against lagging nodes, per-endpoint health
cmd/wasmBrowser entry: exposes the packages to JS as Promises (net/http runs on fetch)
cmd/injbookCLI: live book + taker cost for any market
cmd/bookdREST + WebSocket server: one poller per market fans out snapshots and diffs to every client
FileLinesKind
book/book.go170
book/book_test.go135test
book/match.go109
client/client.go338
client/client_test.go77test
cmd/bookd/main.go217
cmd/bookd/main_test.go82test
cmd/injbook/main.go71
cmd/wasm/main.go256
dec/dec.go210
dec/dec_test.go77test
fba/fba.go202
fba/fba_test.go86test
go.mod5