Last active
October 22, 2019 01:41
-
-
Save dekz/94f083217d347eb6a5c8d07ca8ccc3c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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