Getting Contest IDs
Now that we have the series ID for the series we want to join we can use that to get the ID for the specific contest we want to join.
This will return all of the contests inside the specific series we have chosen. Be sure the status of the contest you are joining is "open" otherwise that means that the contest has ended or is active and therefore cannot be joined.
const seriesId = 'series-id-from-last-step';
const apiToken = "your-api-key";
const https = require('https');
const options = {
hostname: 'api.hxro.io',
port: 443,
path: '/hxroapi/api/contests/by-series/' + seriesId,
method: 'GET',
headers: {
'Ocp-Apim-Subscription-Key': apiToken
}
}
const req = https.request(options, (res) => {
var arr = "";
res.on('data', (part) => {
arr += part;
});
res.on('end', () => {
var seriesArr = JSON.parse(arr);
for (i = 0; i <= seriesArr.length; i++) {
console.log(seriesArr[i]);
}
});
});
req.on('error', (e) => {
console.error(e);
});
req.end();
public Contests GetgContests(Series s)
{
using (var client = new WebClient())
{
string uriString = "https://api.hxro.io/hxroapi/api/contests/by-series/{" + s.Id.ToString() + "}";
client.Headers.Clear();
client.Headers.Add("Content-Type", "application/json");
var jsonResponse = client.DownloadString(uriString);
return JsonConvert.DeserializeObject<IEnumerable<HxroContest>>(jsonResponse);
}
}
An example of a contest from a successful response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"shortId": "string",
"name": "string",
"isSimulating": true,
"seriesId": "string",
"status": "Created",
"prizePool": 0,
"rake": 0,
"duration": "string",
"contestLiveTime": "2020-01-17T20:34:10.025Z",
"contestOpenTime": "2020-01-17T20:34:10.025Z",
"contestCloseTime": "2020-01-17T20:34:10.025Z",
"minPlayers": 0,
"assetType": "HXRO",
"contestType": "Portfolio",
"instrumentPrices": [
{
"instrument": {
"assetIdBase": "string",
"assetIdQuote": "string"
},
"livePrice": {
"blendedPrice": 0,
"exchangePrices": [
{
"tradeId": "string",
"exchangeId": "string",
"tradeTimestamp": "2020-01-17T20:34:10.026Z",
"price": 0,
"weighting": 0
}
]
},
"closePrice": {
"blendedPrice": 0,
"exchangePrices": [
{
"tradeId": "string",
"exchangeId": "string",
"tradeTimestamp": "2020-01-17T20:34:10.026Z",
"price": 0,
"weighting": 0
}
]
}
}
]
}
Updated over 4 years ago