You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently you can call Asks & Bids for individual pairs. Out of experience and testing, multiple pairs seem to overload the subscription call and take the entire subscription service offline.
My suggestion is by limiting the delay in which the Asks & Bids data is received, as well as having a method for the sole purpose of getting Bids and Asks for all the pairs on the current chain.
This will help by limiting the amount of code needed as well as having the ability to control the subscription calls more slowly.
The reason i think the server gets overloaded is because it takes each pair, gets the asks, bids and moves to the next pair. This creates a lot of requests per pair.
//My code as an example:
orionUnit.orionAggregator.ws.subscribe("aobus", {
//loop through DATA containing pairs and get the pair
payload: keys[i], // Some trading pair
callback: (asks, bids, pairName) => {
let Asks = zodUtil.util.objectValues(asks);
let Bids = zodUtil.util.objectValues(bids)
for (let i = 0; i < asks.length; i++) {
let existingPairInData = DATA.find((pair) => pair.Pair === keys[i]);
if (existingPairInData) {
console.log("existingPairInData", existingPairInData)
existingPairInData.Spread = Asks[0].price - Bids[0].price / DATA[i].LastPrice;
}
}
}
});
Currently you can call Asks & Bids for individual pairs. Out of experience and testing, multiple pairs seem to overload the subscription call and take the entire subscription service offline.
My suggestion is by limiting the delay in which the Asks & Bids data is received, as well as having a method for the sole purpose of getting Bids and Asks for all the pairs on the current chain.
This will help by limiting the amount of code needed as well as having the ability to control the subscription calls more slowly.
The reason i think the server gets overloaded is because it takes each pair, gets the asks, bids and moves to the next pair. This creates a lot of requests per pair.
//My code as an example:
Suggested method:
The text was updated successfully, but these errors were encountered: