Liability Management

Each feed can have liability management enabled or disabled. If it's enabled, clients should notify Xenophobe whenever a bet is matched by sending an add_bet message:

  {
    "request": "add_bet",
    "msg": {
      "selection_id": "sample-sel-id-0",
      "market_id": "sample-mkt-id-0",
      "bet_id": 123456,
      "stake": "1.12",
      "price": "4/1",
      "ew_terms": {
        "fraction": "1/4",
        "places": 4
      },
      "currency": "GBP",
      "timestamp": "2014-01-01 23:00:00.000000",
      "side": "back",
    }
  }

The server will respond to an add_bet request with a response like:

    {
      "mode": "resp",
      "status": "success",
      "msg": {
        "bet_id": 123456,
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

or:

    {
      "mode": "resp",
      "status": "error",
      "msg": {
        "bet_id": 123456,
        "error_text": "invalid market id",
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

The add_bet request may have the following properties:

selection_id The selection to which the bet should be applied.

market_id The market to which the bet should be applied.

bet_id An integer that uniquely identifies this bet. This is the client's choice, but it must not be reused for any other bet.

stake A string representing the stake taken. e.g. "20.13"

price A string representing the price at which the bet was taken. This must be decimal if we are sending decimal prices to you, or fractional otherwise. e.g. "2.30" or "8/1"

ew_terms If this is an each way bet, the terms at which it was taken. This is an object following the same format as described above in the :ref:Market Status Update <market-status-update> section.

currency A string representing the currency in which the bet was taken. At the moment, only GBP is supported.

timestamp An RFC 3339 string representation of the time at which the bet was taken. e.g. "2014-01-01 23:00:00.000000"

side The side of the bet that the client has accepted. This can be either "back" or "lay".

Clients should also notify Xenophobe whenever all or part of a bet is voided by sending a void_bet message::

 {
    "request": "void_bet",
    "msg": {
      "bet_id": 123456,
      "stake": "1.12",
      "timestamp": "2014-01-01 23:00:00.000000",
    }
  }

In the case of EW (each-way) bets, an equal portion of the stake will be voided from the main selection and the place selection.

The server will respond to an void_bet request with a response like:

    {
      "mode": "resp",
      "status": "success",
      "msg": {
        "bet_id": 123456,
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

Feed Specification

Or:

    {
      "mode": "resp",
      "status": "error",
      "msg": {
        "bet_id": 123456,
        "error_text": "void_bet must have a non zero positive value for stake. Stake value given: '-10.0'",
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

Clients can also retrieve data about a bet_id by sending a get_bet message and providing the bet_id of interest:

  {
    "request": "get_bet",
    "msg": {
      "bet_id": 123456,
    }
  }

The server will respond to a get_bet request with a response like:

    {
      "mode": "resp",
      "status": "success",
      "msg": {
        "bets": [
          {
            "selection_id": "sample-sel-id-0",
            "market_id": "sample-mkt-id-0",
            "bet_id": 123456,
            "stake": "1.12",
            "price": "4/1",
            "ew_terms": {
              "fraction": "1/4",
              "places": 4
            },
            "currency": "GBP",
            "timestamp": "2014-01-01 23:00:00.000000",
          }
        ],
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

or:

    {
      "mode": "resp",
      "status": "error",
      "msg": {
        "error_text":"no data for bet_id: 7",
      },
      "publish_time": "2014-01-01 22:22:22.123456",
    }

Last updated

Was this helpful?