Appendix

Odd Format

We’re using following convention for odds format:

Rate Pivot type Description Odd format
Over HDP Home team Hong Kong
Over TOTAL Over Hong Kong
Over ONE_TWO Home win Decimal
Under HDP Away team Hong Kong
Under TOTAL Under Hong Kong
Under ONE_TWO Guest win Decimal
Equal ONE_TWO Draw Decimal

Action status and message

We have following table for all the possible actionStatus and actionMessage:

Code Message
0 request processed successfully
1 request failed for an uncategorized reason
2 user not authorized
3 data in request is incomplete/invalid
4 requested record not found in feed snapshot
5 no available account to process the request
6 market suspended/closed for the requested event
7 request failed because the account is suspended
8 bet ticket request failed since the ticket is not found on sportbook
9 bet ticket request failed due to network errors
10 bet request failed since the price at sportbook is lower than the request
11 bet request failed since the pivot at sportbook is changed
12 bet request failed since the target type at sportbook is changed
13 bet request failed due to lack of sufficient credit
14 bet request failed due to lack of sufficient balance in accounts
15 bet request failed due to network errors
16 bet placed succesfully but the corresponding id is unknown
17 bet placed succesfully but not saved into database
18 bet status check failed since the id is not found in database
19 bet status check failed due to network errors
20 request failed due to an internal exception
21 failed to place the bet since the sportbook rejected the request
22 odd requested is lower than the current odd in feed snapshot
23 request failed due to unity system services
24 request failed due to unity system services
25 request failed since the user is not active
26 request failed since the account is not active
27 request failed since the account is not active
28 request failed since the user is not reserved
29 request failed since the user is not active
31 request failed since the user is not active
32 bet placed successfully but stake only partially matched
33 bet placed successfully but stake unmatched
34 bettable credit check failed due to network errors
35 not found bet result
36 bet result in process
37 scoreline has been changed
38 get bets failed due to an internal exception
39 bet not found
40 user not found
41 bet placed successfully but the bet since the sportbook rejected the bet
42 time range is out of bound

API authentication

As we provide our API to authorized users only, you will need to provide your credentials for all API calls. To do this, there are 2 required parameters to be attached in each API call:

  • username: The username assigned to you. Example: unity_groupXX, unity_groupYY…
  • accessToken: A hash string, generated from username, password and current time. Please follow this procedure to get your access token:
    • Get the current date and time of the system. Convert it into GMT+0.
    • Concatenate the username, password, and the date and time in the following format: username_dd/MM/yyyy_password_HH/mm
      • username: is the above mentioned username
      • dd/MM/yyyy: the current universal date. Example: 10/09/2012
      • password: the password given to you separately
      • HH/mm: the current universal time. Example: 11/59
    • Make a MD5 hash of the above string. The output value is the required access token.

Following is the Java code to generate this access token:


    public static String getAccessToken(String username, String password) {
        StringBuilder builder;
        DateFormat dateFormat;
        Date time = new Date();
        
        // combine the input fields
        builder = new StringBuilder();
        builder.append(username).append('_');

        dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT-0:00"));
        String date1 = dateFormat.format(time);
        builder.append(date1).append('_');

        builder.append(password).append('_');

        dateFormat = new SimpleDateFormat("HH/mm");
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT-0:00"));
        String date2 = dateFormat.format(time);
        builder.append(date2);

        try {
            byte[] bytesOfMessage = builder.toString().getBytes("utf-8");
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] theDigest = md.digest(bytesOfMessage);

            String result = new String(Hex.encodeHex(theDigest));
            return result;
        } catch (Exception e) {
            return null;
        }
    }

Bet status

We use following status code for the bets:

Code Status Description
0 PENDING The bet is placed successfully, but it might be rejected later by the sportsbook.
1 ACCEPTED The bet is placed successfully
2 REJECTED The bet is not successfully placed (e.g., odd has been changed)
3 ACCEPTED_UNKNOWN_ID In some rare cases, the id of the bet on the sportsbook is unknown. In this case we will try to recollect the bet id at a later time.
4 WIN The bet is resolved to WIN.
5 LOSS The bet is resolved to LOSS.
6 CANCELLED The bet is resolved to CANCELLED.
7 DRAW The bet is resolved to DRAW.
8 REJECTED_ABNORMAL The bet is resolved to REJECTED.
9 EXCHANGE_DELETED The current status of the unmatched bet is deleted in the exchange.
10 EXCHANGE_MATCH_AWAIT The current status of the partially matched/unmatched bet is waiting to match in the exchange.

Tracking and report issues

Even though this section is optional, we highly recommend you to enable this tracking so it’s easier to debug any issues happen while you’re calling to our service. To enable this, for each API call, you just need to provide an extra parameter reqId. There is no requirement for this parameter, you can use any convention that suit you the best. However, please make sure that this reqId is unique for all your calls. Following is a sample Java code to generate this value:


    public static String generateReqId() {
        return UUID.randomUUID().toString();
    }

To report any problem, you can give us the reqId of the corresponding calls. It’ll be much faster for us to track down the issues from our logs.

Bet Validation

Before placing a bet, the system validates the input, PlaceBetForm, with bet slip from the sportbook, so it has to satisfy certain conditions:

  1. Pivot has no change
  2. Bias has no change
  3. Score or RedCard has no change (applicable ONLY to LIVE SOCCER)
    • If there is an homeScore / awayScore input and the sportbook provide scores on bet slip , it must be same as ones on bet slip.
    • If there is no homeScore / awayScore input and the sportbook provide scores on bet slip, it compares the current system scores with bet slip scores.
    • If there is an homeScore / awayScore input and the sportbook does not provide scores in the bet slip, the system expects the input same as current system scores.
    • If there is no homeScore / awayScore input and the sportbook does not provide scores in the bet slip, it considers pivot and bias has to be no change.
  4. Target Type has no change
  5. Target Odds
    • If turning acceptBetterOdd OFF, it must no change.
    • If turning acceptBetterOdd ON, current odds must be equal or greater than target odds.