Skip to content

Instantly share code, notes, and snippets.

@dekz
Last active October 22, 2019 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekz/94f083217d347eb6a5c8d07ca8ccc3c2 to your computer and use it in GitHub Desktop.
Save dekz/94f083217d347eb6a5c8d07ca8ccc3c2 to your computer and use it in GitHub Desktop.
import http from 'k6/http';
const SRA_ENDPOINT = 'https://sra.0x.org';
let pairs;
export default function() {
if (!pairs) {
pairs = http.get(`${SRA_ENDPOINT}/v2/asset_pairs?perPage=300`).json().records;
console.log(JSON.stringify(pairs));
}
// Also test /v2/orders with no asset data
const pair = pairs[Math.floor(Math.random() * (pairs.length + 1))];
let queryString = '';
if (pair) {
queryString = `?makerAssetData=${pair.assetDataA.assetData}&takerAssetData=${pair.assetDataB.assetData}`;
}
http.get(`${SRA_ENDPOINT}/v2/orders${queryString}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment