# All files / src/services clv.service.ts

28.57% Statements 10/35
100% Branches 0/0
0% Functions 0/7
28.57% Lines 10/35

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

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x
     /**
     * CLV (Closing Line Value) API service
     */
    import apiClient from './api';
    import { CLVSummary, CLVBySport, CLVByBookmaker, CLVTrend, CLVReport, CLVFilters } from '../types/clv.types';

    export const clvService = {
      /**
       * Get overall CLV summary statistics
       */
      async getSummary(): Promise<CLVSummary> {
        const response = await apiClient.get('/analytics/clv/summary');
        return response.data.data;
      },

      /**
       * Get CLV breakdown by sport
       */
      async getBySport(): Promise<CLVBySport[]> {
        const response = await apiClient.get('/analytics/clv/by-sport');
        return response.data.data;
      },

      /**
       * Get CLV breakdown by bookmaker
       */
      async getByBookmaker(): Promise<CLVByBookmaker[]> {
        const response = await apiClient.get('/analytics/clv/by-bookmaker');
        return response.data.data;
      },

      /**
       * Get CLV trends over time with optional filters
       */
      async getTrends(filters?: CLVFilters): Promise<CLVTrend[]> {
        const response = await apiClient.get('/analytics/clv/trends', {
          params: filters
        });
        return response.data.data;
      },

      /**
       * Get comprehensive CLV report with all analytics
       */
      async getReport(filters?: CLVFilters): Promise<CLVReport> {
        const response = await apiClient.get('/analytics/clv/report', {
          params: filters
        });
        return response.data.data;
      },

      /**
       * Calculate CLV for a specific bet
       */
      async calculateForBet(betId: string): Promise<{ clv: number; category: string }> {
        const response = await apiClient.post(`/analytics/clv/calculate/${betId}`);
        return response.data.data;
      },

      /**
       * Update aggregated CLV statistics
       */
      async updateStats(): Promise<{ message: string }> {
        const response = await apiClient.post('/analytics/clv/update-stats');
        return response.data.data;
      }
    };