General Calls
This page documents the BookiePro data abstraction layer with the Peerplays blockchain.
BookiePro communicates with the blockchain using web-socket API calls.

list_sports

Get a list of available sports.
1
Apis.instance().db_api().exec( "list_sports", [] )
Copied!
Return
Code
A list of all the available sports.
1
ChainStore.getSportsList = function getSportsList() {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().db_api().exec('list_sports', []).then(function (sportsList) {
4
if (sportsList) {
5
resolve(sportsList);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

list_event_groups

Get a list of all event groups for a sport, for example, all soccer leagues in soccer.
1
Apis.instance().db_api().exec( "list_event_groups", [sportId] )
Copied!
Parameters
Return
Code
sportId: The id of the sport that the event groups are to be listed for.
A list of all event groups for the selected sport.
1
ChainStore.prototype.getEventGroupsList = function getEventGroupsList(sportId) {
2
var _this17 = this;
3
4
var eventGroupsList = this.event_groups_list_by_sport_id.get(sportId);
5
6
if (eventGroupsList === undefined) {
7
this.event_groups_list_by_sport_id = this.event_groups_list_by_sport_id.set(sportId, _immutable2.default.Set());
8
9
_ws.Apis.instance().db_api().exec('list_event_groups', [sportId]).then(function (eventGroups) {
10
var set = new Set();
11
12
for (var i = 0, len = eventGroups.length; i < len; ++i) {
13
set.add(eventGroups[i]);
14
}
15
16
_this17.event_groups_list_by_sport_id = _this17.event_groups_list_by_sport_id.set(sportId, _immutable2.default.Set(set));
17
_this17.notifySubscribers();
18
}, function () {
19
_this17.event_groups_list_by_sport_id = _this17.event_groups_list_by_sport_id.delete(sportId);
20
});
21
}
22
23
return this.event_groups_list_by_sport_id.get(sportId);
24
};
Copied!

list_betting_market_groups

Get a list of all betting market groups for an event, for example, Moneyline and OVER/UNDER for soccer)
1
Apis.instance().db_api().exec( "list_betting_market_groups", [eventId] )
Copied!
Parameters
Return
Code
eventId: The id of the event that the betting market groups are to be listed for.
A list of all the betting market groups for the event.
1
ChainStore.prototype.getBettingMarketGroupsList = function getBettingMarketGroupsList(eventId) {
2
var _this18 = this;
3
4
var bettingMarketGroupsList = this.betting_market_groups_list_by_sport_id.get(eventId);
5
6
if (bettingMarketGroupsList === undefined) {
7
this.betting_market_groups_list_by_sport_id = this.betting_market_groups_list_by_sport_id.set(eventId, _immutable2.default.Set());
8
9
_ws.Apis.instance().db_api().exec('list_betting_market_groups', [eventId]).then(function (bettingMarketGroups) {
10
var set = new Set();
11
12
for (var i = 0, len = bettingMarketGroups.length; i < len; ++i) {
13
set.add(bettingMarketGroups[i]);
14
}
15
16
_this18.betting_market_groups_list_by_sport_id = _this18.betting_market_groups_list_by_sport_id.set( // eslint-disable-line
17
eventId, _immutable2.default.Set(set));
18
_this18.notifySubscribers();
19
}, function () {
20
_this18.betting_market_groups_list_by_sport_id = _this18.betting_market_groups_list_by_sport_id.delete( // eslint-disable-line
21
eventId);
22
});
23
}
24
25
return this.betting_market_groups_list_by_sport_id.get(eventId);
26
};
Copied!

list_betting_markets

Get a list of all betting markets for a betting market group (BMG).
1
Apis.instance().db_api().exec( "list_betting_markets", [bettingMarketGroupId] )
Copied!
Parameters
Return
Code
bettingMarketGroupId: The id of the betting market group that the betting markets are to be listed for.
A list of all the betting markets for the betting market group.
1
ChainStore.prototype.getBettingMarketsList = function getBettingMarketsList(bettingMarketGroupId) {
2
var _this19 = this;
3
4
var bettingMarketsList = this.betting_markets_list_by_sport_id.get(bettingMarketGroupId);
5
6
if (bettingMarketsList === undefined) {
7
this.betting_markets_list_by_sport_id = this.betting_markets_list_by_sport_id.set(bettingMarketGroupId, _immutable2.default.Set());
8
9
_ws.Apis.instance().db_api().exec('list_betting_markets', [bettingMarketGroupId]).then(function (bettingMarkets) {
10
var set = new Set();
11
12
for (var i = 0, len = bettingMarkets.length; i < len; ++i) {
13
set.add(bettingMarkets[i]);
14
}
15
16
_this19.betting_markets_list_by_sport_id = _this19.betting_markets_list_by_sport_id.set(bettingMarketGroupId, _immutable2.default.Set(set));
17
_this19.notifySubscribers();
18
}, function () {
19
_this19.betting_markets_list_by_sport_id = _this19.betting_markets_list_by_sport_id.delete(bettingMarketGroupId);
20
});
21
}
22
23
return this.betting_markets_list_by_sport_id.get(bettingMarketGroupId);
24
};
Copied!

get_global_betting_statistics

Get global betting statistics
1
Apis.instance().db_api().exec( "get_global_betting_statistics", [] )
Copied!
Return
Code
A list of all the global betting statistics.
1
ChainStore.getGlobalBettingStatistics = function getGlobalBettingStatistics() {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().db_api().exec('get_global_betting_statistics', []).then(function (getGlobalBettingStatistics) {
4
if (getGlobalBettingStatistics) {
5
resolve(getGlobalBettingStatistics);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_binned_order_book

Get the binned order book for a betting market.
1
Apis.instance().bookie_api().exec( "get_binned_order_book", [ betting_market_id, precision ] )
Copied!
Parameters
Return
Code
  • betting_market_id: The id of the betting market for the order book.
  • precision: Precision
A list of binned orders for the betting market.
1
ChainStore.getBinnedOrderBook = function getBinnedOrderBook(betting_market_id, precision) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().bookie_api().exec('get_binned_order_book', [betting_market_id, precision]).then(function (order_book_object) {
4
if (order_book_object) {
5
resolve(order_book_object);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_total_matched_bet_amount_for_betting_market_group

Get the total matched bets for a betting market group (BMG).
1
Apis.instance().bookie_api().exec( "get_total_matched_bet_amount_for_betting_market_group", [ group_id ] )
Copied!
Parameters
Return
Code
  • group_id: The betting market group id.
Total of all the matched bet amounts for the selected betting market group.
1
ChainStore.getTotalMatchedBetAmountForBettingMarketGroup = function getTotalMatchedBetAmountForBettingMarketGroup(group_id) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().bookie_api().exec('get_total_matched_bet_amount_for_betting_market_group', [group_id]).then(function (total_matched_bet_amount) {
4
if (total_matched_bet_amount) {
5
resolve(total_matched_bet_amount);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_events_containing_sub_string

Used to search for events.
1
Apis.instance().bookie_api().exec( "get_events_containing_sub_string", [ sub_string, language ])
Copied!
Parameters
Return
Code
  • sub_string: The (sub) string of text to search for
  • language: Language id.
List of events that contain the sub-string
1
function getEventsContainingSubString(sub_string, language) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().bookie_api().exec('get_events_containing_sub_string', [sub_string, language]).then(
4
function (events_containing_sub_string) {
5
if (events_containing_sub_string) {
6
resolve(events_containing_sub_string);
7
} else {
8
resolve(null);
9
}
10
}, reject);
11
});
12
};
Copied!

get_unmatched_bets_for_bettor

Get unmatched bets for a bettor.
1
Apis.instance().bookie_api().exec( "get_matched_bets_for_bettor", [ bettor_id ] )
Copied!
Parameters
Return
Code
  • bettor_id: The id of the bettor.
List of all matched bets for a bettor.
1
ChainStore.getUnmatchedBetsForBettor = function getUnmatchedBetsForBettor(betting_market_id_type, account_id_type) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().db_api().exec('get_unmatched_bets_for_bettor', [betting_market_id_type, account_id_type]).then(function (unmatched_bets_for_bettor) {
4
if (unmatched_bets_for_bettor) {
5
resolve(unmatched_bets_for_bettor);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

list_events_in_group

Get a list of events in any event group.
1
Apis.instance().db_api().exec( "list_events_in_group", [ event_group_id ] )
Copied!
Parameters
Return
Code
  • event_group_id: The id of the event group.
A list of all the events in the event group.
1
ChainStore.listEventsInGroup = function listEventsInGroup(event_group_id) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().db_api().exec('list_events_in_group', [event_group_id]).then(function (events_in_group) {
4
if (events_in_group) {
5
resolve(events_in_group);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_all_unmatched_bets_for_bettor

Get all unmatched bets of a bettor according to account type.
1
Apis.instance().db_api().exec( "get_all_unmatched_bets_for_bettor", [ account_id_type ] )
Copied!
Parameters
Return
Code
  • account_type_id: The id of the bettor account type/
All unmatched bets by bettor account type.
1
ChainStore.getAllUnmatchedBetsForBettor = function getAllUnmatchedBetsForBettor(account_id_type) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().db_api().exec('get_all_unmatched_bets_for_bettor', [account_id_type]).then(function (all_unmatched_bets_for_bettor) {
4
if (all_unmatched_bets_for_bettor) {
5
resolve(all_unmatched_bets_for_bettor);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_matched_bets_for_bettor

Get the matched bets for a bettor.
1
Apis.instance().bookie_api().exec( "get_matched_bets_for_bettor", [ bettor_id ] )
Copied!
Parameters
Return
Code
  • bettor_id: The id of the bettor.
All matched bets for the bettor.
1
ChainStore.getMatchedBetsForBettor = function getMatchedBetsForBettor(bettor_id) {
2
return new Promise(function (resolve, reject) {
3
_ws.Apis.instance().bookie_api().exec('get_matched_bets_for_bettor', [bettor_id]).then(function (matched_bets_for_bettor) {
4
if (matched_bets_for_bettor) {
5
resolve(matched_bets_for_bettor);
6
} else {
7
resolve(null);
8
}
9
}, reject);
10
});
11
};
Copied!

get_all_matched_bets_for_bettor

Get all matched bets for a bettor within a range.
1
Apis.instance().bookie_api().exec( "get_all_matched_bets_for_bettor", [ bettor_id, start, limit ] )
Copied!
Parameters
Return
Code
  • bettor_id: The id of the bettor
  • start: The start date
  • limit: Number of bets to be returned
All matched bets for the better within the range start to limit.
1
ChainStore.getAllMatchedBetsForBettor = function getAllMatchedBetsForBettor(bettor_id, start) {
2
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
3
4
return new Promise(function (resolve, reject) {
5
_ws.Apis.instance().bookie_api().exec('get_all_matched_bets_for_bettor', [bettor_id, start, limit]).then(function (all_matched_bets_for_bettor) {
6
if (all_matched_bets_for_bettor) {
7
resolve(all_matched_bets_for_bettor);
8
} else {
9
resolve(null);
10
}
11
}, reject);
12
});
13
};
Copied!