# All files / src/types movements.types.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88

     /**
     * Line Movement Detection and Analytics Types
     */

    export type MovementType = 'steam' | 'reverse' | 'gradual' | 'injury' | 'normal';
    export type MarketType = 'h2h' | 'spreads' | 'totals';

    export interface LineMovement {
      id: string;
      gameId: string;
      marketType: MarketType;
      detectedAt: string; // ISO datetime
      movementType: MovementType;
      linesBefore: Record<string, any>;
      linesAfter: Record<string, any>;
      bookmakerCount: number;
      averageMovement: number | string; // Can be string from API (Prisma Decimal)
      timeToMove: number; // seconds
      maxMovement?: number | string;
      suspectedCause?: string | null;
      game?: {
        id: string;
        homeTeamName: string;
        awayTeamName: string;
        commenceTime: string;
        status: string;
        sportKey?: string;
        sportName?: string;
      };
    }

    export interface MovementStats {
      byType: {
        steam: number;
        reverse: number;
        gradual: number;
        injury: number;
        normal: number;
      };
      byMarket: {
        h2h: number;
        spreads: number;
        totals: number;
      };
    }

    export interface MovementResponse {
      status: 'success' | 'error';
      data: {
        movements: LineMovement[];
        total: number;
        hoursBack?: number;
        movementType?: string;
        statistics?: MovementStats;
        steamMovesCount?: number;
        totalMovements?: number;
        period?: string;
        byDate?: Record<string, LineMovement[]>;
        game?: {
          id: string;
          matchup: string;
          sport: string;
          commenceTime: string;
        };
        impactStats?: {
          totalMovements: number;
          steamMoves: number;
          avgMovementSize: string;
        };
        recentMovements?: LineMovement[];
        bookmaker?: string;
      } | null;
      error?: string;
    }

    export interface MovementFilters {
      movementType?: MovementType | 'all';
      hoursBack?: number;
      marketType?: MarketType;
      limit?: number;
    }

    export interface SteamMoveAlert {
      movement: LineMovement;
      severity: 'high' | 'medium' | 'low';
      icon: string;
    }