npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pandascore/odds-sdk

v0.0.11

Published

SDK to use Pandascore Betting Feed

Downloads

14

Readme

PandaSDK

PandaSDK is made to interact with Pandascore Sportsbook. You can use various methods related to matches, markets, events, and more. You will be able to connect to our trading feed easily, get odds change, and use our Matches API.

Features

  • RabbitMQ feed integration - connect to the PandaScore AMQPS feed and receive structured JSON events.

  • Automatic reconnection & recovery — built-in heartbeat monitoring and recovery calls to fetch anything missed during disconnections.

  • Typed DTOs — first-class TypeScript types for feed payloads and HTTP responses.

  • HTTP clients — a MatchesClient with convenient methods for markets/matches recovery by timestamp/range.

  • Extensive logging — file + console logging with contextual metadata.

Table of Contents

Installation

You can install the SDK via npm:

npm install @pandascore/odds-sdk

Or via yarn:

yarn add @pandascore/odds-sdk

Configuration

Before using the SDK, you need to configure it with your credentials:

import { PandaSDK } from '@pandascore/odds-sdk';

const MySDK = PandaSDK.initialize({
  apiToken: 'your-api-token',
  company_id: 123,                   // your PandaScore company ID
  email: '[email protected]',
  password: 'secret',
  queues: [
    { queueName: 'my-queue', routingKey: '#' }, // add more bindings as needed
  ],
  oddsFormat: ['american', 'fractional'], // optional; decimal odds are sent by default
  logging: {
    directory: './PandaScore_logs',  // optional; file logs are written here
  },
  realTimeBetLogConfig: {           // optional config
    vhost: 'vhost-123',
    email: '[email protected]',
    password: 'secret',
    hostname: 'feed.example.com',
  },
});

Usage

Getting Pandascore feed

To get all our messages, you can use:

MySDK.getRMQFeed((msg) => {
  console.log('Received message from RabbitMQ:', msg);
});

Publishing RTBL Bet

(Optional if you are subscribed to the package) To publish an RTBL bet:

async function main() {
  try {
    await MySDK.connectToRabbitMQ();
    await MySDK.createChannel();

    const betData: BetData = {
      event_type: 'bet_placed',
      bet: {
        id: 'id-of-the-bet',
        type: 'single',
        user_id: 'user-if',
        cash_amount: 100,
        currency: 'USD',
        placed_at: new Date().toISOString(),
        selections: [
          {
            provider: 'PandaScore',
            provider_market_id: 'market-id',
            provider_selection_position: 1,
            decimal_odds: 1.5,
          },
        ],
      },
    };

    MySDK.publishBet(
      betData,
      (error) => console.error('Error:', error.message),
      (data) => console.log('Success:', data),
    );
  } catch (error) {
    console.error('Error in main function:', error);
  }
}

main();

Getting a match detail

You can use fetchMatch to get detail for a single match.

const matchData = MySDK.fetchMatch('979621');

matchData
  .then((data) => {
    console.log('Results for a single match: ');
    console.log(JSON.stringify(data));
  })
  .catch((error) => {
    console.error(error);
  });

Getting markets for a match

You can use fetchMarkets to get all markets of a match.

const marketsData = MySDK.fetchMarkets('979621');

marketsData
  .then((data) => {
    console.log('Results for markets of a match: ');
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });

Getting markets changed during a time range

You can use fetchMatchesRange to get all markets updated during a specified time range.

const oneHourAgoISO = new Date(new Date().getTime() - 60 * 60 * 1000).toISOString();
const dateNow = new Date().toISOString();

const marketsRange = MySDK.fetchMatchesRange(oneHourAgoISO, dateNow);

marketsRange
  .then((data) => {
    console.log('Results for range of markets: ');
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });

Examples

You can find more example in the package source code.