Documentation
¶
Index ¶
- func FetchBTCUSDTFromBinanceSpot(ctx context.Context) (model.Ticker, error)
- func FetchTickerWithDataClient(ctx context.Context, client venue.DataClient, instrumentID model.InstrumentID) (model.Ticker, error)
- type BacktestStrategyResult
- type BracketBacktestResult
- type FundingArbitrageConfig
- type FundingArbitrageDecision
- type FundingArbitrageMonitor
- type FundingRateSource
- type FundingVenueSnapshot
- type LiveNodeResult
- type OrderFactoryWalkthrough
- type RiskValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchBTCUSDTFromBinanceSpot ¶
FetchBTCUSDTFromBinanceSpot is the same workflow using the concrete Binance spot adapter. It calls Binance public endpoints, so tests compile this helper but do not execute it by default.
func FetchTickerWithDataClient ¶
func FetchTickerWithDataClient(ctx context.Context, client venue.DataClient, instrumentID model.InstrumentID) (model.Ticker, error)
FetchTickerWithDataClient shows the smallest normalized market-data path: connect a venue.DataClient, request one ticker, and disconnect it.
Types ¶
type BacktestStrategyResult ¶
type BacktestStrategyResult struct {
EventsProcessed int
Order model.OrderStatusReport
Position model.PositionStatusReport
Fills []model.FillReport
ExposureUSDT decimal.Decimal
}
func RunThresholdStrategyBacktest ¶
func RunThresholdStrategyBacktest(ctx context.Context) (BacktestStrategyResult, error)
RunThresholdStrategyBacktest replays two order-book events through the same strategy.Runtime surface used by live nodes. The strategy subscribes in OnStart, reacts in OnOrderBook, submits through OrderFactory, and reads final state from cache and portfolio.
type BracketBacktestResult ¶
type BracketBacktestResult struct {
Entry model.OrderStatusReport
StopLoss model.OrderStatusReport
TakeProfit model.OrderStatusReport
Fills []model.FillReport
}
func RunBracketOrderBacktest ¶
func RunBracketOrderBacktest(ctx context.Context) (BracketBacktestResult, error)
RunBracketOrderBacktest shows the advanced order-list path: one parent entry order releases two reduce-only children, and the take-profit fill cancels the stop-loss sibling.
type FundingArbitrageConfig ¶
type FundingArbitrageDecision ¶
type FundingArbitrageDecision struct {
ShouldTrade bool
Reason string
Long FundingVenueSnapshot
Short FundingVenueSnapshot
FundingSpread decimal.Decimal
EstimatedCostRate decimal.Decimal
ExpectedNetRate decimal.Decimal
ExpectedNetUSDT decimal.Decimal
Orders []model.SubmitOrder
Reports []model.OrderStatusReport
}
func RunFundingRateArbitrageMonitor ¶
func RunFundingRateArbitrageMonitor(ctx context.Context) (FundingArbitrageDecision, error)
RunFundingRateArbitrageMonitor shows a production-shaped funding-rate arbitrage flow without depending on any live credentials:
- collect funding snapshots from multiple venues;
- find the venue paying the most to shorts and the venue charging longs the least;
- estimate taker-fee plus slippage cost;
- create a delta-neutral long/short order pair with OrderFactory;
- run risk checks before routing orders to execution clients by AccountID.
type FundingArbitrageMonitor ¶
type FundingArbitrageMonitor struct {
// contains filtered or unexported fields
}
func NewFundingArbitrageMonitor ¶
func NewFundingArbitrageMonitor(cfg FundingArbitrageConfig, sources []FundingRateSource, riskEngine *risk.Engine, executor *fundingExecutionRouter) *FundingArbitrageMonitor
func (*FundingArbitrageMonitor) EvaluateOnce ¶
func (m *FundingArbitrageMonitor) EvaluateOnce(ctx context.Context) (FundingArbitrageDecision, error)
type FundingRateSource ¶
type FundingRateSource interface {
Name() string
Snapshots(context.Context) ([]FundingVenueSnapshot, error)
}
type FundingVenueSnapshot ¶
type LiveNodeResult ¶
type LiveNodeResult struct {
SubmittedOrder model.OrderStatusReport
Fills []model.FillReport
Position model.PositionStatusReport
ExposureUSDT decimal.Decimal
EventLog []string
}
func RunLiveNodeWithInMemoryVenue ¶
func RunLiveNodeWithInMemoryVenue(ctx context.Context) (LiveNodeResult, error)
RunLiveNodeWithInMemoryVenue is a full local live-node assembly. It is useful for paper trading, integration tests, and adapter development because the strategy, risk, execution, cache, portfolio, and callbacks are real; only the venue network edge is replaced by in-memory clients.
type OrderFactoryWalkthrough ¶
type OrderFactoryWalkthrough struct {
Market model.SubmitOrder
PostOnly model.SubmitOrder
StopMarket model.SubmitOrder
TrailingStop model.SubmitOrder
Bracket model.OrderList
}
func BuildOrdersWithOrderFactory ¶
func BuildOrdersWithOrderFactory() OrderFactoryWalkthrough
BuildOrdersWithOrderFactory shows how strategy code should create commands: use OrderFactory for account identity, client order IDs, list IDs, and shared command metadata instead of assembling those fields by hand.
type RiskValidationResult ¶
type RiskValidationResult struct {
Accepted model.SubmitOrder
Rejected model.SubmitOrder
RejectErr error
}
func ValidateRiskBeforeExecution ¶
func ValidateRiskBeforeExecution() (RiskValidationResult, error)
ValidateRiskBeforeExecution demonstrates the normal execution boundary: put instrument metadata in cache, configure limits, then call risk.Check before an order is allowed to reach a venue execution client.