mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
Clean architecture following Go principles: - factory.go: Pure Go implementation (default, no CGO) - factory_cgo.go: C++ optimized version when CGO=1 - orderbook.go: Standalone Go orderbook implementation - cpp_orderbook.go: C++ bindings for high performance Also includes: - Vault execution integration with orderbook - dex-api-server command for REST/WebSocket API - E2E test scripts for API validation - Documentation site scaffolding
17 lines
350 B
Go
17 lines
350 B
Go
//go:build cgo
|
|
// +build cgo
|
|
|
|
package orderbook
|
|
|
|
import "os"
|
|
|
|
// NewOrderBook creates an order book.
|
|
// With CGO enabled, uses C++ for performance.
|
|
// Set LX_ORDERBOOK_IMPL=go to use pure Go instead.
|
|
func NewOrderBook(cfg Config) OrderBook {
|
|
if os.Getenv("LX_ORDERBOOK_IMPL") == "go" {
|
|
return NewGoOrderBook(cfg)
|
|
}
|
|
return NewCppOrderBook(cfg)
|
|
}
|