Files
vyndr/src/services/nbaStatsClient.js
T
builtbykev c8c0962e56 feat: Feature 1.3 — Prop Analysis Engine with 6-step grading pipeline
Core intelligence for BetonBLK prop analysis:
- POST /api/analyze/prop — single prop analysis
- POST /api/analyze/batch — multi-prop analysis for parlay scanner
- 6-step pipeline: season avg → recent form → situational splits →
  cross-book lines → kill conditions → grade (A/B/C/D)
- 6 kill conditions: low_minutes, small_sample, b2b_high_usage,
  blowout_risk, split_conflict, no_opponent_data
- Composite scoring with confidence (30-95), bonuses, penalties
- Added spreads market to Odds API fetch (zero extra credits)
- Full reasoning output with step-by-step breakdown

36 new tests (unit + integration), 128 total across all features

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 11:41:18 -04:00

49 lines
1.2 KiB
JavaScript

const axios = require('axios');
const NBA_SERVICE_URL = process.env.NBA_SERVICE_URL || 'http://localhost:8000';
const TIMEOUT = 10000;
async function getSeasonAvg(player, statType, season) {
const params = { player };
if (statType) params.stat_type = statType;
if (season) params.season = season;
const { data } = await axios.get(`${NBA_SERVICE_URL}/stats/season-avg`, {
params,
timeout: TIMEOUT,
});
return data;
}
async function getLastN(player, n = 10, statType) {
const params = { player, n };
if (statType) params.stat_type = statType;
const { data } = await axios.get(`${NBA_SERVICE_URL}/stats/last-n`, {
params,
timeout: TIMEOUT,
});
return data;
}
async function getSplits(player, statType, splitType, opponent) {
const params = { player, stat_type: statType, split_type: splitType };
if (opponent) params.opponent = opponent;
const { data } = await axios.get(`${NBA_SERVICE_URL}/stats/splits`, {
params,
timeout: TIMEOUT,
});
return data;
}
async function searchPlayer(name) {
const { data } = await axios.get(`${NBA_SERVICE_URL}/players/search`, {
params: { name },
timeout: TIMEOUT,
});
return data;
}
module.exports = { getSeasonAvg, getLastN, getSplits, searchPlayer };