Metadata & Context
Access DVP rankings, park factors, injuries, and market trends
Metadata & Context
Get rich contextual data to inform betting decisions including DVP rankings, park factors, injury reports, and market trends.
Endpoints
GET /marketSelections/{id}/metadata
/marketSelections/{id}/metadataAccess comprehensive metadata for a market selection including DVP rankings, park factors, and historical performance context.
GET /injuries
Retrieve player injury data with filtering and pagination.
GET /trends
Access recent market trends from the last 48 hours.
DVP Rankings
Defense vs Position (DVP) rankings show how well teams defend against specific positions. Available for NFL, NBA, and NHL.
Basic Usage
import requests
base_url = "https://api.sharpsports.io/v1"
headers = {"Authorization": "Token sk_test_your_key_here"}
# Get metadata with DVP
response = requests.get(
f"{base_url}/marketSelections/MRKT_def456abc789/metadata",
headers=headers
)
metadata = response.json()
# Access DVP data
if 'dvp' in metadata:
dvp = metadata['dvp']
print(f"DVP Rank: {dvp['rank']}/{dvp['total']}")
print(f"Fantasy Points Allowed: {dvp['fantasyPointsAllowed']:.1f}")DVP Structure
{
"dvp": {
"rank": 5,
"total": 30,
"fantasyPointsAllowed": 42.3,
"position": "WR",
"opponent": {
"id": "TEAM_abc123",
"abbr": "KC",
"fullName": "Kansas City Chiefs"
}
}
}Interpreting DVP
- Rank 1 = Easiest matchup (allows most fantasy points)
- Rank 30 = Hardest matchup (allows fewest fantasy points)
- Lower ranks = weaker defense = better for offensive props
- Higher ranks = stronger defense = tougher for offensive props
Example Analysis
def analyze_matchup(market_selection_id):
"""Analyze matchup difficulty using DVP"""
metadata = requests.get(
f"{base_url}/marketSelections/{market_selection_id}/metadata",
headers=headers
).json()
if 'dvp' in metadata:
dvp = metadata['dvp']
rank = dvp['rank']
total = dvp['total']
print(f"\nMatchup Analysis:")
print(f"Opponent: {dvp['opponent']['fullName']}")
print(f"DVP Rank: {rank}/{total}")
# Categorize matchup
if rank <= total * 0.25: # Top 25%
print("β
EXCELLENT matchup (weak defense)")
elif rank <= total * 0.50: # Top 50%
print("π GOOD matchup (below average defense)")
elif rank <= total * 0.75: # Top 75%
print("β οΈ TOUGH matchup (above average defense)")
else:
print("β VERY TOUGH matchup (strong defense)")
print(f"Avg Fantasy Points Allowed: {dvp['fantasyPointsAllowed']:.1f}")
analyze_matchup("MRKT_def456abc789012345678901234567")Park Factors
MLB park factors indicate how park conditions affect scoring. Values above 1.0 favor hitters, below 1.0 favor pitchers.
Basic Usage
# Get park factor for MLB market
response = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/metadata",
headers=headers
).json()
if 'parkFactor' in response:
pf = response['parkFactor']
print(f"Park Factor: {pf:.2f}")
if pf > 1.05:
print("βΎ Hitter-friendly park")
elif pf < 0.95:
print("βΎ Pitcher-friendly park")
else:
print("βΎ Neutral park")Park Factor Structure
{
"parkFactor": 1.12,
"venue": {
"id": "VENU_abc123",
"name": "Coors Field",
"city": "Denver"
}
}Example: Adjusting Expectations
def adjust_for_park(market_selection_id, player_avg):
"""Adjust player average based on park factor"""
metadata = requests.get(
f"{base_url}/marketSelections/{market_selection_id}/metadata",
headers=headers
).json()
park_factor = metadata.get('parkFactor', 1.0)
# Adjust player average
adjusted_avg = player_avg * park_factor
print(f"\nPark-Adjusted Analysis:")
print(f"Player Average: {player_avg:.1f}")
print(f"Park Factor: {park_factor:.2f}")
print(f"Adjusted Average: {adjusted_avg:.1f}")
print(f"Adjustment: {adjusted_avg - player_avg:+.1f}")
return adjusted_avg
# Example: Player averages 2.5 hits per game
adjust_for_park("MRKT_def456abc789", player_avg=2.5)Injury Data
Access comprehensive injury reports with player status and game participation data.
Basic Usage
# Get all injuries for a league
response = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"limit": 50}
)
injuries = response.json()
for injury in injuries:
player = injury['player']['fullName']
status = injury['status']
description = injury.get('description', 'N/A')
print(f"{player}: {status} - {description}")Filter by Player
# Get injuries for specific player
response = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"player": "PLYR_abc123def456"}
).json()Filter by Team
# Get injuries for team
response = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"team": "TEAM_lakers"}
).json()Filter by Event
# Get injuries for an event
response = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"event": "EVNT_xyz789abc012"}
).json()Injury Status Values
OUT- Player will not playDOUBTFUL- Player unlikely to playQUESTIONABLE- Player's status uncertainPROBABLE- Player likely to playDAY_TO_DAY- Status being monitored daily
Example: Check Team Health
def check_team_health(team_id):
"""Check injury status for a team"""
injuries = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"team": team_id}
).json()
print(f"\nInjury Report:")
print("-" * 60)
status_counts = {}
for injury in injuries:
player = injury['player']['fullName']
status = injury['status']
played = injury.get('played', False)
status_counts[status] = status_counts.get(status, 0) + 1
status_icon = "π΄" if status == "OUT" else "π‘" if status in ["DOUBTFUL", "QUESTIONABLE"] else "π’"
played_text = "(played)" if played else ""
print(f"{status_icon} {player:25} {status:15} {played_text}")
print(f"\nSummary:")
for status, count in status_counts.items():
print(f" {status}: {count}")
check_team_health("TEAM_lakers")Market Trends
Access trending markets from the last 48 hours - markets showing interesting movements or patterns.
Basic Usage
# Get recent trends
response = requests.get(
f"{base_url}/trends",
headers=headers,
params={"limit": 20}
)
trends = response.json()
for trend in trends:
print(f"{trend['player']['fullName']}: {trend['proposition']}")
print(f" Event: {trend['event']['name']}")
print(f" Updated: {trend['timeUpdated']}")Filter by League
# Get NBA trends only
response = requests.get(
f"{base_url}/trends",
headers=headers,
params={"league": "nba"}
).json()Filter by Sport
# Get all basketball trends
response = requests.get(
f"{base_url}/trends",
headers=headers,
params={"sport": "basketball"}
).json()Example: Monitor Hot Markets
def monitor_trends():
"""Monitor trending markets"""
trends = requests.get(
f"{base_url}/trends",
headers=headers,
params={"limit": 10}
).json()
print("\nπ₯ Trending Markets (Last 48h):")
print("-" * 60)
for i, trend in enumerate(trends, 1):
player = trend.get('player', {}).get('fullName', 'N/A')
team = trend.get('team', {}).get('abbr', 'N/A')
prop = trend['proposition']
event = trend['event']['name']
print(f"{i}. {player} ({team}) - {prop}")
print(f" {event}")
monitor_trends()Complete Metadata Analysis
Combine all metadata sources for comprehensive market analysis:
def complete_market_analysis(market_selection_id):
"""Comprehensive market analysis with all metadata"""
print("\n" + "="*70)
print("COMPLETE MARKET ANALYSIS")
print("="*70)
# Get metadata
metadata = requests.get(
f"{base_url}/marketSelections/{market_selection_id}/metadata",
headers=headers,
params={
"playerAggStats": "true",
"teamAggStats": "true"
}
).json()
# Basic info
player = metadata.get('player', {})
event = metadata.get('event', {})
print(f"\nπ Market Info:")
print(f" Player: {player.get('fullName', 'N/A')}")
print(f" Prop: {metadata['proposition']}")
print(f" Event: {event.get('name', 'N/A')}")
# Player aggregate stats
if 'playerAggregateStats' in metadata:
player_stats = metadata['playerAggregateStats']
print(f"\nπ Season Stats:")
print(f" Average: {player_stats.get('average', 0):.1f}")
print(f" Games: {player_stats.get('games', 0)}")
# DVP analysis
if 'dvp' in metadata:
dvp = metadata['dvp']
print(f"\nπ― Matchup (DVP):")
print(f" Opponent: {dvp['opponent']['fullName']}")
print(f" Rank: {dvp['rank']}/{dvp['total']}")
print(f" Avg Allowed: {dvp.get('fantasyPointsAllowed', 0):.1f}")
# Matchup rating
pct = dvp['rank'] / dvp['total']
if pct <= 0.33:
print(f" Rating: β
FAVORABLE")
elif pct >= 0.67:
print(f" Rating: β DIFFICULT")
else:
print(f" Rating: β οΈ NEUTRAL")
# Park factor (MLB)
if 'parkFactor' in metadata:
pf = metadata['parkFactor']
print(f"\nβΎ Park Factor:")
print(f" Factor: {pf:.2f}")
print(f" Type: {'Hitter-friendly' if pf > 1.05 else 'Pitcher-friendly' if pf < 0.95 else 'Neutral'}")
# Check for injuries
if player:
injuries = requests.get(
f"{base_url}/injuries",
headers=headers,
params={"player": player['id']}
).json()
if injuries:
print(f"\nπ₯ Injury Status:")
for injury in injuries:
print(f" Status: {injury['status']}")
if 'description' in injury:
print(f" Details: {injury['description']}")
print("\n" + "="*70)
complete_market_analysis("MRKT_def456abc789012345678901234567")Query Parameters Reference
/marketSelections/{id}/metadata
/marketSelections/{id}/metadata| Parameter | Type | Description |
|---|---|---|
teamAggStats | boolean | Include team aggregate statistics |
filteredTeamAggStats | boolean | Include filtered team aggregate stats |
playerAggStats | boolean | Include player aggregate statistics |
filteredPlayerAggStats | boolean | Include filtered player aggregate stats |
teamAggStatsSeason | string | Comma-separated years for team stats |
playerAggStatsSeason | string | Comma-separated years for player stats |
/injuries
| Parameter | Type | Description |
|---|---|---|
player | string | Filter by player ID or name (comma-separated) |
team | string | Filter by team ID or name (comma-separated) |
event | string | Filter by event ID (comma-separated) |
status | string | Filter by injury status |
played | boolean | Filter by whether player played (true/false) |
limit | number | Limit results |
pageNum | number | Page number for pagination |
pageSize | number | Results per page |
/trends
| Parameter | Type | Description |
|---|---|---|
league | string | Filter by league ID or abbreviation |
sport | string | Filter by sport ID or name |
limit | number | Limit results |
pageNum | number | Page number for pagination |
pageSize | number | Results per page |
Need Help?
- π§ Support: [email protected]
- π API Reference: /reference
- π¬ Discord: Join our developer community
Updated 17 days ago