UNPKG

metafide-surge

Version:

Metafide Surge Game Computation

48 lines (47 loc) 2.98 kB
import { SpotGame, SpotPlayer, RangeGame, RangePlayer, PotDistribution, AllocationPercentages, SpotPlayerVarianceResult, RangePlayerVarianceResult, ComputedData } from './types'; /** * Calculates the pot distribution for a game based on players' contributions * and given allocation percentages. * * @param players - List of players participating in the game * @param allocations - Optional custom allocation percentages (defaults to predefined values) * @returns An object containing the breakdown of the total pot into different allocations */ declare function calculateRangePotDistribution(data: RangePlayer[], allocations?: AllocationPercentages): PotDistribution; /** * Computes the variance between players' predicted price ranges and the actual game price range. * * @param players - List of players participating in the game * @param game - The game data including actual price boundaries and timestamps * @returns An array of PlayerVarianceResult containing each player's variance data and total variance sum */ declare function computeRangePlayerVariance(players: RangePlayer[], game: RangeGame): RangePlayerVarianceResult[]; /** * Handles the full computation of player winnings based on their variance and the game's pot distribution. * * @param players - List of players participating in the game * @param games - The game data including actual price boundaries and timestamps * @param distribution - The Range Game Distribution * @returns An object containing detailed winnings per player, highest winnings, and largest returns */ declare function computeRangeWinnings(data: RangePlayer[], games: RangeGame, distribution: PotDistribution): ComputedData; declare function calculateSpotPotDistribution(data: SpotPlayer[], allocations?: AllocationPercentages): PotDistribution; /** * Computes the spot variance between players' predicted price ranges and the actual game price range. * * @param players - List of players participating in the game * @param game - The game data including actual price boundaries and timestamps * @returns An array of PlayerVarianceResult containing each player's variance data and total variance sum */ declare function computeSpotPlayerVariance(players: SpotPlayer[], game: SpotGame): SpotPlayerVarianceResult[]; /** * Computes the final spot game results for players, including * winnings, top winners, and highest returns based on their predictions. * * @param data - List of SpotPlayer entries participating in the game * @param game - SpotGame containing game closing data * @param distribution - The SpotGame distribution * @returns An object containing player winnings, highest winnings, and largest returns */ declare function computeSpotWinnings(data: SpotPlayer[], game: SpotGame, distribution: PotDistribution): ComputedData; export { computeRangeWinnings, computeSpotWinnings, computeRangePlayerVariance, computeSpotPlayerVariance, calculateSpotPotDistribution, calculateRangePotDistribution, };