Documentation
¶
Index ¶
- func RunAdapterComplianceTests(t *testing.T, adp exchanges.Exchange, symbol string)
- func RunAnalyticsComplianceTests(t *testing.T, perp exchanges.PerpExchange, symbol string)
- func RunLifecycleSuite(t *testing.T, adp exchanges.Exchange, cfg LifecycleConfig)
- func RunOrderQuerySemanticsSuite(t *testing.T, adp exchanges.Exchange, cfg OrderQueryConfig)
- func RunOrderSuite(t *testing.T, adp exchanges.Exchange, cfg OrderSuiteConfig)
- func RunTradingAccountSuite(t *testing.T, adp exchanges.Exchange, cfg TradingAccountConfig)
- 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 TestFetchFundingRateHistory(t *testing.T, perp exchanges.PerpExchange, symbol string)
- func TestFetchHistoricalTrades(t *testing.T, adp exchanges.Exchange, symbol string)
- func TestFetchOpenInterest(t *testing.T, perp exchanges.PerpExchange, 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 TestTickerExtendedStats(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 OrderQueryConfig
- type OrderSuiteConfig
- type TradingAccountConfig
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 RunAnalyticsComplianceTests ¶ added in v0.2.19
func RunAnalyticsComplianceTests(t *testing.T, perp exchanges.PerpExchange, symbol string)
RunAnalyticsComplianceTests exercises the P0 analytics surface against a real perp adapter. Adapters that have not yet implemented a given capability should return ErrNotSupported; those sub-tests will be skipped.
perp is the PerpExchange under test. symbol is a base symbol known to be actively traded (e.g. "BTC") so statistics are populated.
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 RunOrderQuerySemanticsSuite ¶ added in v0.2.0
func RunOrderQuerySemanticsSuite(t *testing.T, adp exchanges.Exchange, cfg OrderQueryConfig)
RunOrderQuerySemanticsSuite verifies the semantic split between: - FetchOrderByID: single-order lookup - FetchOrders: all visible orders for a symbol - FetchOpenOrders: open orders only
func RunOrderSuite ¶
func RunOrderSuite(t *testing.T, adp exchanges.Exchange, cfg OrderSuiteConfig)
RunOrderSuite runs a complete order placement test suite against any Exchange.
func RunTradingAccountSuite ¶ added in v0.2.9
func RunTradingAccountSuite(t *testing.T, adp exchanges.Exchange, cfg TradingAccountConfig)
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 TestFetchFundingRateHistory ¶ added in v0.2.19
func TestFetchFundingRateHistory(t *testing.T, perp exchanges.PerpExchange, symbol string)
TestFetchFundingRateHistory verifies a default call returns >=1 entry and respects the Limit option.
func TestFetchHistoricalTrades ¶ added in v0.2.19
TestFetchHistoricalTrades verifies a default call returns trades and the Limit option is honored.
func TestFetchOpenInterest ¶ added in v0.2.19
func TestFetchOpenInterest(t *testing.T, perp exchanges.PerpExchange, symbol string)
TestFetchOpenInterest verifies OI is positive and timestamp is recent.
func TestFetchOrderBook ¶
TestFetchOrderBook verifies the FetchOrderBook implementation
func TestFetchSymbolDetails ¶
TestFetchSymbolDetails verifies the FetchSymbolDetails implementation
func TestFetchTicker ¶
TestFetchTicker verifies the FetchTicker implementation
func TestTickerExtendedStats ¶ added in v0.2.19
TestTickerExtendedStats verifies FetchTicker populates at least the 24h-change / open-price / trade-count fields for active symbols. Adapters that genuinely cannot surface a given field can document that omission in their own adapter_test.
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 OrderQueryConfig ¶ added in v0.2.0
type OrderQueryConfig struct {
Symbol string
SupportsOpenOrders bool
SupportsTerminalLookup bool
SupportsOrderHistory bool
}
OrderQueryConfig configures the shared order-query semantics suite.
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.