@databolsa/sdk 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@databolsa/sdk?color=cb3837&logo=npm)](https://www.npmjs.com/package/@databolsa/sdk)
4
4
  [![license](https://img.shields.io/npm/l/@databolsa/sdk?color=2ea44f)](https://github.com/databolsahq/databolsa/blob/main/LICENSE)
5
5
 
6
+ 🌐 **[databolsa.com](https://databolsa.com)** — a plataforma ao vivo · [docs da API](https://databolsa.com/docs)
7
+
6
8
  SDK TypeScript tipado para a Serving API pública do DataBolsa.
7
9
 
8
10
  O DataBolsa oferece infraestrutura aberta e reprodutível de dados para o mercado
@@ -90,7 +92,7 @@ npx -y @databolsa/mcp
90
92
 
91
93
  - OpenAPI: https://api.databolsa.com/openapi.json
92
94
  - Fontes e cobertura: https://github.com/databolsahq/databolsa/blob/main/docs/sources.md
93
- - Metodologia dos indicadores: https://github.com/databolsahq/databolsa/blob/main/docs/indicators.md
95
+ - Metodologia dos indicadores: https://databolsa.com/metodologia
94
96
  - Limitações conhecidas: https://github.com/databolsahq/databolsa/blob/main/docs/limitations.md
95
97
 
96
98
  ## Licença
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, MacroGearsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, Query, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, TesouroBondsResponse, YieldCurveResponse } from "./types";
1
+ import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, Query, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
2
2
  /** Filtros do screener de ações — derivados de `GET /v1/screener/stocks`. */
3
3
  export type ScreenStocksParams = Query<"screenStocks">;
4
4
  /**
@@ -9,6 +9,16 @@ export type ScreenStocksParams = Query<"screenStocks">;
9
9
  export type ScreenFiisParams = Omit<Query<"screenFiis">, "paper"> & {
10
10
  paper?: boolean;
11
11
  };
12
+ /** Filtros do screener de fundos — derivados de `GET /v1/screener/funds`. */
13
+ export type ScreenFundsParams = Query<"screenFunds">;
14
+ /**
15
+ * Params do lote de cotações ao vivo — `GET /v1/quotes/live`, com uma ergonomia:
16
+ * `tickers` aceita `string[]` (o contrato pede CSV; o HttpClient serializa). Forneça
17
+ * exatamente um de `tickers` ou `index`.
18
+ */
19
+ export type LiveQuotesParams = Omit<Query<"getLiveQuotes">, "tickers"> & {
20
+ tickers?: string[] | string;
21
+ };
12
22
  /**
13
23
  * Interface do cliente DataBolsa — métodos = operationIds do api/openapi.yaml.
14
24
  * O SDK público implementa esta interface com HttpClient; apps podem envolver
@@ -36,6 +46,17 @@ export interface DataBolsaClient {
36
46
  }): Promise<DocumentsResponse>;
37
47
  /** PENDÊNCIA DE CONTRATO — ver lib/api/types.ts (InsiderMove) */
38
48
  listInsiderMoves(ticker: string, params?: RangeParams): Promise<InsiderResponse>;
49
+ /** Fundos de investimento que detêm o ativo (visão reversa do CDA/CVM), da competência mais recente por default. */
50
+ listFundHolders(ticker: string, params?: {
51
+ cursor?: string;
52
+ limit?: number;
53
+ date?: string;
54
+ }): Promise<FundHoldersResponse>;
55
+ /** VWAP oficial (TradAvrgPric) e nº de negócios por pregão, do consolidado B3. */
56
+ listTradeStats(ticker: string, params?: RangeParams & {
57
+ limit?: number;
58
+ cursor?: string;
59
+ }): Promise<TradeStatsResponse>;
39
60
  /** Lista o universo real de FIIs (não o preview). */
40
61
  screenFiis(params?: ScreenFiisParams): Promise<FiiScreenResponse>;
41
62
  getFii(ticker: string): Promise<Fii>;
@@ -46,11 +67,73 @@ export interface DataBolsaClient {
46
67
  getFiiIndicatorHistory(ticker: string, name: string, params?: RangeParams): Promise<IndicatorHistoryResponse>;
47
68
  listFiiDistributions(ticker: string, params?: RangeParams): Promise<FiiDistributionsResponse>;
48
69
  listFiiReports(ticker: string, params?: RangeParams): Promise<FiiReportsResponse>;
70
+ /** Catálogo de ETFs listados na B3. */
71
+ listEtfs(params?: {
72
+ cursor?: string;
73
+ limit?: number;
74
+ search?: string;
75
+ segment?: string;
76
+ }): Promise<EtfListResponse>;
77
+ getEtf(ticker: string): Promise<EtfProfile>;
78
+ /** Ranqueia o universo de fundos por patrimônio, retorno ou nº de cotistas. */
79
+ screenFunds(params?: ScreenFundsParams): Promise<FundScreenerResponse>;
80
+ /** Catálogo de fundos de investimento (CVM 175). */
81
+ listFunds(params?: {
82
+ cursor?: string;
83
+ limit?: number;
84
+ search?: string;
85
+ classificacao?: string;
86
+ }): Promise<FundListResponse>;
87
+ /** Perfil de um fundo pelo CNPJ da classe. */
88
+ getFund(cnpj: string): Promise<FundProfile>;
89
+ /** Série diária de cota/PL/fluxo de um fundo. */
90
+ listFundQuotes(cnpj: string, params?: RangeParams & {
91
+ limit?: number;
92
+ cursor?: string;
93
+ }): Promise<FundQuotesResponse>;
94
+ /** Carteira (holdings) de um fundo — BLC_4 do CDA, competência mais recente por default. */
95
+ listFundHoldings(cnpj: string, params?: {
96
+ cursor?: string;
97
+ limit?: number;
98
+ date?: string;
99
+ }): Promise<FundHoldingsResponse>;
100
+ /** Fluxo diário por perfil de investidor (participação na B3). */
101
+ listInvestorFlow(params?: RangeParams & {
102
+ limit?: number;
103
+ cursor?: string;
104
+ investor_type?: string;
105
+ }): Promise<InvestorFlowResponse>;
106
+ /** Fechamento mensal por perfil de investidor × segmento de mercado. */
107
+ listInvestorFlowMonthly(params?: {
108
+ cursor?: string;
109
+ limit?: number;
110
+ month?: string;
111
+ investor_type?: string;
112
+ segment?: string;
113
+ }): Promise<InvestorFlowMonthlyResponse>;
114
+ /** Ofertas públicas de distribuição (IPO/follow-on, debêntures, cotas de fundos). */
115
+ listOfferings(params?: RangeParams & {
116
+ cursor?: string;
117
+ limit?: number;
118
+ search?: string;
119
+ regime?: "ICVM_400_476" | "RCVM_160";
120
+ tipo_ativo?: string;
121
+ }): Promise<OfferingsResponse>;
49
122
  listIndices(): Promise<IndexMeta[]>;
50
123
  listIndexQuotes(code: string, params?: RangeParams & {
51
124
  limit?: number;
52
125
  }): Promise<IndexQuotesResponse>;
53
126
  getIndexComposition(code: string): Promise<IndexCompositionResponse>;
127
+ /** Série intradiária (delay 15 min) de um índice; default = sessão mais recente. */
128
+ getIndexIntraday(code: string, params?: {
129
+ session?: string;
130
+ }): Promise<IntradaySeriesResponse>;
131
+ /** Lote de cotações ao vivo por `tickers` (CSV/array, máx 200) OU `index` (constituintes). */
132
+ getLiveQuotes(params: LiveQuotesParams): Promise<LiveQuotesResponse>;
133
+ /** Série intradiária (delay 15 min) de uma ação; default = sessão mais recente. */
134
+ getStockIntraday(ticker: string, params?: {
135
+ session?: string;
136
+ }): Promise<IntradaySeriesResponse>;
54
137
  getSeries(source: string, seriesId: string, params?: RangeParams & {
55
138
  accumulated?: "none" | "12m" | "ytd";
56
139
  }): Promise<SeriesResponse>;
@@ -1,5 +1,5 @@
1
- import { type DataBolsaClient, type ScreenFiisParams, type ScreenStocksParams } from "./client";
2
- import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, MacroGearsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, TesouroBondsResponse, YieldCurveResponse } from "./types";
1
+ import { type DataBolsaClient, type LiveQuotesParams, type ScreenFiisParams, type ScreenFundsParams, type ScreenStocksParams } from "./client";
2
+ import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
3
3
  /**
4
4
  * Cliente HTTP da Serving API do DataBolsa. Os métodos públicos espelham os
5
5
  * operationIds do OpenAPI e retornam tipos gerados.
@@ -42,6 +42,15 @@ export declare class HttpClient implements DataBolsaClient {
42
42
  category?: string;
43
43
  }): Promise<DocumentsResponse>;
44
44
  listInsiderMoves(ticker: string, params?: RangeParams): Promise<InsiderResponse>;
45
+ listFundHolders(ticker: string, params?: {
46
+ cursor?: string;
47
+ limit?: number;
48
+ date?: string;
49
+ }): Promise<FundHoldersResponse>;
50
+ listTradeStats(ticker: string, params?: RangeParams & {
51
+ limit?: number;
52
+ cursor?: string;
53
+ }): Promise<TradeStatsResponse>;
45
54
  screenFiis(params?: ScreenFiisParams): Promise<FiiScreenResponse>;
46
55
  getFii(ticker: string): Promise<Fii>;
47
56
  getFiiIndicators(ticker: string, params?: {
@@ -50,11 +59,61 @@ export declare class HttpClient implements DataBolsaClient {
50
59
  getFiiIndicatorHistory(ticker: string, name: string, params?: RangeParams): Promise<IndicatorHistoryResponse>;
51
60
  listFiiDistributions(ticker: string, params?: RangeParams): Promise<FiiDistributionsResponse>;
52
61
  listFiiReports(ticker: string, params?: RangeParams): Promise<FiiReportsResponse>;
62
+ listEtfs(params?: {
63
+ cursor?: string;
64
+ limit?: number;
65
+ search?: string;
66
+ segment?: string;
67
+ }): Promise<EtfListResponse>;
68
+ getEtf(ticker: string): Promise<EtfProfile>;
69
+ screenFunds(params?: ScreenFundsParams): Promise<FundScreenerResponse>;
70
+ listFunds(params?: {
71
+ cursor?: string;
72
+ limit?: number;
73
+ search?: string;
74
+ classificacao?: string;
75
+ }): Promise<FundListResponse>;
76
+ getFund(cnpj: string): Promise<FundProfile>;
77
+ listFundQuotes(cnpj: string, params?: RangeParams & {
78
+ limit?: number;
79
+ cursor?: string;
80
+ }): Promise<FundQuotesResponse>;
81
+ listFundHoldings(cnpj: string, params?: {
82
+ cursor?: string;
83
+ limit?: number;
84
+ date?: string;
85
+ }): Promise<FundHoldingsResponse>;
86
+ listInvestorFlow(params?: RangeParams & {
87
+ limit?: number;
88
+ cursor?: string;
89
+ investor_type?: string;
90
+ }): Promise<InvestorFlowResponse>;
91
+ listInvestorFlowMonthly(params?: {
92
+ cursor?: string;
93
+ limit?: number;
94
+ month?: string;
95
+ investor_type?: string;
96
+ segment?: string;
97
+ }): Promise<InvestorFlowMonthlyResponse>;
98
+ listOfferings(params?: RangeParams & {
99
+ cursor?: string;
100
+ limit?: number;
101
+ search?: string;
102
+ regime?: "ICVM_400_476" | "RCVM_160";
103
+ tipo_ativo?: string;
104
+ }): Promise<OfferingsResponse>;
53
105
  listIndices(): Promise<IndexMeta[]>;
54
106
  listIndexQuotes(code: string, params?: RangeParams & {
55
107
  limit?: number;
56
108
  }): Promise<IndexQuotesResponse>;
57
109
  getIndexComposition(code: string): Promise<IndexCompositionResponse>;
110
+ getIndexIntraday(code: string, params?: {
111
+ session?: string;
112
+ }): Promise<IntradaySeriesResponse>;
113
+ getLiveQuotes(params: LiveQuotesParams): Promise<LiveQuotesResponse>;
114
+ getStockIntraday(ticker: string, params?: {
115
+ session?: string;
116
+ }): Promise<IntradaySeriesResponse>;
58
117
  getSeries(source: string, seriesId: string, params?: RangeParams & {
59
118
  accumulated?: "none" | "12m" | "ytd";
60
119
  }): Promise<SeriesResponse>;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,6 @@
9
9
  export { HttpClient, HttpClient as DataBolsa } from "./http-client";
10
10
  export type { HttpClientOptions } from "./http-client";
11
11
  export { NotInPreviewError } from "./client";
12
- export type { DataBolsaClient, ScreenStocksParams, ScreenFiisParams } from "./client";
12
+ export type { DataBolsaClient, ScreenStocksParams, ScreenFiisParams, ScreenFundsParams } from "./client";
13
13
  export type * from "./types";
14
14
  export type { paths, components, operations } from "./schema";
package/dist/index.js CHANGED
@@ -124,6 +124,21 @@ class HttpClient {
124
124
  to: params?.to
125
125
  });
126
126
  }
127
+ listFundHolders(ticker, params) {
128
+ return this.request(`/stocks/${enc(ticker)}/fund-holders`, {
129
+ cursor: params?.cursor,
130
+ limit: params?.limit,
131
+ date: params?.date
132
+ });
133
+ }
134
+ listTradeStats(ticker, params) {
135
+ return this.request(`/stocks/${enc(ticker)}/trade-stats`, {
136
+ cursor: params?.cursor,
137
+ limit: params?.limit,
138
+ from: params?.from,
139
+ to: params?.to
140
+ });
141
+ }
127
142
  screenFiis(params) {
128
143
  return this.request("/screener/fiis", {
129
144
  segment: params?.segment,
@@ -158,6 +173,82 @@ class HttpClient {
158
173
  to: params?.to
159
174
  });
160
175
  }
176
+ listEtfs(params) {
177
+ return this.request("/etfs", {
178
+ cursor: params?.cursor,
179
+ limit: params?.limit,
180
+ search: params?.search,
181
+ segment: params?.segment
182
+ });
183
+ }
184
+ getEtf(ticker) {
185
+ return this.request(`/etfs/${enc(ticker)}`);
186
+ }
187
+ screenFunds(params) {
188
+ return this.request("/screener/funds", {
189
+ cursor: params?.cursor,
190
+ limit: params?.limit,
191
+ classificacao: params?.classificacao,
192
+ min_net_worth: params?.min_net_worth,
193
+ sort: params?.sort,
194
+ order: params?.order
195
+ });
196
+ }
197
+ listFunds(params) {
198
+ return this.request("/funds", {
199
+ cursor: params?.cursor,
200
+ limit: params?.limit,
201
+ search: params?.search,
202
+ classificacao: params?.classificacao
203
+ });
204
+ }
205
+ getFund(cnpj) {
206
+ return this.request(`/funds/${enc(cnpj)}`);
207
+ }
208
+ listFundQuotes(cnpj, params) {
209
+ return this.request(`/funds/${enc(cnpj)}/quotes`, {
210
+ cursor: params?.cursor,
211
+ limit: params?.limit,
212
+ from: params?.from,
213
+ to: params?.to
214
+ });
215
+ }
216
+ listFundHoldings(cnpj, params) {
217
+ return this.request(`/funds/${enc(cnpj)}/holdings`, {
218
+ cursor: params?.cursor,
219
+ limit: params?.limit,
220
+ date: params?.date
221
+ });
222
+ }
223
+ listInvestorFlow(params) {
224
+ return this.request("/market/investor-flow", {
225
+ cursor: params?.cursor,
226
+ limit: params?.limit,
227
+ from: params?.from,
228
+ to: params?.to,
229
+ investor_type: params?.investor_type
230
+ });
231
+ }
232
+ listInvestorFlowMonthly(params) {
233
+ return this.request("/market/investor-flow/monthly", {
234
+ cursor: params?.cursor,
235
+ limit: params?.limit,
236
+ month: params?.month,
237
+ investor_type: params?.investor_type,
238
+ segment: params?.segment
239
+ });
240
+ }
241
+ listOfferings(params) {
242
+ return this.request("/offerings", {
243
+ cursor: params?.cursor,
244
+ limit: params?.limit,
245
+ search: params?.search,
246
+ regime: params?.regime,
247
+ tipo_ativo: params?.tipo_ativo,
248
+ from: params?.from,
249
+ to: params?.to
250
+ });
251
+ }
161
252
  listIndices() {
162
253
  return this.request("/indices");
163
254
  }
@@ -171,6 +262,22 @@ class HttpClient {
171
262
  getIndexComposition(code) {
172
263
  return this.request(`/indices/${enc(code)}/composition`);
173
264
  }
265
+ getIndexIntraday(code, params) {
266
+ return this.request(`/indices/${enc(code)}/intraday`, {
267
+ session: params?.session
268
+ });
269
+ }
270
+ getLiveQuotes(params) {
271
+ return this.request("/quotes/live", {
272
+ tickers: Array.isArray(params.tickers) ? params.tickers.join(",") : params.tickers,
273
+ index: params.index
274
+ });
275
+ }
276
+ getStockIntraday(ticker, params) {
277
+ return this.request(`/stocks/${enc(ticker)}/intraday`, {
278
+ session: params?.session
279
+ });
280
+ }
174
281
  getSeries(source, seriesId, params) {
175
282
  return this.request(`/series/${enc(source)}/${enc(seriesId)}`, {
176
283
  from: params?.from,