MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / listInvestmentFundTickers

Function listInvestmentFundTickers

services/tickers/listTickers.js:160–187  ·  view source on GitHub ↗
({ typeFund })

Source from the content-addressed store, hash-verified

158}
159
160export async function listInvestmentFundTickers({ typeFund }) {
161 const { tickers, page } = await fetchInvestmentFundTickers({
162 typeFund,
163 pageNumber: 1,
164 pageSize: PAGE_SIZE,
165 });
166
167 const totalPages = Math.ceil(page.totalRecords / PAGE_SIZE);
168 const promises = [];
169 for (let i = 2; i <= totalPages; i += 1) {
170 promises.push(
171 fetchInvestmentFundTickers({
172 typeFund,
173 pageNumber: i,
174 pageSize: PAGE_SIZE,
175 })
176 );
177 }
178
179 const results = await Promise.all(promises);
180
181 for (let i = 0; i < results.length; i += 1) {
182 const { tickers: newTickers } = results[i];
183 tickers.push(...newTickers);
184 }
185
186 return tickers;
187}

Callers 1

actionFunction · 0.90

Calls 1

Tested by

no test coverage detected