Documentation
¶
Index ¶
- func RunAdapterComplianceTests(t *testing.T, adp exchanges.Exchange, symbol string)
- func RunLifecycleSuite(t *testing.T, adp exchanges.Exchange, cfg LifecycleConfig)
- func RunOrderSuite(t *testing.T, adp exchanges.Exchange, cfg OrderSuiteConfig)
- func SetupOrderWatch(t *testing.T, adp exchanges.Exchange) <-chan *exchanges.Order
- func SmartLimitPrice(t *testing.T, adp exchanges.Exchange, symbol string, side exchanges.OrderSide) decimal.Decimal
- func SmartQuantity(t *testing.T, adp exchanges.Exchange, symbol string) (qty, price decimal.Decimal)
- func TestFetchAccount(t *testing.T, adp exchanges.Exchange)
- func TestFetchFeeRate(t *testing.T, adp exchanges.Exchange, symbol string)
- func TestFetchOrderBook(t *testing.T, adp exchanges.Exchange, symbol string)
- func TestFetchSymbolDetails(t *testing.T, adp exchanges.Exchange, symbol string)
- func TestFetchTicker(t *testing.T, adp exchanges.Exchange, symbol string)
- func TestWatchOrderBook(t *testing.T, adp exchanges.Exchange, symbol string)
- func WaitOrderStatus(t *testing.T, ch <-chan *exchanges.Order, orderID, clientID string, ...) *exchanges.Order
- type LifecycleConfig
- type OrderSuiteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunAdapterComplianceTests ¶
RunAdapterComplianceTests runs a standard set of compliance tests against any exchanges.
func RunLifecycleSuite ¶
func RunLifecycleSuite(t *testing.T, adp exchanges.Exchange, cfg LifecycleConfig)
RunLifecycleSuite executes a comprehensive trading lifecycle test:
- Subscribe — WatchOrders, collect all order state transitions
- Open — Place a market buy and wait for FILLED
- Verify — Check position (perp) or balance change (spot)
- Close — Reverse the position while monitoring state transitions
- Verify — Assert position/balance is restored
- Disconnect — StopWatchOrders, Close
This test is intentionally a single sequential flow to validate that all pieces work together end-to-end.
func RunOrderSuite ¶
func RunOrderSuite(t *testing.T, adp exchanges.Exchange, cfg OrderSuiteConfig)
RunOrderSuite runs a complete order placement test suite against any Exchange.
func SetupOrderWatch ¶
SetupOrderWatch subscribes to order updates via WatchOrders (Streamable) and returns a channel that receives all order updates.
func SmartLimitPrice ¶
func SmartLimitPrice(t *testing.T, adp exchanges.Exchange, symbol string, side exchanges.OrderSide) decimal.Decimal
SmartLimitPrice calculates a passive limit price that won't fill immediately.
func SmartQuantity ¶
func SmartQuantity(t *testing.T, adp exchanges.Exchange, symbol string) (qty, price decimal.Decimal)
SmartQuantity calculates a reasonable order quantity for testing.
func TestFetchAccount ¶
TestFetchAccount verifies the FetchAccount implementation
func TestFetchFeeRate ¶
TestFetchFeeRate verifies the FetchFeeRate implementation
func TestFetchOrderBook ¶
TestFetchOrderBook verifies the FetchOrderBook implementation
func TestFetchSymbolDetails ¶
TestFetchSymbolDetails verifies the FetchSymbolDetails implementation
func TestFetchTicker ¶
TestFetchTicker verifies the FetchTicker implementation
func TestWatchOrderBook ¶
TestWatchOrderBook verifies the WebSocket OrderBook subscription and local syncing
Types ¶
type LifecycleConfig ¶
type LifecycleConfig struct {
Symbol string // Required: e.g. "DOGE"
}
LifecycleConfig configures the full lifecycle integration test.
type OrderSuiteConfig ¶
type OrderSuiteConfig struct {
Symbol string // Required: symbol to test on, e.g. "DOGE" or "ETH"
Slippage decimal.Decimal // Slippage for slippage test (default 0.05)
SkipMarket bool // Skip market order test
SkipSlippage bool // Skip slippage order test
SkipLimit bool // Skip limit order test
}
OrderSuiteConfig configures the order test suite.