bttmly / nba

Node.js client for nba.com API endpoints
MIT License
708 stars 173 forks source link

Team Stats - Advanced #61

Closed dtkavana closed 6 years ago

dtkavana commented 6 years ago

NBA.stats.teamStats({ TeamID: 1610612737 }).then(response => { this.atlantaStats = response; });

I have this call setup, but was wondering how you would drill down to a team's Advanced stats - such as Offensive Rating, Defensive Rating, etc. This call returns what appears to be the "Traditional" stats.

Thanks

bttmly commented 6 years ago

try this:

nba.stats.teamStats({ TeamID: 1610612737, MeasureType: "Advanced" }).then(console.log)
/* 
[ { teamId: 1610612737,
    teamName: 'Atlanta Hawks',
    gp: 7,
    w: 2,
    l: 5,
    wPct: 0.286,
    min: 336,
    eOffRating: 99.8,
    offRating: 100.1,
    eDefRating: 106.1,
    defRating: 107.2,
    eNetRating: -6.3,
    netRating: -7.1,
    astPct: 0.626,
    astTo: 1.32,
    astRatio: 17,
    orebPct: 0.211,
    drebPct: 0.715,
    rebPct: 0.464,
    tmTovPct: 0.172,
    efgPct: 0.516,
    tsPct: 0.546,
    ePace: 109.4,
    pace: 108.64,
    pie: 0.455,
    gpRank: 1,
    wRank: 1,
    lRank: 1,
    wPctRank: 1,
    minRank: 1,
    offRatingRank: 1,
    defRatingRank: 1,
    netRatingRank: 1,
    astPctRank: 1,
    astToRank: 1,
    astRatioRank: 1,
    orebPctRank: 1,
    drebPctRank: 1,
    rebPctRank: 1,
    tmTovPctRank: 1,
    efgPctRank: 1,
    tsPctRank: 1,
    paceRank: 1,
    pieRank: 1,
    cfid: 10,
    cfparams: 'Atlanta Hawks' } ]
*/

These endpoints are automatically generated by this JSON document – it has the names of available parameters for each method and their values https://github.com/bttmly/nba-client-template/blob/master/nba.json

FWIW playing around with this it seems like all the Rank fields that get returned are broken – see how they are all 1s

dtkavana commented 6 years ago

ahhh, measure type! Thank you