Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 3x 8x 8x 8x 12x 12x 7x 1x 1x 12x 11x 11x 8x 3x | import {IOrderbook, ITicker} from '../interfaces'; const getLastBuffers = <T extends IOrderbook | ITicker>( buffer: T[], maxNumResult: number, ) => { try { const result: T[] = []; for (let i = buffer.length - 1; i >= 0; i--) { let isExist = false; for (let j = 0; j < result.length; j++) { if (result[j].code === buffer[i].code) { isExist = true; break; } } if (!isExist) { result.push(buffer[i]); if (result.length >= maxNumResult) break; } } return result; } catch (error) { console.error(error); return []; } }; export default getLastBuffers; |