Versions in this module Expand all Collapse all v0 v0.1.0 Mar 15, 2026 Changes in this version + func CalculateEffectivePrices(bids, asks []PriceLevel, size float64) float64 + type ArbitrageService struct + func NewArbitrageService(ctx context.Context, cfg Config, trading *trading.TradingService, ...) *ArbitrageService + func (s *ArbitrageService) CheckAndRebalance() + func (s *ArbitrageService) CheckOpportunity() *Opportunity + func (s *ArbitrageService) Execute(ctx context.Context, opp *Opportunity) (*ExecutionResult, error) + func (s *ArbitrageService) Start(market MarketConfig) error + func (s *ArbitrageService) Stop() + func (s *ArbitrageService) UpdateBalance(ctx context.Context) + func (s *ArbitrageService) WithRecorder(r *OrderbookRecorder) *ArbitrageService + type BalanceState struct + LastUpdate time.Time + NOTokens float64 + USDC float64 + YESTokens float64 + type Config struct + AutoExecute bool + AutoFixImbalance bool + EnableRebalancer bool + ExecutionCooldown time.Duration + ImbalanceThreshold float64 + MaxTradeSizeSDK float64 + MaxUSDCRatio float64 + MinProfitThreshold float64 + MinTokenReserve float64 + MinTradeSizeSDK float64 + MinUSDCRatio float64 + RebalanceCooldown time.Duration + RebalanceInterval time.Duration + SizeSafetyFactor float64 + TargetUSDCRatio float64 + func DefaultConfig() Config + type EffectivePrices struct + BuyNO float64 + BuyYES float64 + LongCost float64 + SellNO float64 + SellYES float64 + ShortRev float64 + type ExecutionResult struct + Error error + ExecutionTime time.Duration + Profit float64 + Size float64 + Success bool + TxHashes []string + Type OpportunityType + type MarketConfig struct + ConditionID string + NOTokenID string + Name string + Outcomes [2]string + YESTokenID string + type Opportunity struct + Description string + EffectivePrices EffectivePrices + EstimatedProfit float64 + MaxBalanceSize float64 + MaxOrderbookSize float64 + ProfitPercent float64 + ProfitRate float64 + RecommendedSize float64 + Timestamp time.Time + Type OpportunityType + type OpportunityType string + const OpportunityLong + const OpportunityShort + type OrderbookRecorder struct + func NewOrderbookRecorder(dir string, logger *zap.SugaredLogger) *OrderbookRecorder + func (r *OrderbookRecorder) Record(ob *OrderbookState) + func (r *OrderbookRecorder) StartMarket(market string) error + func (r *OrderbookRecorder) StopMarket() + type OrderbookState struct + LastUpdate time.Time + NOAsks []PriceLevel + NOBids []PriceLevel + YESAsks []PriceLevel + YESBids []PriceLevel + type PriceLevel struct + Price float64 + Size float64 + type RebalanceAction struct + Amount float64 + Priority int + Reason string + Type RebalanceActionType + type RebalanceActionType string + const ActionMerge + const ActionNone + const ActionSellNO + const ActionSellYES + const ActionSplit + type RebalanceResult struct + Action RebalanceAction + Error error + Success bool + TxHash string + type Stats struct + ExecutionsAttempted int64 + ExecutionsSucceeded int64 + OpportunitiesDetected int64 + StartTime time.Time + TotalProfit float64