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

Access 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 play
  • DOUBTFUL - Player unlikely to play
  • QUESTIONABLE - Player's status uncertain
  • PROBABLE - Player likely to play
  • DAY_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

ParameterTypeDescription
teamAggStatsbooleanInclude team aggregate statistics
filteredTeamAggStatsbooleanInclude filtered team aggregate stats
playerAggStatsbooleanInclude player aggregate statistics
filteredPlayerAggStatsbooleanInclude filtered player aggregate stats
teamAggStatsSeasonstringComma-separated years for team stats
playerAggStatsSeasonstringComma-separated years for player stats

/injuries

ParameterTypeDescription
playerstringFilter by player ID or name (comma-separated)
teamstringFilter by team ID or name (comma-separated)
eventstringFilter by event ID (comma-separated)
statusstringFilter by injury status
playedbooleanFilter by whether player played (true/false)
limitnumberLimit results
pageNumnumberPage number for pagination
pageSizenumberResults per page

/trends

ParameterTypeDescription
leaguestringFilter by league ID or abbreviation
sportstringFilter by sport ID or name
limitnumberLimit results
pageNumnumberPage number for pagination
pageSizenumberResults per page

Need Help?