I am working with an array of objects that include a baseAsset key and Volume for each object, with the volume value varying between objects.
My goal is to find the object with the highest volume value based on a match with the baseAsset key. Efficiency and speed are crucial due to the large size of the array containing over 3000 objects
let tickerA = [{
pair: 'AUDUSD',
baseAsset: 'AUD',
lastPriceUSD: 0.74,
volume: 1000
}, {
pair: 'AUDUSD',
baseAsset: 'AUD',
lastPriceUSD: 0.76,
volume: 2000
}, {
pair: 'USDEUR',
baseAsset: 'USD',
lastPriceUSD: 1.25,
volume: 1200
}, {
pair: 'USDEUR',
baseAsset: 'USD',
lastPriceUSD: 1.19,
volume: 1500
}]
The expected result when running a function
tickerB = [{
baseAsset: 'AUD',
lastPriceUSD: 0.76,
volume: 2000
}, {
baseAsset: 'USD',
lastPriceUSD: 1.25,
volume: 1500
}]