Versions in this module Expand all Collapse all v1 v1.0.0 Oct 9, 2026 Changes in this version + var ErrFatalBadRequest = errors.New("polyedge: bad request (HTTP 400)") + var ErrFatalForbidden = errors.New("polyedge: forbidden or quota exceeded (HTTP 403)") + var ErrFatalStreamNotFound = errors.New("polyedge: stream not found (HTTP 404)") + var ErrFatalUnauthorized = errors.New("polyedge: unauthorized (HTTP 401)") + var ErrWatchdogTimeout = errors.New("polyedge: sse watchdog timed out with no data/heartbeat") + type AccountService struct + func (s *AccountService) CreateKey(ctx context.Context, req *CreateAPIKeyRequest) (*UserAPIKey, error) + func (s *AccountService) DeleteKey(ctx context.Context, key string) (*DeleteKeyResponse, error) + func (s *AccountService) GetLedger(ctx context.Context, limit int, offset int) (*UserLedgerResponse, error) + func (s *AccountService) GetProfile(ctx context.Context) (*UserProfile, error) + func (s *AccountService) GetTelemetry(ctx context.Context) (*UserTelemetryResponse, error) + func (s *AccountService) ListKeys(ctx context.Context) (*UserKeysResponse, error) + func (s *AccountService) UpdateKey(ctx context.Context, key string, req *UserUpdateKeyRequest) (*UserAPIKey, error) + func (s *AccountService) Withdraw(ctx context.Context, req *UserWithdrawRequest) (*UserWithdrawResponse, error) + type ActiveSessionInfo struct + ApiKey string + ClientIp string + ConnectedAt string + DurationSeconds int64 + PushedTxCount int64 + StreamId string + UserAgent string + type AnalyticsService struct + func (s *AnalyticsService) GetDeposits(ctx context.Context, limit int, offset int) (*DepositQueryResult, error) + func (s *AnalyticsService) GetLeaderboard(ctx context.Context, limit int, offset int) (*LeaderboardResponse, error) + func (s *AnalyticsService) GetMarket(ctx context.Context, id string) (*MarketDetailResponse, error) + func (s *AnalyticsService) GetTrader(ctx context.Context, address string) (*TraderProfileResponse, error) + func (s *AnalyticsService) GetTraderHourlyStats(ctx context.Context, address string) (*TraderHourlyStatsResponse, error) + func (s *AnalyticsService) GetTraderMarketOrders(ctx context.Context, address string, id string, limit int, offset int) (*UserOrdersResponse, error) + func (s *AnalyticsService) GetTraderMarkets(ctx context.Context, address string, limit int, offset int) (*TraderHistoryResponse, error) + type Client struct + Account *AccountService + Analytics *AnalyticsService + Streams *StreamsService + Subscription *SubscriptionService + func NewClient(apiKey string, opts ...ClientOptions) (*Client, error) + func (c *Client) Stream(streamID string, opts ...StreamOptions) (*StreamClient, error) + type ClientOptions struct + APIBaseURL string + HTTPClient *http.Client + StreamBaseURL string + type CreateAPIKeyRequest struct + Key string + Name string + type DeleteKeyResponse struct + ID string + type DeleteStreamResponse struct + ID string + type DepositItem struct + Address string + DepositCount int64 + FirstDepositAt string + FirstTradeAt string + LastDepositAt string + LastTradeAt string + TotalDeposit string + type DepositQueryResult struct + Items []DepositItem + Total int64 + UpdatedAt string + type ErrorResponse struct + Error string + Message string + type HistoryMarket struct + ID int64 + Icon string + Outcomes [2]string + Question string + ResolvedAt string + Result int64 + SeriesSlug string + Slug string + type HourlyStat struct + CostBasis int64 + Fee int64 + Hour string + MakerVolume int64 + MarketCount int64 + PnL int64 + TakerVolume int64 + WinCount int64 + type LeaderboardResponse struct + TotalCount int64 + Traders []TraderSummary + type LiveOrder struct + Fee string + Order OrderInfo + Outcome string + Shares string + Side Side + TokenIdsIndex uint8 + USDC string + User MonitorTrader + type LiveTransaction struct + Makers []LiveOrder + Market Market + Taker LiveOrder + Timestamp string + TxHash string + type Market struct + ConditionId string + EventSlug string + GroupItemTitle string + ID int64 + NegRisk bool + Outcomes [2]string + Question string + SeriesSlug string + Slug string + SportsMarketType string + StartDate string + TagsSlug []string + TokenIds [2]string + type MarketDetailResponse struct + Market MarketMetadata + TopEarners []MarketEarner + TotalFees int64 + TotalPnlDistributed int64 + TotalTraders int64 + TotalVolume int64 + TotalWinners int64 + type MarketEarner struct + Orders []UserOrder + PnL int64 + Profile TraderIdentity + Rank int64 + Roi float64 + Volume int64 + type MarketMetadata struct + ConditionId string + CreatedAt string + Description string + EndDate string + EventSlug string + FeeSchedule map[string]any + FeeType string + FeesEnabled bool + GroupItemThreshold int64 + GroupItemTitle string + ID int64 + Icon string + NegRisk bool + Outcomes [2]string + Question string + ResolutionSource string + ResolvedAt string + Result int64 + SeriesSlug string + Slug string + SportsMarketType string + StartDate string + TagsSlug []string + TokenIds [2]string + type MarketSettlementDetail struct + LastTradeAt string + Market HistoryMarket + Orders []UserOrder + PnL int64 + Roi float64 + Volume int64 + type MonitorTrader struct + Address string + Name string + type OrderInfo struct + OrderHash string + Shares string + SignatureType int64 + Timestamp string + USDC string + type QuoteSubscriptionRequest struct + BillingCycle string + PromoCode string + Tier string + type QuoteSubscriptionResponse struct + AmountToPay int64 + BillingCycle string + CanAfford bool + CurrentBalance int64 + CurrentBillingCycle string + CurrentLicense string + CurrentTier string + DiscountAmount int64 + DurationDays int64 + IsActive bool + License string + Message string + OriginalPrice int64 + ProratedCredit int64 + Tier string + type Side string + const SideBuy + const SideSell + type StreamClient struct + func NewStreamClient(streamID, apiKey string, opts ...StreamOptions) (*StreamClient, error) + func (s *StreamClient) LastEventID() uint64 + func (s *StreamClient) SetOnHeartbeat(fn func()) + func (s *StreamClient) Subscribe(ctx context.Context) (<-chan *LiveTransaction, <-chan error) + type StreamOptions struct + HTTPClient *http.Client + HeartbeatTimeout time.Duration + InitialBackoff time.Duration + MaxBackoff time.Duration + StreamBaseURL string + type StreamsService struct + func (s *StreamsService) Connect(streamID string, opts ...StreamOptions) (*StreamClient, error) + func (s *StreamsService) Create(ctx context.Context, req *UserCreateStreamRequest) (*UserStreamResponse, error) + func (s *StreamsService) Delete(ctx context.Context, id string) (*DeleteStreamResponse, error) + func (s *StreamsService) Get(ctx context.Context, id string) (*UserStreamResponse, error) + func (s *StreamsService) GetActiveSessions(ctx context.Context) (*UserActiveSessionsResponse, error) + func (s *StreamsService) GetSessionHistory(ctx context.Context, limit int, offset int) (*UserSessionHistoryResponse, error) + func (s *StreamsService) List(ctx context.Context) (*UserStreamsResponse, error) + func (s *StreamsService) UpdateMetadata(ctx context.Context, id string, req *UserUpdateStreamMetadataRequest) (*UserStreamResponse, error) + func (s *StreamsService) UpdateSubscription(ctx context.Context, id string, req *UpdateSubscriptionRequest) (*UserStreamResponse, error) + type SubscribeRequest struct + BillingCycle string + IdempotencyKey string + PromoCode string + Tier string + type SubscribeResponse struct + Subscription UserSubscription + User UserProfile + type SubscriptionService struct + func (s *SubscriptionService) GetQuote(ctx context.Context, req *QuoteSubscriptionRequest) (*QuoteSubscriptionResponse, error) + func (s *SubscriptionService) ListTiers(ctx context.Context) ([]Tier, error) + func (s *SubscriptionService) Subscribe(ctx context.Context, req *SubscribeRequest) (*SubscribeResponse, error) + func (s *SubscriptionService) ValidatePromoCode(ctx context.Context, req *ValidatePromoCodeRequest) (*ValidatePromoCodeResponse, error) + type TagStat struct + MakerVolume int64 + MarketsCount int64 + PnL int64 + Roi float64 + Slug string + TakerVolume int64 + Volume int64 + WinRate float64 + WinsCount int64 + type Tier struct + AllowRestApi bool + AllowStream bool + AllowTrial bool + CreatedAt string + ID string + Level int64 + License string + MaxDailyRequests int64 + MaxDailyStreamSeconds int64 + MaxFilterAddrs int64 + MaxFilterSeries int64 + MaxFilterTags int64 + MaxKeys int64 + MaxNakedStreams int64 + MaxQps int64 + MaxSessions int64 + MaxStreams int64 + MonthlyCredits int64 + Name string + PriceMonthly int64 + PriceQuarterly int64 + PriceTrial int64 + PriceYearly int64 + TrialDurationDays int64 + UpdatedAt string + type TraderHistoryResponse struct + History []MarketSettlementDetail + TotalCount int64 + type TraderHourlyStatsResponse struct + Stats []HourlyStat + type TraderIdentity struct + Address string + Name string + ProfileCreatedAt string + ProfileImage string + XUsername string + type TraderProfileResponse struct + LastTradeAt string + Profile TraderIdentity + PusdBalance int64 + TakerTier int64 + TakerTierName string + TopTags []TagStat + WeightedVolume float64 + type TraderSummary struct + LastTradeAt string + MarketsCount int64 + Profile TraderIdentity + Rank int64 + Roi float64 + TotalPnl int64 + TotalVolume int64 + WinRate float64 + WinsCount int64 + type UpdateSubscriptionRequest struct + Addresses []string + Series []string + Tags []string + type UserAPIKey struct + CreatedAt string + Key string + Name string + Status int64 + type UserActiveSessionsResponse struct + Data []ActiveSessionInfo + TotalCount int64 + type UserCreateStreamRequest struct + Addresses []string + Name string + Series []string + Tags []string + type UserKeysResponse struct + Data []UserAPIKey + TotalCount int64 + type UserLedgerEntry struct + Amount int64 + BalanceAfter int64 + CreatedAt string + ReferenceId string + Type string + type UserLedgerResponse struct + Data []UserLedgerEntry + TotalCount int64 + type UserOrder struct + Fee int64 + IsTaker bool + Outcome string + Shares int64 + Side Side + Time string + USDC int64 + type UserOrdersResponse struct + Orders []UserOrder + type UserProfile struct + BillingCycle string + CreatedAt string + DepositAddress string + DepositBalance int64 + Email string + IsExpired bool + Status int64 + TelegramId int64 + Tier string + TierExpiresAt string + UpdatedAt string + type UserSessionHistoryResponse struct + Data []UserSessionRecord + TotalCount int64 + type UserSessionRecord struct + ApiKey string + ClientIp string + CloseReason string + ConnectedAt string + DisconnectedAt string + DurationSeconds int64 + PushedTxCount int64 + StreamId string + UserAgent string + type UserStreamResponse struct + ActiveSessions int64 + Addresses []string + CreatedAt string + Enabled bool + ID string + Name string + Series []string + Tags []string + UpdatedAt string + type UserStreamsResponse struct + Data []UserStreamResponse + TotalCount int64 + type UserSubscription struct + AmountPaid int64 + BillingCycle string + CreatedAt string + DiscountAmount int64 + DurationDays int64 + ExpiresAt string + OriginalPrice int64 + PlanTier string + PromoCode string + ProratedCredit int64 + StartsAt string + Status string + type UserTelemetryResponse struct + Date string + Endpoints map[string]any + TotalRequests int64 + type UserUpdateKeyRequest struct + Name string + Status int64 + type UserUpdateStreamMetadataRequest struct + Enabled bool + Name string + type UserWithdrawRequest struct + Network string + ToAddress string + Token string + type UserWithdrawResponse struct + User UserProfile + Withdrawal Withdrawal + type ValidatePromoCodeRequest struct + BillingCycle string + Code string + Tier string + type ValidatePromoCodeResponse struct + AmountToPay int64 + Code string + DiscountAmount int64 + Message string + OriginalPrice int64 + ProratedCredit int64 + Valid bool + type Withdrawal struct + Amount int64 + CreatedAt string + ID int64 + LastDepositAt string + Network string + RejectReason string + ReviewedAt string + Status string + ToAddress string + Token string + TxHash string + UpdatedAt string + UserEmail string + UserId int64