Skip to main content

Betting Data Structures

BetSnapshot

Source note (2026-07-20): the original Bifrost PDF defines PLACED as fully matched and labels the size/average-odds fields as applicable to exchange markets. It does not mark those fields unconditionally required. Because the proto fields are non-optional proto3 scalar doubles, zero may be absent from the wire. For Forsyt 9.x/14.x, PLACED plus validated size confirms the full match; the exchange Size Vector is corroborative only. Contradictory partial evidence is a financial-integrity failure. See ADR-0016.

Hannibal transport rule: protobuf int64 values on financial queues (betId, runnerId, and version) are normalized to canonical decimal strings, then parsed directly to BigInt where persistence or comparison requires it. They must never pass through a JavaScript number. Before binding betId or applying any lifecycle mutation, requestId must equal the persisted Order.requestUuid and memberCode must equal the persisted Order.userId. Any mismatch is non-retryable contradictory identity evidence and is quarantined through the financial DLQ.

FieldData TypeDescription
requestIdStringA request unique identifier. It could be generated on the customer side.
betIdLongUnique identifier for the placed bet. Generated on Public API level.
memberCodeStringCode identifying the member placing the bet.
statusStringBet status enum. One of: PENDING - the bet placement request has been sent, waiting for provider's response; FAILED - the bet placement has failed; PLACED - the bet was successfully placed (fully matched); VOIDED - the bet was voided by the provider/operator. PARTIALLY_MATCHED - part of the bet has been matched, the rest is waiting in the market. UNMATCHED - the bet is in the market but has not been matched yet. CANCEL_PENDING - The client requested to cancel the bet (or remaining part), but the provider has not yet confirmed the cancellation. CANCELLED - The bet (or its unmatched portion) was canceled by the user. LAPSED - the bet automatically expired because the market closed or conditions were no longer valid.
sideStringSide enum. One of: BACK - selection occurrence side selection; LAY - selection non-occurrence side selection.
marketIdStringIdentifier for the specific market within an event.
runnerIdLongIdentifier for the specific runner within a market.
sizedoubleBet size requested for placement in customer currency
sizeMatcheddoubleBet size matched at the time of bet request placement. Applicable for Exchange markets.
oddsdoubleAccepted bet odds
lineintThe bet line, can be empty
errorMessageStringMessage from a provider accompanying failed or voided bet; empty if a bet is placed.
errorCodeStringMessage from a provider accompanying failed or voided bet; empty if a bet is placed.
versionlongTimestamp when the bet was placed (UTC)
sizeMatcheddoubleThe portion of the bet that has been successfully matched with the opposing side in the market. Applicable for Exchange markets.
sizeRemainingdoubleThe remaining unmatched portion of the bet that is still active in the market. Applicable for Exchange markets.
sizeLapseddoubleThe portion of the bet that has lapsed (i.e. was not matched before the market closed or the event started) and was automatically removed. Applicable for Exchange markets.
sizeCancelleddoubleThe portion of the bet that was cancelled by the user or system before being matched. Applicable for Exchange markets.
sizeVoideddoubleThe portion of the bet that was voided (e.g. due to event cancellation or market rule changes). Applicable for Exchange markets.
averageOddsdoubleThe weighted average odds at which the bet was matched. If the bet is partially matched at different odds, this value reflects the overall effective odds based on matched sizes. Applicable for Exchange markets.
voidReasonStringMessage from operator accompanying failed or voided bet

BetSnapshot Proto

message BetSnapshot {
string requestId = 1;
int64 betId = 2;
string marketId = 3;
int64 runnerId = 4;
double size = 5;
optional double odds = 6;
optional int32 line = 7;
string side = 8;
string memberCode = 9;
string status = 10;
optional string errorMessage = 11;
optional string errorCode = 12;
int64 version = 13;
double sizeMatched = 14;
double sizeRemaining = 15;
double sizeLapsed = 16;
double sizeCancelled = 17;
double sizeVoided = 18;
double averageOdds = 19;
optional string voidReason = 20;
}

BetOutcomeSnapshot

FieldData TypeDescription
betIdlongBet id
outcomestringBet outcome enum. One of: WON - the bet has won; LOST - the bet has lost; VOID - the bet was voided;
pnldoubleBet profit and lose outcome
versionLongTimestamp when the bet was settled (UTC).
sizeSettleddoubleProvider matched size in the case of a partial match

BetOutcome Proto

message BetOutcomeSnapshot {
string requestId = 1;
int64 betId = 2;
string outcome = 3;
double pnl = 4;
int64 version = 5;
double sizeSettled = 6;
}