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

Function getFunds

services/cvm/fundos.js:94–119  ·  view source on GitHub ↗
(size = 100, page = 1)

Source from the content-addressed store, hash-verified

92};
93
94export const getFunds = async (size = 100, page = 1) => {
95 const offset = Number(page);
96
97 if (Number(size) > 200) {
98 throw new BadRequestError({
99 message: 'Tamanho máximo de 200 registros por página',
100 });
101 }
102
103 const pageSize = Number(size);
104
105 if (isNaN(offset) || isNaN(pageSize))
106 throw new BadRequestError({
107 message: 'Formato inválido de página e tamanho',
108 });
109
110 const fundData = await fetchCvmData();
111
112 const parsedData = parseCvmData(fundData, { summary: true });
113
114 return {
115 data: parsedData.slice((offset - 1) * pageSize, offset * pageSize),
116 page: offset,
117 size: pageSize,
118 };
119};
120
121export const getFundDetails = async (cnpj) => {
122 const fundData = await fetchCvmData();

Callers 1

actionFunction · 0.90

Calls 2

fetchCvmDataFunction · 0.85
parseCvmDataFunction · 0.85

Tested by

no test coverage detected