Describes github.com/stxapp/stx-go v0.3.1, the current release.
Constants and variables
Section titled “Constants and variables”const ( FeatureOAuth = "oauth" FeatureOAuthMember = "oauth.member" FeatureOAuthApp = "oauth.app" FeatureConnect = "connect" FeatureTermsSTXPage = "terms.stx_page" FeatureMarketsCreate = "markets.create" FeatureMarketTypes = "market_types" FeatureEventPlayers = "event_players" FeatureLeaderboard = "leaderboard" FeatureCombos = "combos"
// FeatureOrdersPostOnly is the id of post-only orders. // // Deprecated: the exchange no longer publishes whether it takes // post-only orders, so [Client.Capabilities] always reports this id as // nil (not known). Send the order with [PostOnly] and handle an error // matching [ErrNotAvailable]. An exchange on a release from before fill // modes may place the order as a normal limit order. FeatureOrdersPostOnly = "orders.post_only" // FeatureOrdersFillOrKill is the id of fill-or-kill orders. // // Deprecated: reported as nil (not known), as [FeatureOrdersPostOnly]. // Send the order with [FillOrKill] and handle an error matching // [ErrNotAvailable]. FeatureOrdersFillOrKill = "orders.fill_or_kill")Feature ids reported by Client.Capabilities and named by NotAvailableError.
const ( // FillNormal matches what it can and rests the rest. The default. FillNormal = "normal" // PostOnly rests only as a maker. When it would match on arrival the // exchange does not place it and [OrdersService.Place] returns a // *[PostOnlyWouldMatchError]. PostOnly = "post_only" // FillOrKill fills in full or not at all. The placement answers // "accepted" (or "delayed"); the order then ends "filled", or "cancelled" // with nothing filled. FillOrKill = "fill_or_kill")Fill modes for a limit order; see OrderRequest.FillMode.
const ( // MarketCreated: the market was created. MarketCreated = "created" // MarketExists: the market was already listed; MarketID is that market. MarketExists = "exists" // MarketValid: a dry run found nothing wrong; nothing was created. MarketValid = "valid" // MarketRejected: the market was not created; see Reason. MarketRejected = "rejected")Statuses of a CreateMarketResult.
const ( RejectInvalidMarket = "invalid_market" RejectUnsupportedRule = "unsupported_rule" RejectUnsupportedStat = "unsupported_stat" RejectInvalidLine = "invalid_line" RejectUnknownPlayer = "unknown_player" RejectEventNotOpen = "event_not_open" // RejectNotCreated: the answer had no result for the market. RejectNotCreated = "not_created")Reasons a market is rejected. The exchange may send reasons added after this version; compare with these constants and treat others as rejected.
const ( Buy = "buy" Sell = "sell"
Limit = "limit" MarketOrder = "market"
GoodTillStart = "good_till_start" GoodTillTime = "good_till_time")Order actions, types and expirations.
const ( HeaderAccessKey = "X-STX-ACCESS-KEY" HeaderAccessTimestamp = "X-STX-ACCESS-TIMESTAMP" HeaderAccessSignature = "X-STX-ACCESS-SIGNATURE")Headers carried by every signed request. See https://docs.stxapp.io for the signing scheme.
const MaxMarketsPerRequest = 25MaxMarketsPerRequest is the most markets one MarketsService.Create call takes.
const RulePlayerStatLine = "player_stat_line"RulePlayerStatLine is the market rule for over/under one player’s stat in one event, the only rule an app can create today.
Functions
Section titled “Functions”func Bool(v bool) *boolBool returns a pointer to v, for the tri-state filters and fields such as MarketsQuery.Trading and OrderRequest.CancelOnDisconnect.
Features
Section titled “Features”func Features() []stringFeatures returns every feature id Client.Capabilities reports.
IsValidLine
Section titled “IsValidLine”func IsValidLine(line float64) boolIsValidLine reports whether line is a valid line: positive and ending in .5.
KnownStats
Section titled “KnownStats”func KnownStats() map[string][]stringKnownStats returns the player stats by sport, as the exchange names them, for autocomplete. The stats an event accepts are the ones EventsService.Players returns for it.
AcceptTermsOptions
Section titled “AcceptTermsOptions”type AcceptTermsOptions struct { AcceptTerms *bool AcceptPrivacy *bool AcceptHouseRules *bool}AcceptTermsOptions sets which consents AccountService.AcceptTerms records. Nil fields default to true for terms and privacy, and are left out for house rules (the exchange then derives it).
Balance
Section titled “Balance”type Balance struct { // The account's cash balance. Unaffected by placing an order, but not all of // it may be available. In dollars. Money as a decimal string, exactly as sent // by the API. AccountBalance Decimal `json:"account_balance,omitempty"` // The account this balance is for. AccountID string `json:"account_id,omitempty"` // The balance available to withdraw or place further orders with. Rounded // **down** to the cent, so it never overstates what is spendable. In dollars. // Money as a decimal string, exactly as sent by the API. AvailableBalance Decimal `json:"available_balance,omitempty"` // The fee percentage on the `fixed_percent` schedule; `null` for any other // schedule. A number, not a money string. BaseFeePercent float64 `json:"base_fee_percent,omitempty"` // Total liability from buy orders, including the potential trade-fee reserve. // Rounded **up** to the cent. In dollars. Money as a decimal string, exactly // as sent by the API. BuyOrderLiability Decimal `json:"buy_order_liability,omitempty"` // The account's escrow balance. In dollars. Money as a decimal string, exactly // as sent by the API. Escrow Decimal `json:"escrow,omitempty"` // The account's fee schedule. One of: "fixed_percent", "revenue_share", // "loyalty_tier", "fixed_percent_market_group", "fixed_percent_event", // "on_trade", "loyalty_tier_on_trade". FeeSchedule string `json:"fee_schedule,omitempty"` // The account's loyalty tier. Every account has one; new accounts start at // `rookie`. One of: "rookie", "veteran", "all_star", "mvp", "hall_of_fame". LoyaltyTier string `json:"loyalty_tier,omitempty"` // Per-trade maker fee factor, present only on the `on_trade` and // `loyalty_tier_on_trade` schedules; `null` otherwise. A number, not a money // string. MakerFactor float64 `json:"maker_factor,omitempty"` // Loyalty points the account has accumulated. A whole number, not a money // string. Points int64 `json:"points,omitempty"` // Total liability from position premiums. Routinely negative. Rounded **up** // to the cent in both signs. In dollars. Money as a decimal string, exactly as // sent by the API. PositionPremiumLiability Decimal `json:"position_premium_liability,omitempty"` // Total liability from sell orders, including the potential trade-fee reserve. // Rounded **up** to the cent. In dollars. Money as a decimal string, exactly // as sent by the API. SellOrderLiability Decimal `json:"sell_order_liability,omitempty"` // Per-trade taker fee factor, present only on the `on_trade` and // `loyalty_tier_on_trade` schedules; `null` otherwise. A number, not a money // string. TakerFactor float64 `json:"taker_factor,omitempty"` // Lifetime total balance adjustments. In dollars. Money as a decimal string, // exactly as sent by the API. TotalAdjustments Decimal `json:"total_adjustments,omitempty"` // Lifetime total deposits. In dollars. Money as a decimal string, exactly as // sent by the API. TotalDeposits Decimal `json:"total_deposits,omitempty"` // Total fees from all settlements and other fees. In dollars. Money as a // decimal string, exactly as sent by the API. TotalFees Decimal `json:"total_fees,omitempty"` // Total gross profit and loss from all settlements. In dollars. Money as a // decimal string, exactly as sent by the API. TotalSettlementPnL Decimal `json:"total_settlement_pnl,omitempty"` // The number of trades the account has made across every market. TotalTradeCount int64 `json:"total_trade_count,omitempty"` // The risk the account has committed across every market. In dollars. Money as // a decimal string, exactly as sent by the API. TotalTraded Decimal `json:"total_traded,omitempty"` // Lifetime total withdrawals. In dollars. Money as a decimal string, exactly // as sent by the API. TotalWithdrawals Decimal `json:"total_withdrawals,omitempty"` // The user that owns the account. UserID string `json:"user_id,omitempty"`}Balance: One account’s balance and fee summary, in the dollar wire format.
BatchOrderResult
Section titled “BatchOrderResult”type BatchOrderResult struct { Order *Order `json:"order,omitempty"` Errors []string `json:"errors,omitempty"`}BatchOrderResult is one entry of OrdersService.PlaceBatch: the placed order, or why it was not placed.
BatchOrderResult.OK
Section titled “BatchOrderResult.OK”func (r BatchOrderResult) OK() boolOK reports whether the order was placed.
BookLevel
Section titled “BookLevel”type BookLevel struct { // The price of this level. In dollars. Money as a decimal string, exactly as // sent by the API. Price Decimal `json:"price,omitempty"` // Contracts resting at this price. Quantity as a decimal string, exactly as // sent by the API. Quantity Decimal `json:"quantity,omitempty"`}BookLevel: One price level of resting size on the book.
Cancellation
Section titled “Cancellation”type Cancellation struct { // The order this outcome relates to. OrderID string `json:"order_id,omitempty"` // The order status after cancelling, or a reason it was not cancelled, such as // "Order not found" for an unknown id. Status string `json:"status,omitempty"`}Cancellation: The outcome of cancelling one order.
Capabilities
Section titled “Capabilities”type Capabilities struct { // Host is the exchange host, such as "demo.stxapp.io". Host string // APIVersion is GET /api_version, or "" when it did not answer. APIVersion string // CheckedAt is when the checks ran. CheckedAt time.Time // ScopesSupported are the scopes the exchange's OAuth discovery document // lists; empty without OAuth. ScopesSupported []string // Features maps every feature id to true (the exchange has it), false // (it does not) or nil (not known: the check needs credentials this // client lacks, or the exchange did not answer). Features map[string]*bool}Capabilities is what an exchange showed it has.
Capabilities.Has
Section titled “Capabilities.Has”func (c *Capabilities) Has(feature string) boolHas reports whether the exchange is known to have feature.
Capabilities.Known
Section titled “Capabilities.Known”func (c *Capabilities) Known(feature string) boolKnown reports whether the check for feature had an answer.
Capabilities.Require
Section titled “Capabilities.Require”func (c *Capabilities) Require(feature string) errorRequire returns a *NotAvailableError when the exchange is known to lack feature, and nil otherwise. A feature that could not be checked does not fail here: the call that needs it will say.
CreateMarketResult
Section titled “CreateMarketResult”type CreateMarketResult struct { // Index is the market's position in the list given to Create. Index int // Status is MarketCreated, MarketExists, MarketValid or MarketRejected. Status string // MarketID is set when Status is MarketCreated or MarketExists. MarketID string // Reason is set when Status is MarketRejected, such as // RejectInvalidLine. Reason string // Market is the market as requested. Market NewMarket}CreateMarketResult is the outcome for one requested market.
CreateMarketsOptions
Section titled “CreateMarketsOptions”type CreateMarketsOptions struct { // Validate checks each market against the event's players and stats and // the line rule before sending. Failing markets come back rejected // without a request, and the rest are sent with the event's own stat key. // It reads the event's players, so an app token also needs the events // scope. Validate bool // DryRun runs every check on the exchange and creates nothing; a market // that would be created, or one already listed, comes back valid. DryRun bool}CreateMarketsOptions tune MarketsService.Create.
Decimal
Section titled “Decimal”type Decimal stringDecimal is an exact decimal number carried as its text, such as “0.5600” for a price in dollars or “100.00” for a quantity of contracts.
It round-trips through JSON unchanged: it is written as a JSON string, and read from a JSON string or a JSON number (keeping the number’s digits). Arithmetic is left to you; Decimal.Rat gives an exact big.Rat.
Example
Decimals keep the exact digits the API sends.
price := stx.MustDecimal("0.5600")fmt.Println(price, price.Cmp(stx.MustDecimal("0.56")) == 0)// Output: 0.5600 true0.5600 trueMustDecimal
Section titled “MustDecimal”func MustDecimal(s string) DecimalMustDecimal is ParseDecimal for constants: it panics when s is not a decimal number.
ParseDecimal
Section titled “ParseDecimal”func ParseDecimal(s string) (Decimal, error)ParseDecimal checks that s is a decimal number and returns it unchanged.
Decimal.Cmp
Section titled “Decimal.Cmp”func (d Decimal) Cmp(other Decimal) intCmp compares d and other numerically: -1 if d < other, 0 if equal, +1 if d > other. An empty or malformed value compares as zero.
Decimal.Float64
Section titled “Decimal.Float64”func (d Decimal) Float64() float64Float64 returns the nearest float64. It is lossy; use it for display and statistics, never to build a price or quantity you send back.
Decimal.IsZero
Section titled “Decimal.IsZero”func (d Decimal) IsZero() boolIsZero reports whether d is empty (absent) or numerically zero.
Decimal.MarshalJSON
Section titled “Decimal.MarshalJSON”func (d Decimal) MarshalJSON() ([]byte, error)MarshalJSON writes d as a JSON string, or null when d is empty.
Decimal.Rat
Section titled “Decimal.Rat”func (d Decimal) Rat() (r *big.Rat, ok bool)Rat returns d as an exact rational number. ok is false when d is empty or not a decimal number.
Decimal.String
Section titled “Decimal.String”func (d Decimal) String() stringString returns the decimal text.
Decimal.UnmarshalJSON
Section titled “Decimal.UnmarshalJSON”func (d *Decimal) UnmarshalJSON(data []byte) errorUnmarshalJSON reads a JSON string, a JSON number (its literal digits are kept), or null.
Decimal.Valid
Section titled “Decimal.Valid”func (d Decimal) Valid() boolValid reports whether d is a well-formed decimal number.
type Event struct { // Whether this event is archived. Archived bool `json:"archived,omitempty"` // The competition for this event Competition string `json:"competition,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The type of this event, e.g. `ad_hoc`, `baseball_game`, `basketball_game`. EventType string `json:"event_type,omitempty"` // The event's participants, as an array of `{name, role, short_name, // abbreviation}`. Participants []map[string]any `json:"participants,omitempty"` // Whether this event is promoted. Promoted bool `json:"promoted,omitempty"` // The short title for this event ShortTitle string `json:"short_title,omitempty"` // The sport for this event Sport string `json:"sport,omitempty"` // Start time of this event UNIX microseconds. StartTime int64 `json:"start_time,omitempty"` // Start time of this event StartTimeISO time.Time `json:"start_time_iso,omitzero"` // The status of this event One of: "scheduled", "in_progress", "completed", // "cancelled". Status string `json:"status,omitempty"` // The STX symbol for this event Symbol string `json:"symbol,omitempty"` // The title of this event Title string `json:"title,omitempty"`}Event: A sporting event that markets hang off.
EventPlayer
Section titled “EventPlayer”type EventPlayer struct { // PlayerID is what a new market names the player by. PlayerID string `json:"player_id"` Name string `json:"name"` Jersey string `json:"jersey,omitempty"` Position string `json:"position,omitempty"`}EventPlayer is one player on an event’s roster.
EventPlayers
Section titled “EventPlayers”type EventPlayers struct { EventID string `json:"event_id"` // Teams is empty until the rosters are published. Teams []EventTeam `json:"teams"` // Stats are the stats this event accepts. Stats []EventStat `json:"stats"`}EventPlayers are an event’s rosters and the stats a market on it can use.
EventStat
Section titled “EventStat”type EventStat struct { // Stat is the key to send, such as "POINTS". Stat string `json:"stat"` // Name is the display name, such as "Points". Name string `json:"name"`}EventStat is a stat a market can be created on.
EventTeam
Section titled “EventTeam”type EventTeam struct { Team string `json:"team"` Players []EventPlayer `json:"players"`}EventTeam is one team’s roster, sorted by player name.
EventVolume
Section titled “EventVolume”type EventVolume struct { EventID string `json:"event_id"` Volume Decimal `json:"volume"`}EventVolume is an “event” message: an event’s lifetime traded volume in dollars across its markets. It is the whole value, not a delta.
EventsQuery
Section titled “EventsQuery”type EventsQuery struct { EventIDs []string Sports []string Competitions []string EventTypes []string Title string // Status is "scheduled", "in_progress", "completed" or "cancelled". Status string Promoted *bool // SortBy is "start_time"; SortDirection is "asc" or "desc". SortBy string SortDirection string Limit int Cursor string}EventsQuery filters EventsService.List.
EventsReply
Section titled “EventsReply”type EventsReply struct { SelectedEventIDs []string `json:"selected_event_ids"` Events []EventVolume `json:"events"`}EventsReply is the events channel’s join reply, and the reply to Subscription.SelectEventIDs. An event with nothing traded is left out of Events.
FeeTransaction
Section titled “FeeTransaction”type FeeTransaction struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // The monetary value the entry was calculated from. In dollars. Money as a // decimal string, exactly as sent by the API. Amount Decimal `json:"amount,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The fee that generated this entry, when it came from one. FeeID string `json:"fee_id,omitempty"` // Unique identifier for the record. ID string `json:"id,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // The payment that generated this entry, when it came from one. PaymentID string `json:"payment_id,omitempty"` // Points added by this entry. Negative when points were spent. Points float64 `json:"points,omitempty"` // The settlement that generated this entry, when it came from one. SettlementID string `json:"settlement_id,omitempty"` // When the entry was recorded. Time time.Time `json:"time,omitzero"` // What moved the money or the points, for example a deposit, a trade fee, a // referral, or a manual adjustment. Each endpoint returns only its own subset // of these. One of: "deposit", "withdrawal", "settlement", "fee", // "fee_refund", "maker_rebate", "casino", "adjustment", "loyalty", // "loyalty_points_rollup", "loyalty_points_referral". Type string `json:"type,omitempty"`}FeeTransaction: One fee charged against the account, or a refund of one.
type Fill struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // The action of the trade relative to the user. One of: "buy", "sell". Action string `json:"action,omitempty"` // Internal. Operator audit trail, not part of the supported contract; do not // depend on it. AdminLog map[string]any `json:"admin_log,omitempty"` // True if STX has amended this trade. When true, compare `original_price` and // `original_filled` against the current values. Amended bool `json:"amended,omitempty"` // The client order id of the order that produced this trade, when one was // supplied. ClientOrderID string `json:"client_order_id,omitempty"` // The number of contracts closed on this trade. Quantity as a decimal string, // exactly as sent by the API. ClosedContracts Decimal `json:"closed_contracts,omitempty"` // The fee the user paid when closing the trade. In dollars. Money as a decimal // string, exactly as sent by the API. ClosedFee Decimal `json:"closed_fee,omitempty"` // Realized profit or loss on the closed portion. Negative for a loss. In // dollars. Money as a decimal string, exactly as sent by the API. ClosedNetPnL Decimal `json:"closed_net_pnl,omitempty"` // The profit or loss the user made by closing the trade. In dollars. Money as // a decimal string, exactly as sent by the API. ClosedPnL Decimal `json:"closed_pnl,omitempty"` // The amount of contracts (in position) that the trade is closing. Quantity as // a decimal string, exactly as sent by the API. Closing Decimal `json:"closing,omitempty"` // The device associated with this trade. DeviceID string `json:"device_id,omitempty"` // Number of contracts settled when market expired. Quantity as a decimal // string, exactly as sent by the API. ExpiredContracts Decimal `json:"expired_contracts,omitempty"` // The fee paid by the user when the market expired. In dollars. Money as a // decimal string, exactly as sent by the API. ExpiredFee Decimal `json:"expired_fee,omitempty"` // Realized profit or loss on the expired portion. In dollars. Money as a // decimal string, exactly as sent by the API. ExpiredNetPnL Decimal `json:"expired_net_pnl,omitempty"` // The profit or loss on the trade when the market expired. In dollars. Money // as a decimal string, exactly as sent by the API. ExpiredPnL Decimal `json:"expired_pnl,omitempty"` // When the trade expires if the market has not settled, as UNIX microseconds. ExpiresAt int64 `json:"expires_at,omitempty"` // The number of contracts that were traded. Quantity as a decimal string, // exactly as sent by the API. Filled Decimal `json:"filled,omitempty"` // The gross PNL as a result of the trade. In dollars. Money as a decimal // string, exactly as sent by the API. GrossPnL Decimal `json:"gross_pnl,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The IP address associated with this trade IPAddress string `json:"ip_address,omitempty"` // When STX last amended this trade, as UNIX microseconds. Null unless // `amended` is true. LastModifiedAt int64 `json:"last_modified_at,omitempty"` // Internal. Operator audit field, not part of the supported contract; do not // depend on it. LastModifiedByAdminID string `json:"last_modified_by_admin_id,omitempty"` // Whether the associated order was the `provider` or the `taker` of the // liquidity. One of: "provider", "taker". LiquidityAction string `json:"liquidity_action,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // When the position opened, as UNIX microseconds. OpenedAt int64 `json:"opened_at,omitempty"` // The ID of the order that caused the trade. OrderID string `json:"order_id,omitempty"` // Contracts filled at execution, before any amendment. Quantity as a decimal // string, exactly as sent by the API. OriginalFilled Decimal `json:"original_filled,omitempty"` // The amount of premium received for the original trade. In dollars. Money as // a decimal string, exactly as sent by the API. OriginalPremium Decimal `json:"original_premium,omitempty"` // Fill price at execution. Unchanged by later amendments. In dollars. Money as // a decimal string, exactly as sent by the API. OriginalPrice Decimal `json:"original_price,omitempty"` // The original risk introduced for the original trade excluding `closed`. In // dollars. Money as a decimal string, exactly as sent by the API. OriginalRisk Decimal `json:"original_risk,omitempty"` // The original gain if the position wins, for the trade excluding `closed`. In // dollars. Money as a decimal string, exactly as sent by the API. OriginalToWin Decimal `json:"original_to_win,omitempty"` // The amount of premium per contract. In dollars. Money as a decimal string, // exactly as sent by the API. PcPremium Decimal `json:"pc_premium,omitempty"` // The amount of risk per contract. In dollars. Money as a decimal string, // exactly as sent by the API. PcRisk Decimal `json:"pc_risk,omitempty"` // What each contract gains if the position wins: `max_price - price` on a buy, // `price` on a sell. In dollars. Money as a decimal string, exactly as sent by // the API. PcToWin Decimal `json:"pc_to_win,omitempty"` // True if the order was placed before the event started. PlacedPreStart bool `json:"placed_pre_start,omitempty"` // The total number of loyalty points awarded as a result of making the trade. Points float64 `json:"points,omitempty"` // Whether the trade was based on pre-start activity. PreStart bool `json:"pre_start,omitempty"` // The price that the trade was executed at. In dollars. Money as a decimal // string, exactly as sent by the API. Price Decimal `json:"price,omitempty"` // The number of unsettled contracts in the trade. Quantity as a decimal // string, exactly as sent by the API. Remaining Decimal `json:"remaining,omitempty"` // The potential fee from unsettled contracts. In dollars. Money as a decimal // string, exactly as sent by the API. RemainingPotentialFee Decimal `json:"remaining_potential_fee,omitempty"` // Premium as yet unsettled. In dollars. Money as a decimal string, exactly as // sent by the API. RemainingPremium Decimal `json:"remaining_premium,omitempty"` // The total current risk for the trade. In dollars. Money as a decimal string, // exactly as sent by the API. RemainingRisk Decimal `json:"remaining_risk,omitempty"` // What the unsettled contracts gain if the position wins. In dollars. Money as // a decimal string, exactly as sent by the API. RemainingToWin Decimal `json:"remaining_to_win,omitempty"` // The timestamp when this trade's status was set to `settled` SettledAt time.Time `json:"settled_at,omitzero"` // Contracts already settled. Below `traded_contracts` on a partial settlement. // Quantity as a decimal string, exactly as sent by the API. SettledContracts Decimal `json:"settled_contracts,omitempty"` // The number of settlements where this trade is the opening trade. SettlementsCount int64 `json:"settlements_count,omitempty"` // Fill state. `created` once the matching engine has written the fill, `open` // while the position is live, `settled` once it no longer contributes to a // position, and `cancelled` if STX reversed it. One of: "created", "open", // "settled", "cancelled". Status string `json:"status,omitempty"` // The ISO-8601 Date time the trade was created. Time time.Time `json:"time,omitzero"` // Sum of on-trade fee plus fees paid from settlements linked with the trade. // Negative when a maker rebate exceeds the fees paid. In dollars. Money as a // decimal string, exactly as sent by the API. TotalFee Decimal `json:"total_fee,omitempty"` // Per-trade fee (on-trade fee schedule). Included in total_fee. Negative for a // maker rebate. In dollars. Money as a decimal string, exactly as sent by the // API. TradeFee Decimal `json:"trade_fee,omitempty"` // Unique identifier for the trade. TradeID string `json:"trade_id,omitempty"` // Number of contracts in this trade. Quantity as a decimal string, exactly as // sent by the API. TradedContracts Decimal `json:"traded_contracts,omitempty"` // Fee before rounding; negative for a maker rebate. Use the rounded fee for // reconciliation. In dollars. Carries up to 9 decimal places; parse money with // a variable-scale decimal type, not a fixed-width one. Money as a decimal // string, exactly as sent by the API. UnroundedTradeFee Decimal `json:"unrounded_trade_fee,omitempty"` // Time of the last change, as UNIX microseconds. UpdatedAt int64 `json:"updated_at,omitempty"` // Remaining contracts including unsettled exposure. Quantity as a decimal // string, exactly as sent by the API. VirtualRemaining Decimal `json:"virtual_remaining,omitempty"`}Fill: One fill against one of your orders.
FillsQuery
Section titled “FillsQuery”type FillsQuery struct { MarketIDs []string OrderIDs []string // Status is "created", "open", "settled" or "cancelled". Status string Limit int Cursor string}FillsQuery filters PortfolioService.Fills.
FillsSnapshot
Section titled “FillsSnapshot”type FillsSnapshot struct { Trades []Fill `json:"trades"`}FillsSnapshot is “all_trades”: the fills behind your open positions.
FillsSnapshot.UnmarshalJSON
Section titled “FillsSnapshot.UnmarshalJSON”func (s *FillsSnapshot) UnmarshalJSON(data []byte) errorUnmarshalJSON reads the fills, taking TradeID from the channel’s “id”.
Leaderboard
Section titled “Leaderboard”type Leaderboard struct { // `all` or a sport key. Category string `json:"category,omitempty"` // Ranked rows, best first, at most the number of members STX shows per board // (never more than 100). Empty for a board STX hides. Leaderboard []LeaderboardEntry `json:"leaderboard,omitempty"` // The metric the rows are ranked on. One of: "volume", "profit", // "predictions", "markets", "win_rate", "biggest_win", "return", "streak". Metric string `json:"metric,omitempty"` // When this period's board resets: local midnight in America/New_York on the // next boundary, as UTC. `null` for `all`, which never resets, and before the // first snapshot. NextResetAt time.Time `json:"next_reset_at,omitzero"` // The period the board covers. One of: "daily", "weekly", "monthly", "yearly", // "all". Period string `json:"period,omitempty"` // When this snapshot was built. `null` before the first snapshot is published. RefreshedAt time.Time `json:"refreshed_at,omitzero"` // Whether STX shows this board to members. `false` means the board is hidden // and `leaderboard` is empty, not that nobody has ranked yet. Shown bool `json:"shown,omitempty"`}Leaderboard: One ranked board.
LeaderboardEntry
Section titled “LeaderboardEntry”type LeaderboardEntry struct { // Path of the member's avatar, `/avatars/{handle}.svg`, relative to the API // host. `null` when `handle` is `null`. AvatarURL string `json:"avatar_url,omitempty"` // The member's public handle. `null` for a member who has not set one. Handle string `json:"handle,omitempty"` // Dense rank, 1-based. Tied values share a rank. Rank int64 `json:"rank,omitempty"` // The sport the member traded most in the period, as a category key. On a // sport board it is that sport. `null` when unknown. TopSport string `json:"top_sport,omitempty"` // Path of the sport's icon, the same category icon the apps use, relative to // the API host. `null` when `top_sport` is `null`. TopSportIconURL string `json:"top_sport_icon_url,omitempty"` // The ranked value. A dollar string on money boards, an integer on count // boards and a number from 0 to 1 on ratio boards. Value Decimal `json:"value,omitempty"`}LeaderboardEntry: One ranked member.
LeaderboardQuery
Section titled “LeaderboardQuery”type LeaderboardQuery struct { // Period is "daily", "weekly", "monthly", "yearly" or "all". Period string // Category is "all" or a sport key. Category string // Metric is "volume", "profit", "predictions", "markets", "win_rate", // "biggest_win", "return" or "streak". Not used by Me. Metric string // Limit is the number of rows. Not used by Me. Limit int}LeaderboardQuery selects a board.
LeaderboardRank
Section titled “LeaderboardRank”type LeaderboardRank struct { // Rank is the dense rank, 1-based. Rank int64 `json:"rank"` // Value is the value ranked on. Value Decimal `json:"value"`}LeaderboardRank is a rank and the value ranked on, for one leaderboard metric. Value is in dollars on money metrics, a count on count metrics and a ratio between 0 and 1 on ratio metrics.
LeaderboardStanding
Section titled “LeaderboardStanding”type LeaderboardStanding struct { // Your rank and biggest single-market win; `null` when unranked or the board // is hidden. BiggestWin *LeaderboardRank `json:"biggest_win,omitempty"` // The category asked for. Category string `json:"category,omitempty"` // Your rank and markets settled; `null` when unranked or the board is hidden. Markets *LeaderboardRank `json:"markets,omitempty"` // Whether you appear on public boards. `false` is why every rank is `null` for // an opted-out member. OptedIn bool `json:"opted_in,omitempty"` // The period asked for. One of: "daily", "weekly", "monthly", "yearly", "all". Period string `json:"period,omitempty"` // Your rank and contracts settled; `null` when unranked or the board is // hidden. Predictions *LeaderboardRank `json:"predictions,omitempty"` // Your rank and net profit; `null` when unranked or the board is hidden. Profit *LeaderboardRank `json:"profit,omitempty"` // Your rank and return (profit / volume), `0.0`-`1.0`; needs $500 of volume; // `null` when unranked or the board is hidden. Return *LeaderboardRank `json:"return,omitempty"` // Markets decided (won or lost) in the period. `0` when unranked. SettledMarkets int64 `json:"settled_markets,omitempty"` // Your rank and longest winning streak; `null` when unranked or the board is // hidden. Streak *LeaderboardRank `json:"streak,omitempty"` // Your rank and notional traded; `null` when unranked or the board is hidden. Volume *LeaderboardRank `json:"volume,omitempty"` // Share of decided markets you won, `0.0`-`1.0`. `null` until at least 10 // markets have been decided in the period; a market settled at zero profit is // neither a win nor a loss. WinRate float64 `json:"win_rate,omitempty"` // Your rank and win rate, `0.0`-`1.0`; needs 10 decided markets to rank; // `null` when unranked or the board is hidden. WinRateRank *LeaderboardRank `json:"win_rate_rank,omitempty"`}LeaderboardStanding: Your standing in one period and category.
Market
Section titled “Market”type Market struct { // Whether the market is archived. Archived bool `json:"archived,omitempty"` // The top bids on the market, sorted by price descending, so the best // (highest) bid is first. Bids []BookLevel `json:"bids,omitempty"` // The text to use in describing the competition, e.g. NBA. Competition string `json:"competition,omitempty"` // The description of the market. Description string `json:"description,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The short title of the event associated with the market. EventShortTitle string `json:"event_short_title,omitempty"` // The UTC start date and time of the event. EventStart time.Time `json:"event_start,omitzero"` // The status of the event that the market is attached to. EventStatus string `json:"event_status,omitempty"` // The title of the event associated with the market. EventTitle string `json:"event_title,omitempty"` // The type of event associated with the market. EventType string `json:"event_type,omitempty"` // Whether the market is featured. Featured bool `json:"featured,omitempty"` // Whether the market is featured on the home page. FeaturedHome bool `json:"featured_home,omitempty"` // The categorizations under which the market appears. A list, not an object. Filters []MarketFilter `json:"filters,omitempty"` // The human readable group title for the market. GroupTitle string `json:"group_title,omitempty"` // Identity of the set of mutually exclusive outcomes this market prices // against: the 30 World Series contracts, the 4 AFC East contracts, one // fixture's moneyline pair. Opaque: compare for equality, never parse. Stable // for the life of the market, and present in every status, so it is the field // to map market data on. Unlike `symbol`, it does not move when a fixture is // rescheduled. GroupingID string `json:"grouping_id,omitempty"` // The grouping in words, e.g. `AL East Division`, `Spread - 1st Quarter`. // Descriptive rather than stable: for a tournament it is the event title, // which can be renamed. Display it; join on `grouping_id`. GroupingName string `json:"grouping_name,omitempty"` // The category in which the market appears: `Upcoming`, `Live` or `null`. HomeCategory string `json:"home_category,omitempty"` // The order delay (in seconds) when the event is in progress. InPlayDelaySec int64 `json:"in_play_delay_sec,omitempty"` // The keywords that are set for the market. Keywords []string `json:"keywords,omitempty"` // The time that the last probability update was received by the server. UNIX // microseconds. LastProbabilityAt int64 `json:"last_probability_at,omitempty"` // The price of the last executed trade. In dollars. Money as a decimal string, // exactly as sent by the API. LastTradedPrice Decimal `json:"last_traded_price,omitempty"` // `true` when the probability was set by hand, `false` when it came from the // pricing feed. A flag, not a probability figure. ManualProbability bool `json:"manual_probability,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // The contract rules document for this market, as a PDF, the same version as // `rules_version`. `null` where rules documents are not published, or before // one takes effect. MarketRulesPdfURL string `json:"market_rules_pdf_url,omitempty"` // The settlement value of one winning contract, and the ceiling on order // prices: an order must price strictly below it. Read it per market. In // dollars. Money as a decimal string, exactly as sent by the API. MaxPrice Decimal `json:"max_price,omitempty"` // The top offers on the market, sorted by price descending, so the best // (lowest) offer is last. Offers []BookLevel `json:"offers,omitempty"` // Current open interest in the market. In contracts. Quantity as a decimal // string, exactly as sent by the API. OpenInterest Decimal `json:"open_interest,omitempty"` // The participants of the market's event, as an array. Participants []map[string]any `json:"participants,omitempty"` // The cost of each loyalty point for amount risked by the user. PointsCost int64 `json:"points_cost,omitempty"` // Text describing the position this market takes, e.g. a participant name. A // label, not a numeric ordering. Position string `json:"position,omitempty"` // The provider used to result this market, or `null` when there is none. PoweredBy map[string]any `json:"powered_by,omitempty"` // The market price that the market is trading at. In dollars. Money as a // decimal string, exactly as sent by the API. Price Decimal `json:"price,omitempty"` // The change in price over the last 24 hours, as a percentage. Not money: it // stays a number and must not be divided by 100. PriceChange24h int64 `json:"price_change24h,omitempty"` // The market's probability of the outcome, between 0 and 1. Probability float64 `json:"probability,omitempty"` // The question that the market is asking. Question string `json:"question,omitempty"` // The last 15 trades on the market. RecentTrades []RecentTrade `json:"recent_trades,omitempty"` // The result of the market. Result string `json:"result,omitempty"` // The rules for this market. Rules string `json:"rules,omitempty"` // The version number of the contract rules document in force for this market. // `null` where rules documents are not published, or before one takes effect. RulesVersion int64 `json:"rules_version,omitempty"` // When the market was resulted or voided. A raw microsecond integer, unlike // the ISO-8601 `timestamp` and `event_start` beside it. UNIX microseconds. SettledAt int64 `json:"settled_at,omitempty"` // The human readable short title for the market. ShortTitle string `json:"short_title,omitempty"` // The specifier for the rules to properly determine the market. Specifier string `json:"specifier,omitempty"` // The text to use in describing the sport, e.g. Basketball. Sport string `json:"sport,omitempty"` // The stat line this market is derived from, or `null` for a market that is // not a stat-line prop. StatDetail *StatDetail `json:"stat_detail,omitempty"` // Market state. See [Market and order status](/concepts/market-status/). Note // that a market with `status: open` may still report as suspended when trading // is halted. One of: "scheduled", "pre_open", "open", "suspended", "closed", // "resulted", "cancelled", "voided". Status string `json:"status,omitempty"` // A unique symbol for this market. Symbol string `json:"symbol,omitempty"` // Server time when this payload was generated, as an ISO-8601 string. The // `timestamp_int` sibling carries the same instant as UNIX microseconds. Timestamp time.Time `json:"timestamp,omitzero"` // The UNIX microseconds timestamp of when this market info was created. TimestampInt int64 `json:"timestamp_int,omitempty"` // The human readable title for the market. Title string `json:"title,omitempty"` // Contracts traded on this market across its lifetime. Quantity as a decimal // string, exactly as sent by the API. TotalVolume Decimal `json:"total_volume,omitempty"` // Whether the market is accepting orders right now. Trading bool `json:"trading,omitempty"` // The categorizations used for organizing trades, settlements and related // items. A list, not an object. TradingFilters []MarketFilter `json:"trading_filters,omitempty"` // Trade volume this market has had in the last 24 hours. In contracts. // Quantity as a decimal string, exactly as sent by the API. Volume24h Decimal `json:"volume24h,omitempty"`}Market: A market you can trade, with its book and event context.
MarketBook
Section titled “MarketBook”type MarketBook struct { Bids []MarketBookLevel `json:"b"` Offers []MarketBookLevel `json:"o"`}MarketBook is the book on market:<id>.
MarketBookLevel
Section titled “MarketBookLevel”type MarketBookLevel struct { Price Decimal `json:"p"` Quantity Decimal `json:"q"` Liquidity Decimal `json:"l"` TotalQuantity Decimal `json:"tc"` TotalLiquidity Decimal `json:"tl"`}MarketBookLevel is one level of the book on market:<id>: price, quantity, liquidity, and the cumulative quantity and liquidity.
MarketChange
Section titled “MarketChange”type MarketChange struct { MarketID string `json:"market_id"` Symbol string `json:"symbol"` Title string `json:"title"` ShortTitle string `json:"short_title"` Status string `json:"status"` Result string `json:"result"` Trading *bool `json:"trading"` Rules string `json:"rules"` EventID string `json:"event_id"` EventStatus string `json:"event_status"` EventBrief string `json:"event_brief"` DetailedEventBrief string `json:"detailed_event_brief"` EventStart int64 `json:"event_start"` SettledAt string `json:"settled_at"` MaxPrice Decimal `json:"max_price"` Price Decimal `json:"price"` LastTradedPrice Decimal `json:"last_traded_price"` TotalVolume Decimal `json:"total_volume"` Volume24h Decimal `json:"volume_24h"` OpenInterest Decimal `json:"open_interest"` Probability *float64 `json:"probability"` Bids []BookLevel `json:"bids"` Offers []BookLevel `json:"offers"` Book *MarketBook `json:"ob"` Timestamp string `json:"timestamp"` UnixTimestamp int64 `json:"unix_timestamp"` // Fields holds every field sent, converted, by name. Fields map[string]json.RawMessage `json:"-"`}MarketChange is a market as the markets, market_updates and market:<id> channels send it: in full when a market is created (and as the market:<id> join reply), otherwise only the fields that changed. Use Has to tell a field that is absent from one that is null. Prices are dollar strings.
MarketChange.Has
Section titled “MarketChange.Has”func (m *MarketChange) Has(field string) boolHas reports whether the message carried field.
MarketChange.UnmarshalJSON
Section titled “MarketChange.UnmarshalJSON”func (m *MarketChange) UnmarshalJSON(data []byte) errorUnmarshalJSON decodes the known fields and keeps every field in Fields.
MarketChanges
Section titled “MarketChanges”type MarketChanges map[string]*MarketChangeMarketChanges is a markets channel message: market id to change.
MarketSeries
Section titled “MarketSeries”type MarketSeries struct { MarketID string `json:"market_id"` Points []PricePoint `json:"points"`}MarketSeries is one market’s price series. On “market_stats” it holds the buckets that changed (upsert them by TimestampUS); on “market_stats_snapshot” the whole series (replace it).
MarketStat
Section titled “MarketStat”type MarketStat struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // When the record was marked as archived. `null` until the market is archived. // UNIX microseconds. ArchivedAt int64 `json:"archived_at,omitempty"` // The amount of the `position` that is not reserved for pending orders. In // contracts. Quantity as a decimal string, exactly as sent by the API. AvailablePosition Decimal `json:"available_position,omitempty"` // The average premium of all open contracts. In dollars. Money as a decimal // string, exactly as sent by the API. AverageOpenPremium Decimal `json:"average_open_premium,omitempty"` // The total number of buy contracts that were closed. Quantity as a decimal // string, exactly as sent by the API. BuyContractsClosed Decimal `json:"buy_contracts_closed,omitempty"` // The total number of buy contracts that were expired. Quantity as a decimal // string, exactly as sent by the API. BuyContractsExpired Decimal `json:"buy_contracts_expired,omitempty"` // The total number of buy contracts settled in the position. Quantity as a // decimal string, exactly as sent by the API. BuyContractsSettled Decimal `json:"buy_contracts_settled,omitempty"` // The total number of buy contracts the account has traded. Only opening // trade's contracts are included. Quantity as a decimal string, exactly as // sent by the API. BuyContractsTraded Decimal `json:"buy_contracts_traded,omitempty"` // The order liability on this position from buy orders. In dollars. Money as a // decimal string, exactly as sent by the API. BuyOrderLiability Decimal `json:"buy_order_liability,omitempty"` // Count of all buy orders. BuyOrders int64 `json:"buy_orders,omitempty"` // The original risk incurred by buy trades. In dollars. Money as a decimal // string, exactly as sent by the API. BuyOriginalRisk Decimal `json:"buy_original_risk,omitempty"` // Count of all settlements from buy trades. BuySettlements int64 `json:"buy_settlements,omitempty"` // The total number of buy trades the account has made on the market. BuyTradeCount int64 `json:"buy_trade_count,omitempty"` // Sum of all not matched contracts in buy cancelled orders. Quantity as a // decimal string, exactly as sent by the API. CancelledBuyContracts Decimal `json:"cancelled_buy_contracts,omitempty"` // Number of buy orders that were cancelled. CancelledBuyOrders int64 `json:"cancelled_buy_orders,omitempty"` // Sum of all not matched contracts in all cancelled orders. Quantity as a // decimal string, exactly as sent by the API. CancelledContracts Decimal `json:"cancelled_contracts,omitempty"` // Number of orders that were cancelled. CancelledOrders int64 `json:"cancelled_orders,omitempty"` // Sum of all not matched contracts in sell cancelled orders. Quantity as a // decimal string, exactly as sent by the API. CancelledSellContracts Decimal `json:"cancelled_sell_contracts,omitempty"` // Number of sell orders that were cancelled. CancelledSellOrders int64 `json:"cancelled_sell_orders,omitempty"` // Total premium from closed buy trade contracts. In dollars. Money as a // decimal string, exactly as sent by the API. ClosedBuyPremium Decimal `json:"closed_buy_premium,omitempty"` // The total value of fees from closed settlements. In dollars. Money as a // decimal string, exactly as sent by the API. ClosedFees Decimal `json:"closed_fees,omitempty"` // The profit or loss the account has made in `closed` settlements. In dollars. // Money as a decimal string, exactly as sent by the API. ClosedGrossPnL Decimal `json:"closed_gross_pnl,omitempty"` // The net profit or loss after subtracting `closed_fees`. In dollars. Money as // a decimal string, exactly as sent by the API. ClosedNetPnL Decimal `json:"closed_net_pnl,omitempty"` // Total premium from closed contracts. In dollars. Money as a decimal string, // exactly as sent by the API. ClosedPremium Decimal `json:"closed_premium,omitempty"` // Total premium from closed sell trade contracts. In dollars. Money as a // decimal string, exactly as sent by the API. ClosedSellPremium Decimal `json:"closed_sell_premium,omitempty"` // The competition of this market Competition string `json:"competition,omitempty"` // The total number of all contracts that were closed. Quantity as a decimal // string, exactly as sent by the API. ContractsClosed Decimal `json:"contracts_closed,omitempty"` // The total number of all contracts that were expired. Quantity as a decimal // string, exactly as sent by the API. ContractsExpired Decimal `json:"contracts_expired,omitempty"` // Sum of all not matched contracts in buy orders. Quantity as a decimal // string, exactly as sent by the API. ContractsInBuyOrders Decimal `json:"contracts_in_buy_orders,omitempty"` // Sum of all unmatched contracts in all orders: each order's `quantity` minus // its `filled`. Quantity as a decimal string, exactly as sent by the API. ContractsInOrders Decimal `json:"contracts_in_orders,omitempty"` // Sum of all not matched contracts in sell orders. Quantity as a decimal // string, exactly as sent by the API. ContractsInSellOrders Decimal `json:"contracts_in_sell_orders,omitempty"` // The number of contracts that have been settled. Quantity as a decimal // string, exactly as sent by the API. ContractsSettled Decimal `json:"contracts_settled,omitempty"` // The total number of contracts traded (the sum of each fill's `filled`). Only // opening trades' contracts are counted, not contracts closing other trades. // Quantity as a decimal string, exactly as sent by the API. ContractsTraded Decimal `json:"contracts_traded,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The start time of the event. UNIX microseconds. EventStartTime int64 `json:"event_start_time,omitempty"` // Total premium from expired buy trade contracts. In dollars. Money as a // decimal string, exactly as sent by the API. ExpiredBuyPremium Decimal `json:"expired_buy_premium,omitempty"` // The total value of fees from expired settlements. In dollars. Money as a // decimal string, exactly as sent by the API. ExpiredFees Decimal `json:"expired_fees,omitempty"` // The profit or loss the account has made in `expired` settlements. In // dollars. Money as a decimal string, exactly as sent by the API. ExpiredGrossPnL Decimal `json:"expired_gross_pnl,omitempty"` // The net profit or loss after subtracting `expired_fees`. In dollars. Money // as a decimal string, exactly as sent by the API. ExpiredNetPnL Decimal `json:"expired_net_pnl,omitempty"` // Total premium from expired contracts. In dollars. Money as a decimal string, // exactly as sent by the API. ExpiredPremium Decimal `json:"expired_premium,omitempty"` // Total premium from expired sell trade contracts. In dollars. Money as a // decimal string, exactly as sent by the API. ExpiredSellPremium Decimal `json:"expired_sell_premium,omitempty"` // Internal. Virtual field naming the fee module in use, not part of the // supported contract. FeePlugin string `json:"fee_plugin,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // When the last settlement was created. UNIX microseconds. LastSettledAt int64 `json:"last_settled_at,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // The market's maximum price: the settlement value of one winning contract. In // dollars. Money as a decimal string, exactly as sent by the API. MarketMaxPrice Decimal `json:"market_max_price,omitempty"` // Worst-case loss if this market settles against the position you hold. In // dollars. Money as a decimal string, exactly as sent by the API. MaxLiabilityLoss Decimal `json:"max_liability_loss,omitempty"` // Worst-case loss if this market settles in favor of the position you hold. In // dollars. Money as a decimal string, exactly as sent by the API. MaxLiabilityWin Decimal `json:"max_liability_win,omitempty"` // The maximum potential fees including all actual fees paid. In dollars. Money // as a decimal string, exactly as sent by the API. MaxPotentialFee Decimal `json:"max_potential_fee,omitempty"` // The maximum potential profit, including all actual profit. In dollars. Money // as a decimal string, exactly as sent by the API. MaxPotentialProfit Decimal `json:"max_potential_profit,omitempty"` // The total amount of risk on unsettled contracts. In dollars. Money as a // decimal string, exactly as sent by the API. MaxRisk Decimal `json:"max_risk,omitempty"` // Internal. Consistency flag used by position rebuilds, not part of the // supported contract. NeedsRebuild bool `json:"needs_rebuild,omitempty"` // The number of open orders the account has on the market. OpenOrderCount int64 `json:"open_order_count,omitempty"` // The amount of potential fee that is related to unsettled contracts. In // dollars. Money as a decimal string, exactly as sent by the API. OpenPotentialFee Decimal `json:"open_potential_fee,omitempty"` // The potential profit from the outstanding contracts. In dollars. Money as a // decimal string, exactly as sent by the API. OpenPotentialProfit Decimal `json:"open_potential_profit,omitempty"` // Total premium on the user's current position in the market. In dollars. // Money as a decimal string, exactly as sent by the API. OpenPremium Decimal `json:"open_premium,omitempty"` // The amount of risk associated with outstanding contracts. In dollars. Money // as a decimal string, exactly as sent by the API. OpenRisk Decimal `json:"open_risk,omitempty"` // The number of open trades the account has on the market. OpenTradeCount int64 `json:"open_trade_count,omitempty"` // The order liability on this position from all orders. In dollars. Money as a // decimal string, exactly as sent by the API. OrderLiability Decimal `json:"order_liability,omitempty"` // Count of all orders. Orders int64 `json:"orders,omitempty"` // The original risk incurred by all trades. In dollars. Money as a decimal // string, exactly as sent by the API. OriginalRisk Decimal `json:"original_risk,omitempty"` // Fees that would be charged if the resting close orders all filled. In // dollars. Money as a decimal string, exactly as sent by the API. PendingCloseFee Decimal `json:"pending_close_fee,omitempty"` // Profit or loss that would be realized if the resting close orders all // filled. In dollars. Money as a decimal string, exactly as sent by the API. PendingClosePnL Decimal `json:"pending_close_pnl,omitempty"` // The numerical position of the account in the market. In contracts. Quantity // as a decimal string, exactly as sent by the API. Position Decimal `json:"position,omitempty"` // Internal. Links to a position-accountability alert, not part of the // supported contract. PositionAccountabilityAlertID string `json:"position_accountability_alert_id,omitempty"` // The liability of the position that affects available balance. In dollars. // Money as a decimal string, exactly as sent by the API. PositionPremiumLiability Decimal `json:"position_premium_liability,omitempty"` // Fees that would be charged if every open order on this market filled. In // dollars. Money as a decimal string, exactly as sent by the API. PotentialOrderTradeFee Decimal `json:"potential_order_trade_fee,omitempty"` // Number of buy orders that were rejected. RejectedBuyOrders int64 `json:"rejected_buy_orders,omitempty"` // Number of orders that were rejected. RejectedOrders int64 `json:"rejected_orders,omitempty"` // Number of sell orders that were rejected. RejectedSellOrders int64 `json:"rejected_sell_orders,omitempty"` // The total number of sell contracts that were closed. Quantity as a decimal // string, exactly as sent by the API. SellContractsClosed Decimal `json:"sell_contracts_closed,omitempty"` // The total number of sell contracts that were expired. Quantity as a decimal // string, exactly as sent by the API. SellContractsExpired Decimal `json:"sell_contracts_expired,omitempty"` // The total number of sell contracts settled in the position. Quantity as a // decimal string, exactly as sent by the API. SellContractsSettled Decimal `json:"sell_contracts_settled,omitempty"` // The total number of sell contracts the account has traded in the market. // Only opening trade's contracts are included. Quantity as a decimal string, // exactly as sent by the API. SellContractsTraded Decimal `json:"sell_contracts_traded,omitempty"` // The order liability on this position from sell orders. In dollars. Money as // a decimal string, exactly as sent by the API. SellOrderLiability Decimal `json:"sell_order_liability,omitempty"` // Count of all sell orders. SellOrders int64 `json:"sell_orders,omitempty"` // The original risk incurred by sell trades. In dollars. Money as a decimal // string, exactly as sent by the API. SellOriginalRisk Decimal `json:"sell_original_risk,omitempty"` // Count of all settlements from sell trades. SellSettlements int64 `json:"sell_settlements,omitempty"` // The total number of sell trades the account has made on the market. SellTradeCount int64 `json:"sell_trade_count,omitempty"` // When the expired settlements were recorded. `null` if the market has not // resulted or voided yet. UNIX microseconds. SettledAt int64 `json:"settled_at,omitempty"` // Count of all settlements from all trades. Settlements int64 `json:"settlements,omitempty"` // The sport of this market Sport string `json:"sport,omitempty"` // The status of the **market** this record covers, merged in from the live // market index. `null` when the market is no longer held there. Status string `json:"status,omitempty"` // The title of the **market** this record covers, merged in from the live // market index. `null` when the market is no longer held there. Title string `json:"title,omitempty"` // The total fees that have been collected on the settlements. In dollars. // Money as a decimal string, exactly as sent by the API. TotalFees Decimal `json:"total_fees,omitempty"` // The liability affecting available balance from open orders and position. In // dollars. Money as a decimal string, exactly as sent by the API. TotalLiability Decimal `json:"total_liability,omitempty"` // The net profit or loss after subtracting `total_fees`. In dollars. Money as // a decimal string, exactly as sent by the API. TotalNetPnL Decimal `json:"total_net_pnl,omitempty"` // The total profit or loss on all settlements. In dollars. Money as a decimal // string, exactly as sent by the API. TotalSettlementPnL Decimal `json:"total_settlement_pnl,omitempty"` // The total number of trades the account has made on the market. TradeCount int64 `json:"trade_count,omitempty"` // Time of the last change, as UNIX microseconds. UpdatedAt int64 `json:"updated_at,omitempty"`}MarketStat: Your exposure and realized result in one market.
MarketStatsQuery
Section titled “MarketStatsQuery”type MarketStatsQuery struct { MarketIDs []string EventIDs []string ExcludeZeroSettlements *bool // FromTime and ToTime bound the window, as Unix timestamps. FromTime int64 ToTime int64 Sports []string Competitions []string Limit int Cursor string}MarketStatsQuery filters PortfolioService.MarketStats.
MarketStatsReply
Section titled “MarketStatsReply”type MarketStatsReply struct { SelectedMarketIDs []string `json:"selected_market_ids"` Range StatsRange `json:"range"` Markets []MarketSeries `json:"markets"`}MarketStatsReply is the market_stats join reply, and the reply to Subscription.RequestSeries.
MarketType
Section titled “MarketType”type MarketType struct { PartnerCreate bool // Fields are the fields an entry takes besides its rule, by wire name. Fields map[string]MarketTypeField // EventTypes are the event types the rule runs on, keyed by event type // such as "NFL", with their stats. EventTypes map[string]MarketTypeEventType // EventTypeNames lists the event types of a rule that cannot be created. EventTypeNames []string}MarketType is one market rule. PartnerCreate says whether MarketsService.Create takes it; for those, Fields and EventTypes describe an entry, and for the others EventTypeNames lists where the rule runs.
MarketType.UnmarshalJSON
Section titled “MarketType.UnmarshalJSON”func (m *MarketType) UnmarshalJSON(data []byte) errorUnmarshalJSON reads either shape of a market type.
MarketTypeEventType
Section titled “MarketTypeEventType”type MarketTypeEventType struct { Sport string `json:"sport"` Stats []EventStat `json:"stats"`}MarketTypeEventType is the stats one event type offers.
MarketTypeField
Section titled “MarketTypeField”type MarketTypeField struct { // Type is its JSON type, such as "string" or "number". Type string `json:"type"` Description string `json:"description"`}MarketTypeField is one field a market entry takes besides its rule.
MarketTypes
Section titled “MarketTypes”type MarketTypes map[string]MarketTypeMarketTypes are the market rules, keyed by rule such as “player_stat_line”.
MarketsQuery
Section titled “MarketsQuery”type MarketsQuery struct { MarketIDs []string EventIDs []string // Status is one or more market statuses, such as "pre_open" and "open". Status []string // Trading true lists only markets accepting orders now; false only those // that are not. Trading *bool Sports []string Competitions []string // SortBy is "event_start"; SortDirection is "asc" or "desc". SortBy string SortDirection string // Limit is the page size: default 100, maximum 200. Limit int Cursor string}MarketsQuery filters MarketsService.List. Filters combine with AND; a list filter matches any of its values.
type Me struct { // Your account id. Trades, settlements and balances are scoped to it. AccountID string `json:"account_id,omitempty"` // Path of your avatar, `/avatars/{handle}.svg`, relative to the API host. // `null` when `handle` is `null`. AvatarURL string `json:"avatar_url,omitempty"` // First name on the account, or `null` if no profile is loaded. FirstName string `json:"first_name,omitempty"` // Your public handle, shown on the leaderboard in place of your name. `null` // until one is set. Handle string `json:"handle,omitempty"` // When you may next change your handle. `null` means now; otherwise the end of // the 30-day window since the last change. HandleChangeableAt time.Time `json:"handle_changeable_at,omitzero"` // The id of the API key that signed this request: the value sent in the // access-key header. `null` on a bearer request. KeyID string `json:"key_id,omitempty"` // Last name on the account, or `null` if no profile is loaded. LastName string `json:"last_name,omitempty"` // Whether you have consented to appear on public leaderboards. New accounts // start with the jurisdiction's default; accounts from before the leaderboard // start at `false`. Change it with `PATCH /api/v1/me/profile`. LeaderboardOptIn bool `json:"leaderboard_opt_in,omitempty"` // How this request authenticated: `api_key` for a signed request, `bearer` for // a session token. One of: "api_key", "bearer". Method string `json:"method,omitempty"` // Access level granted to this key: `read_only`, or `read_write` for keys that // may place and cancel orders. `null` on a bearer request. One of: // "read_only", "read_write". Scope string `json:"scope,omitempty"` // Your user id. Substitute this into account channel topics such as // `orders:{user_id}`. UserID string `json:"user_id,omitempty"`}Me: The account behind the credential.
NewMarket
Section titled “NewMarket”type NewMarket struct { // Rule is the market rule. Empty means RulePlayerStatLine. Rule string `json:"rule"` // PlayerID is from [EventsService.Players]. PlayerID string `json:"player_id"` // Stat is one of the event's stats, such as "POINTS". Stat string `json:"stat"` // Line is a positive number ending in .5, such as 18.5. Whole and // quarter lines, zero and negatives are rejected (invalid_line). Line float64 `json:"line"`}NewMarket is one market to create. It is also the request echoed back in each CreateMarketResult.
type Order struct { // When the matching engine accepted the order. `null` while the order is still // pending. UNIX microseconds. AcceptedAt int64 `json:"accepted_at,omitempty"` // The action of the order, either `buy` or `sell`. One of: "buy", "sell". Action string `json:"action,omitempty"` // Order size in dollars, for an order entered by amount rather than by // contract quantity. `null` for orders placed through this API, which always // take a quantity. Money as a decimal string, exactly as sent by the API. Amount Decimal `json:"amount,omitempty"` // Volume-weighted average fill price. `null` until the order has its first // fill. In dollars. Money as a decimal string, exactly as sent by the API. AvgPrice Decimal `json:"avg_price,omitempty"` // The cancellation reason, if the order was cancelled. CancellationReason string `json:"cancellation_reason,omitempty"` // Your own identifier, echoed back unchanged, or `null` if you sent none. A // free-form string, not a UUID, and set by REST and FIX callers alike. ClientOrderID string `json:"client_order_id,omitempty"` // The extended deadline for a delayed order. UNIX microseconds. DelayedUntil int64 `json:"delayed_until,omitempty"` // The device from which this order was placed. DeviceID string `json:"device_id,omitempty"` // The expiration condition for the order. One of: "good_till_start", // "good_till_time". Expiration string `json:"expiration,omitempty"` // The expiration time for time-based expiration. UNIX microseconds. ExpirationTime int64 `json:"expiration_time,omitempty"` // When the contracts this order trades expire, as UNIX microseconds: the // market's expiration, copied onto the order when it is placed. `null` when // the market has no event. Not the same as `expiration_time`. ExpiresAt int64 `json:"expires_at,omitempty"` // How the order matches: `normal`, `post_only` or `fill_or_kill` for a limit // order you placed, `cancel_unfilled` for a market order, `rfq` or `quote` for // an order of a combination bind. FillMode string `json:"fill_mode,omitempty"` // Contracts filled so far. Compare with `quantity` to get remaining size. // Quantity as a decimal string, exactly as sent by the API. Filled Decimal `json:"filled,omitempty"` // The portion of `amount` that has been filled. In dollars. Money as a decimal // string, exactly as sent by the API. FilledAmount Decimal `json:"filled_amount,omitempty"` // The percentage of the contracts on the order that have been filled. A // percentage, not money. FilledPercentage int64 `json:"filled_percentage,omitempty"` // True if the order arrived over FIX rather than REST. FixOrder bool `json:"fix_order,omitempty"` // Unique identifier for the record. ID string `json:"id,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The IP address from which this order was placed. IPAddress string `json:"ip_address,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // Legacy. The odds format (`decimal` or `american`) an order was entered in on // an STX app. `null` for orders placed through this API. OddsType string `json:"odds_type,omitempty"` // Legacy. The odds an order was entered at on an STX app, as a string. `null` // for orders placed through this API. OddsValue string `json:"odds_value,omitempty"` // The type of order, either `limit` or `market`. One of: "limit", "market". OrderType string `json:"order_type,omitempty"` // Whether the order was placed before the event started. PlacedPreStart bool `json:"placed_pre_start,omitempty"` // Limit price, below the market's `max_price`; read that per market rather // than assuming a ceiling. Absent for market orders. In dollars. Carries up to // 7 decimal places; parse money with a variable-scale decimal type, not a // fixed-width one. Money as a decimal string, exactly as sent by the API. Price Decimal `json:"price,omitempty"` // Order size in contracts. Quantity as a decimal string, exactly as sent by // the API. Quantity Decimal `json:"quantity,omitempty"` // The rejection reason, if the order was rejected. RejectionReason string `json:"rejection_reason,omitempty"` // Order state, one of nine. See [Market and order // status](/concepts/market-status/#order-statuses) for the full set and which // are terminal. One of: "created", "requested", "accepted", "delayed", "open", // "filled", "rejected", "cancelled", "partially_cancelled". Status string `json:"status,omitempty"` // The ISO-8601 timestamp of the time the order was placed. Time time.Time `json:"time,omitzero"` // Total premium across all fills on this order. In dollars. Money as a decimal // string, exactly as sent by the API. TotalValue Decimal `json:"total_value,omitempty"`}Order: An order resting on, or already matched against, the exchange book.
OrderNumbers
Section titled “OrderNumbers”type OrderNumbers struct { Ref string `json:"ref"` MarketID string `json:"market_id"` SelfMatch bool `json:"self_match"` Risk Decimal `json:"risk"` Fee Decimal `json:"fee"` RiskWithFee Decimal `json:"risk_with_fee"` FillQty Decimal `json:"fill_qty"` UnfilledQty Decimal `json:"unfilled_qty"` FillLevels []OrderSlipFill `json:"est_fill_at_price"`}OrderNumbers is one entry’s projected cost.
OrderNumbersBatch
Section titled “OrderNumbersBatch”type OrderNumbersBatch struct { Updates []OrderNumbers `json:"updates"`}OrderNumbersBatch is “order_numbers_batch”: every entry whose numbers changed.
OrderRequest
Section titled “OrderRequest”type OrderRequest struct { MarketID string `json:"market_id"` // Action is [Buy] or [Sell]. Action string `json:"action"` // OrderType is [Limit] or [MarketOrder]. OrderType string `json:"order_type"` // Quantity is the number of contracts, such as "100". Required. Quantity Decimal `json:"quantity"` // Price is in dollars, such as "0.58". Required for a limit order. Price Decimal `json:"price,omitempty"` // ClientOrderID is your own reference, echoed back. Set it so you can // look an order up after a timeout: a POST is never retried. ClientOrderID string `json:"client_order_id,omitempty"` // Expiration is [GoodTillStart] or [GoodTillTime]. Expiration string `json:"expiration,omitempty"` // ExpirationTime is Unix microseconds, with Expiration GoodTillTime. ExpirationTime int64 `json:"expiration_time,omitempty"` // CancelOnDisconnect cancels the order if the orders channel stops // heartbeating. CancelOnDisconnect *bool `json:"cancel_on_disconnect,omitempty"` DeviceID string `json:"device_id,omitempty"` // FillMode is how a limit order matches: [FillNormal] (the default), // [PostOnly] or [FillOrKill]. An exchange that has not enabled the mode // rejects the order, and the call returns a *[NotAvailableError]. FillMode string `json:"fill_mode,omitempty"`}OrderRequest is one new order.
OrderbookLevel
Section titled “OrderbookLevel”type OrderbookLevel struct { Price Decimal `json:"price"` Quantity Decimal `json:"quantity"` Liquidity Decimal `json:"liquidity"` TotalQuantity Decimal `json:"total_quantity"` TotalLiquidity Decimal `json:"total_liquidity"`}OrderbookLevel is one price level of the aggregated book. Liquidity is that level alone; the totals are cumulative through it.
OrderbookUpdate
Section titled “OrderbookUpdate”type OrderbookUpdate struct { MarketID string `json:"market_id"` Bids []OrderbookLevel `json:"bids"` Offers []OrderbookLevel `json:"offers"` Timestamp string `json:"timestamp"` TimestampUS int64 `json:"timestamp_us"`}OrderbookUpdate is a “book” message: one market’s whole book, best level first. Replace the book you hold.
OrdersQuery
Section titled “OrdersQuery”type OrdersQuery struct { OrderIDs []string ClientOrderIDs []string MarketIDs []string // Status is one or more order statuses, such as "accepted", "delayed" // and "open". Status []string Limit int Cursor string}OrdersQuery filters OrdersService.List.
OrdersSnapshot
Section titled “OrdersSnapshot”type OrdersSnapshot struct { Orders []Order `json:"orders"`}OrdersSnapshot is “all_orders”: your open orders on join.
type Page[T any] struct { Items []T Cursor string}Page is one page of a list endpoint. Cursor is the opaque value to pass back for the next page; it is empty on the last page.
Page.HasMore
Section titled “Page.HasMore”func (p *Page[T]) HasMore() boolHasMore reports whether another page exists.
PageQuery
Section titled “PageQuery”type PageQuery struct { Limit int Cursor string}PageQuery is the paging for the history lists that take no filters.
PaymentTransaction
Section titled “PaymentTransaction”type PaymentTransaction struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // The monetary value the entry was calculated from. In dollars. Money as a // decimal string, exactly as sent by the API. Amount Decimal `json:"amount,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The fee that generated this entry, when it came from one. FeeID string `json:"fee_id,omitempty"` // Unique identifier for the record. ID string `json:"id,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // The payment method the provider reports for this transaction. Method string `json:"method,omitempty"` // The payment that generated this entry, when it came from one. PaymentID string `json:"payment_id,omitempty"` // Points added by this entry. Negative when points were spent. Points float64 `json:"points,omitempty"` // The provider's reason or description for the transaction. Reason string `json:"reason,omitempty"` // The settlement that generated this entry, when it came from one. SettlementID string `json:"settlement_id,omitempty"` // For Interac, whether the transfer was a `Send` or a `Request`. SubMethod string `json:"sub_method,omitempty"` // When the entry was recorded. Time time.Time `json:"time,omitzero"` // What moved the money or the points, for example a deposit, a trade fee, a // referral, or a manual adjustment. Each endpoint returns only its own subset // of these. One of: "deposit", "withdrawal", "settlement", "fee", // "fee_refund", "maker_rebate", "casino", "adjustment", "loyalty", // "loyalty_points_rollup", "loyalty_points_referral". Type string `json:"type,omitempty"`}PaymentTransaction: One deposit, withdrawal or balance adjustment, enriched with its payment method.
PaymentUpdate
Section titled “PaymentUpdate”type PaymentUpdate struct { ID string `json:"id"` AccountID string `json:"account_id"` Provider string `json:"provider"` ProviderID string `json:"provider_id"` Status string `json:"status"` Type string `json:"type"` Amount Decimal `json:"amount"` Data json.RawMessage `json:"data"`}PaymentUpdate is “payment_update”: a payment changed status. Data is the provider’s own detail.
Position
Section titled “Position”type Position struct { // The account the position belongs to. AccountID string `json:"account_id,omitempty"` // Average premium per contract for the open portion. In dollars. Money as a // decimal string, exactly as sent by the API. AverageOpenPremium Decimal `json:"average_open_premium,omitempty"` // Liability from your open buy orders on this market. In dollars. Money as a // decimal string, exactly as sent by the API. BuyOrderLiability Decimal `json:"buy_order_liability,omitempty"` // Contracts settled in the position so far. Quantity as a decimal string, // exactly as sent by the API. ContractsSettled Decimal `json:"contracts_settled,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // `total_settlement_pnl` plus any pending-close profit or loss that has not // settled yet. In dollars. Money as a decimal string, exactly as sent by the // API. GrossPnL Decimal `json:"gross_pnl,omitempty"` // The unique id of the position record. ID string `json:"id,omitempty"` // The market the position is on. MarketID string `json:"market_id,omitempty"` // Total potential fee across the position's settlements. In dollars. Money as // a decimal string, exactly as sent by the API. MaxPotentialFee Decimal `json:"max_potential_fee,omitempty"` // Total possible profit for the position if everything settles favorably. In // dollars. Money as a decimal string, exactly as sent by the API. MaxPotentialProfit Decimal `json:"max_potential_profit,omitempty"` // Account-level risk on the position, netting in already settled profit and // loss. In dollars. Money as a decimal string, exactly as sent by the API. MaxRisk Decimal `json:"max_risk,omitempty"` // A combination position's payout per dollar risked: max price over the // buy-side average fill, floored to two places. `null` for any market that is // not a combination. Multiplier float64 `json:"multiplier,omitempty"` // Potential fee on the open contracts when they settle. In dollars. Money as a // decimal string, exactly as sent by the API. OpenPotentialFee Decimal `json:"open_potential_fee,omitempty"` // Possible profit on the position's open contracts. In dollars. Money as a // decimal string, exactly as sent by the API. OpenPotentialProfit Decimal `json:"open_potential_profit,omitempty"` // Risk on the position's open (unsettled) contracts. In dollars. Money as a // decimal string, exactly as sent by the API. OpenRisk Decimal `json:"open_risk,omitempty"` // Net position in the market: positive if long (bought), negative if short // (sold). Can be `"0.00"` for a market you have traded and closed out that has // not settled yet. In contracts. Quantity as a decimal string, exactly as sent // by the API. Position Decimal `json:"position,omitempty"` // Liability from the position's premium that counts against available balance. // Routinely negative. In dollars. Money as a decimal string, exactly as sent // by the API. PositionPremiumLiability Decimal `json:"position_premium_liability,omitempty"` // Total premium paid or received for the open portion of the position. In // dollars. Money as a decimal string, exactly as sent by the API. Premium Decimal `json:"premium,omitempty"` // Liability from your open sell orders on this market. In dollars. Money as a // decimal string, exactly as sent by the API. SellOrderLiability Decimal `json:"sell_order_liability,omitempty"` // Total fees paid across the position's settlements. In dollars. Money as a // decimal string, exactly as sent by the API. TotalFee Decimal `json:"total_fee,omitempty"` // Profit or loss realized from settlements so far. In dollars. Money as a // decimal string, exactly as sent by the API. TotalSettlementPnL Decimal `json:"total_settlement_pnl,omitempty"`}Position: Your position in one market.
PositionsQuery
Section titled “PositionsQuery”type PositionsQuery struct { MarketIDs []string}PositionsQuery filters AccountService.Positions.
PositionsSnapshot
Section titled “PositionsSnapshot”type PositionsSnapshot struct { Positions []Position `json:"positions"`}PositionsSnapshot is “all_positions”: your positions on join.
PositionsUpdate
Section titled “PositionsUpdate”type PositionsUpdate struct { Positions []Position `json:"positions"`}PositionsUpdate is “updated_positions”: only the positions that changed.
PoweredBy
Section titled “PoweredBy”type PoweredBy struct { // A link to the provider, or to its page for the event. Link string `json:"link,omitempty"` // The provider's name, e.g. `ESPN`. Provider string `json:"provider,omitempty"`}PoweredBy: The data provider that results a market.
PricePoint
Section titled “PricePoint”type PricePoint struct { TimestampUS int64 `json:"timestamp_us"` PricePercent float64 `json:"price_percent"`}PricePoint is one bucket of a price series: its start in Unix microseconds and its closing price as a percent of the market’s max price.
ProfileAvatar
Section titled “ProfileAvatar”type ProfileAvatar struct { // Style is one of "dots", "rings", "stripes", "grid". Style string `json:"style"` // Palette is one of "ember", "forest", "ocean", "grape", "slate", "mint", // "rose", "gold". Palette string `json:"palette"` // Seed is 1 to 32 characters; the same seed always renders the same image. Seed string `json:"seed"`}ProfileAvatar is a generated avatar. Any style and palette pair renders; the seed selects the pattern.
ProfileUpdate
Section titled “ProfileUpdate”type ProfileUpdate struct { // Handle is the new public handle: 3 to 24 lowercase letters, digits and // inner "." or "_". It may change once every 30 days. Handle string `json:"handle,omitempty"` // Avatar is a new avatar. Avatar *ProfileAvatar `json:"avatar,omitempty"` // LeaderboardOptIn joins (true) or leaves (false) the public boards. LeaderboardOptIn *bool `json:"leaderboard_opt_in,omitempty"`}ProfileUpdate holds the public-profile fields to change. Leave a field unset to keep it; at least one must be set.
PublicTrade
Section titled “PublicTrade”type PublicTrade struct { MarketID string `json:"market_id"` MarketSymbol string `json:"market_symbol"` EventID string `json:"event_id"` EventSymbol string `json:"event_symbol"` Price Decimal `json:"price"` Quantity Decimal `json:"quantity"` Action string `json:"action"` Timestamp string `json:"timestamp"` TimestampUS int64 `json:"timestamp_us"`}PublicTrade is a “trade” message on the trades channel: an anonymous execution. Action is the taker’s side, “buy” or “sell”.
RecentTrade
Section titled “RecentTrade”type RecentTrade struct { // Which side took liquidity. `Trade.liquidity_taker/1` derives this from the // resting side, so the values are `buyer` and `seller`, not `buy`/`sell` as on // an order's `action`. One of: "buyer", "seller". LiquidityTaker string `json:"liquidity_taker,omitempty"` // The price the trade executed at. In dollars. Money as a decimal string, // exactly as sent by the API. Price Decimal `json:"price,omitempty"` // Contracts traded. Quantity as a decimal string, exactly as sent by the API. Quantity Decimal `json:"quantity,omitempty"` // When the trade executed. Timestamp time.Time `json:"timestamp,omitzero"` // When the trade executed, as UNIX microseconds. TimestampUs int64 `json:"timestamp_us,omitempty"`}RecentTrade: One recent trade on the market.
SelfMatchBatch
Section titled “SelfMatchBatch”type SelfMatchBatch struct { Updates []OrderSlipRef `json:"updates"`}SelfMatchBatch is “self_match_batch”: entries whose self-match flag flipped.
Settlement
Section titled “Settlement”type Settlement struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // Whether the closing trade's order was placed before the event started. ClosingPlacedPreStart bool `json:"closing_placed_pre_start,omitempty"` // The price of the contracts when the position was closed. In dollars. Money // as a decimal string, exactly as sent by the API. ClosingPrice Decimal `json:"closing_price,omitempty"` // The id of the trade that closed this settlement, if any. ClosingTradeID string `json:"closing_trade_id,omitempty"` // Whether the closing trade was placed before the event started. ClosingTradedPreStart bool `json:"closing_traded_pre_start,omitempty"` // The fee charged for the settlement. In dollars. Money as a decimal string, // exactly as sent by the API. Fee Decimal `json:"fee,omitempty"` // The profit or loss associated with the position. In dollars. Money as a // decimal string, exactly as sent by the API. GrossPnL Decimal `json:"gross_pnl,omitempty"` // Unique identifier for the record. ID string `json:"id,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // Whether the opening trade's order was placed before the event started. OpeningPlacedPreStart bool `json:"opening_placed_pre_start,omitempty"` // The price of the contracts when the position was opened. In dollars. Money // as a decimal string, exactly as sent by the API. OpeningPrice Decimal `json:"opening_price,omitempty"` // The id of the trade that opened this settlement. OpeningTradeID string `json:"opening_trade_id,omitempty"` // Whether the opening trade was placed before the event started. OpeningTradedPreStart bool `json:"opening_traded_pre_start,omitempty"` // Whether the settlement was placed before the event started. PreStart bool `json:"pre_start,omitempty"` // The number of contracts that were settled. Quantity as a decimal string, // exactly as sent by the API. Quantity Decimal `json:"quantity,omitempty"` // The net profit or loss minus fees. In dollars. Money as a decimal string, // exactly as sent by the API. RealizedPnL Decimal `json:"realized_pnl,omitempty"` // The amount of premium that was settled by the trade. In dollars. Money as a // decimal string, exactly as sent by the API. SettledPremium Decimal `json:"settled_premium,omitempty"` // The amount of risk that was settled by the trade. In dollars. Money as a // decimal string, exactly as sent by the API. SettledRisk Decimal `json:"settled_risk,omitempty"` // ISO-8601 timestamp of when the settlement was created. Same instant as // `inserted_at`, which carries it as UNIX microseconds. Time time.Time `json:"time,omitzero"` // The type of settlement. One of: "closed_short", "closed_long", // "expired_short", "expired_long". Type string `json:"type,omitempty"`}Settlement: One closed or expired position.
SettlementsQuery
Section titled “SettlementsQuery”type SettlementsQuery struct { MarketIDs []string // Type is "closed_short", "closed_long", "expired_short" or // "expired_long". Type string Limit int Cursor string}SettlementsQuery filters PortfolioService.Settlements.
SettlementsUpdate
Section titled “SettlementsUpdate”type SettlementsUpdate struct { Settlements []Settlement `json:"settlements"`}SettlementsUpdate is “new_settlements”.
StatDetail
Section titled “StatDetail”type StatDetail struct { // The player's jersey number, when known. Jersey string `json:"jersey,omitempty"` // The line value the market sits at, when the prop carries one. Line float64 `json:"line,omitempty"` // The participant the line belongs to, when applicable. Participant string `json:"participant,omitempty"` // The player the line belongs to, or `null` for a team line. Player string `json:"player,omitempty"` // The shape of the prop. One of: "ou", "yn", "1v2", "field". PropType string `json:"prop_type,omitempty"` // The stat the line is on, e.g. `passingYards`. Stat string `json:"stat,omitempty"` // Human-readable name for `stat`. StatDisplayName string `json:"stat_display_name,omitempty"`}StatDetail: The stat line a prop market is derived from.
Ticker
Section titled “Ticker”type Ticker struct { MarketID string `json:"market_id"` MarketSymbol string `json:"market_symbol"` EventID string `json:"event_id"` EventSymbol string `json:"event_symbol"` Sport string `json:"sport"` Competition string `json:"competition"` LastTradedPrice Decimal `json:"last_traded_price"` LastTradedQuantity Decimal `json:"last_traded_quantity"` BestBid Decimal `json:"best_bid"` BestBidQuantity Decimal `json:"best_bid_quantity"` BestOffer Decimal `json:"best_offer"` BestOfferQuantity Decimal `json:"best_offer_quantity"` BidDepth int `json:"bid_depth"` OfferDepth int `json:"offer_depth"` OpenInterest Decimal `json:"open_interest"` TotalVolume Decimal `json:"total_volume"` Timestamp string `json:"timestamp"` TimestampUS int64 `json:"timestamp_us"`}Ticker is a “ticker” message: one market’s price summary. Any field can be empty on a market that has not traded or has an empty side.
Transaction
Section titled “Transaction”type Transaction struct { // The account the record belongs to. AccountID string `json:"account_id,omitempty"` // The monetary value the entry was calculated from. In dollars. Money as a // decimal string, exactly as sent by the API. Amount Decimal `json:"amount,omitempty"` // The event the market belongs to. EventID string `json:"event_id,omitempty"` // The fee that generated this entry, when it came from one. FeeID string `json:"fee_id,omitempty"` // Unique identifier for the record. ID string `json:"id,omitempty"` // Creation time, as UNIX microseconds. InsertedAt int64 `json:"inserted_at,omitempty"` // The market this record relates to. MarketID string `json:"market_id,omitempty"` // The payment that generated this entry, when it came from one. PaymentID string `json:"payment_id,omitempty"` // Points added by this entry. Negative when points were spent. Points float64 `json:"points,omitempty"` // For referral entries, the account that was referred. RefereeAccountID string `json:"referee_account_id,omitempty"` // For referral entries, the account that referred. ReferrerAccountID string `json:"referrer_account_id,omitempty"` // The settlement that generated this entry, when it came from one. SettlementID string `json:"settlement_id,omitempty"` // When the entry was recorded. Time time.Time `json:"time,omitzero"` // What moved the money or the points, for example a deposit, a trade fee, a // referral, or a manual adjustment. Each endpoint returns only its own subset // of these. One of: "deposit", "withdrawal", "settlement", "fee", // "fee_refund", "maker_rebate", "casino", "adjustment", "loyalty", // "loyalty_points_rollup", "loyalty_points_referral". Type string `json:"type,omitempty"`}Transaction: One ledger entry on the account.
UserInfo
Section titled “UserInfo”type UserInfo struct { UserID string `json:"userId"` UserUID string `json:"userUid"` UserStatus string `json:"userStatus"` FirstName string `json:"firstName"` LastName string `json:"lastName"` MiddleName string `json:"middleName"` PreferredName string `json:"preferredName"` CountryCode string `json:"countryCode"` PhoneNumber string `json:"phoneNumber"` BusinessCountryCode string `json:"businessCountryCode"` BusinessPhone string `json:"businessPhone"` DateOfBirth string `json:"dateOfBirth"` Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` State string `json:"state"` ZipCode string `json:"zipCode"` Country string `json:"country"` CitizenshipCountry string `json:"citizenshipCountry"` JobTitle string `json:"jobTitle"` Industry string `json:"industry"` EmployerName string `json:"employerName"` EmployerAddress string `json:"employerAddress"` PasswordChanged bool `json:"password_changed"` Logout bool `json:"logout"` TestAccount bool `json:"test_account"` OptInMarketing bool `json:"optInMarketing"` AllowMultipleLogins bool `json:"allowMultipleLogins"` WhitelistIPAddresses string `json:"whitelistIpAddresses"` ReferralCode string `json:"referralCode"`}UserInfo is “user_updated”: your profile and account state.

