Retrieve data about ownership percentage of a player.
const YahooFantasy = require('yahoo-fantasy');
const yf = new YahooFantasy(
Y!APPLICATION_KEY,
Y!APPLICATION_SECRET,
tokenCallbackFn, // optional
redirectUri // optional
);
yf.setUserToken(
Y!OAuthAccessToken
);
// promise based
try {
const percent_owned = await yf.player.percent_owned(player_key);
} catch (e) {
// handle error
}
// callback based
yf.player.percent_owned(player_key, callbackFn);
{
"player_key": "328.p.6619",
"player_id": "6619",
"name": {
"full": "Albert Pujols",
"first": "Albert",
"last": "Pujols",
"ascii_first": "Albert",
"ascii_last": "Pujols"
},
"editorial_player_key": "mlb.p.6619",
"editorial_team_key": "mlb.t.3",
"editorial_team_full_name": "Los Angeles Angels",
"editorial_team_abbr": "LAA",
"uniform_number": "5",
"display_position": "1B",
"headshot": "http://l.yimg.com/iu/api/res/1.2/iium.CfIaaN.XDy7fB4Reg--/YXBwaWQ9eXZpZGVvO…g--/http://l.yimg.com/j/assets/i/us/sp/v/mlb/players_l/20130405/6619.1.jpg",
"is_undroppable": "0",
"position_type": "B",
"eligible_positions": [
"1B",
"CI",
"DH",
"IF"
],
"ownership": {
"value": 98
}
}