btgsolutions_dataservices.rest package

Submodules

btgsolutions_dataservices.rest.alternative_data_companies module

class btgsolutions_dataservices.rest.alternative_data_companies.AlternativeDataCompanies(api_key: str)[source]

Bases: object

This class provides company-level alternative data: corporate governance, board composition, financial statements, and issuer disclosures.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataCompanies
>>> companies = AlternativeDataCompanies(api_key='YOUR_API_KEY')
>>> companies.get_board(company_id='PETR4')
>>> companies.get_governance_summary(company_id='VALE3')
>>> companies.get_financial_statements(company_id='ITUB4')
>>> companies.get_disclosures(company_id='PETR4', document_type='insider')
Parameters:

api_key (str) – User identification key. Field is required.

get_board(company_id: str, reference_date: str | None = None, body: str | None = None, committee: str | None = None, include_alternates: bool | None = None, limit: int = 200, offset: int = 0) dict[source]

Board and executive composition for a company (BR, US, or UK).

Parameters:
  • company_id (str) – Company identifier. Accepts CNPJ, CVM code, B3 ticker, ISIN, LEI, UK company number, SEC ticker/CIK, or company name. Field is required. Example: ‘PETR4’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent filing. Field is not required. Example: ‘2024-12-31’.

  • body (str) – Governance body filter: ‘board’, ‘executive’, or ‘committee’. Field is not required. Default: ‘board’.

  • committee (str) – Committee name filter (used when body=’committee’). Field is not required.

  • include_alternates (bool) – Whether to include alternate members. Field is not required. Default: True.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 200.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_board_changes(company_id: str, start_date: str | None = None, end_date: str | None = None, event: str | None = None, limit: int = 100) dict[source]

Board appointment and resignation events.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘VALE3’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • event (str) – Event type filter: ‘appointed’ or ‘resigned’. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

get_corporate_registry(company_id: str, direction: str = 'partners', reference_month: str | None = None, partner_type: str | None = None, qualification: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Brazilian corporate registry (Receita Federal QSA + CVM FRE).

Parameters:
  • company_id (str) – Company identifier (CNPJ, CVM code, or B3 ticker). Field is required. Example: ‘PETR4’.

  • direction (str) – ‘partners’ (default) returns the company’s shareholders/partners; ‘investees’ returns the companies this entity holds stakes in. Field is not required. Default: ‘partners’.

  • reference_month (str) – Reference month in YYYY-MM format. Field is not required.

  • partner_type (str) – Partner type filter. Field is not required.

  • qualification (str) – Partner qualification filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_disclosures(company_id: str | None = None, document_type: str = 'repurchase', asset: str | None = None, protocol_number: str | None = None, reference_date: str | None = None, start_date: str | None = None, end_date: str | None = None, transaction: str | None = None, transaction_type: str | None = None, participant_group: str | None = None, limit: int = 100, offset: int = 0) dict[source]

CVM IPE regulatory disclosure documents (buyback programs and insider activity notifications).

Parameters:
  • company_id (str) – Company identifier. Field is not required. Example: ‘PETR4’.

  • document_type (str) – Document type: ‘repurchase’ (buyback programs) or ‘insider’ (insider trading notifications). Field is not required. Default: ‘repurchase’.

  • asset (str) – Ticker asset filter. Field is not required.

  • protocol_number (str) – CVM protocol number filter. Field is not required.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Field is not required.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • transaction (str) – Transaction description filter. Field is not required.

  • transaction_type (str) – Transaction type filter. Field is not required.

  • participant_group (str) – Participant group filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_financial_notes(company_id: str, quarter: str | None = None, limit: int = 10, offset: int = 0) dict[source]

LLM-parsed structured data from CVM DFP/ITR explanatory notes (notas explicativas): geographic_segments, fx_exposure, and supplier_concentration.

Parameters:
  • company_id (str) – Company identifier (CNPJ, CVM code, or B3 ticker). Field is required. Example: ‘VALE3’.

  • quarter (str) – Quarter filter in QTyy format (e.g. ‘Q42024’). Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 10.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_financial_statements(company_id: str, statement: str = 'income_statement', quarter: str | None = None, reference_date: str | None = None, statement_type: str | None = None, account_code: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Financial statements from CVM DFP/ITR filings (BR companies).

Parameters:
  • company_id (str) – Company identifier (CNPJ, CVM code, or B3 ticker). Field is required. Example: ‘PETR4’.

  • statement (str) – Statement type (e.g. ‘income_statement’, ‘balance_sheet’, ‘cash_flow’). Field is not required. Default: ‘income_statement’.

  • quarter (str) – Quarter filter in QTyy format (e.g. ‘Q12024’). Field is not required.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Field is not required.

  • statement_type (str) – Statement type filter (e.g. ‘DFP’, ‘ITR’). Field is not required.

  • account_code (str) – Specific account code filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_governance_beneficial_ownership(company_id: str, holder_type: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Beneficial ownership records (UK PSC or BR equivalents).

Parameters:
  • company_id (str) – Company identifier. Field is required.

  • holder_type (str) – Holder type filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_governance_compensation(company_id: str, fiscal_year: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Executive compensation data from CVM FRE (BR) or SEC proxy filings (US).

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘VALE3’.

  • fiscal_year (str) – Four-digit fiscal year filter. Field is not required. Example: ‘2024’.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_governance_documents(company_id: str, start_date: str | None = None, end_date: str | None = None, category: str | None = None, governance_topic: str | None = None, event_tag: str | None = None, limit: int = 100, offset: int = 0) dict[source]

CVM IPE governance documents for a Brazilian company.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘PETR4’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • category (str) – Document category filter. Field is not required.

  • governance_topic (str) – Governance topic filter. Field is not required.

  • event_tag (str) – Event tag filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_governance_history(company_id: str, start_date: str | None = None, end_date: str | None = None, body: str | None = None, limit: int = 12) dict[source]

Monthly governance history snapshots (member counts per governance body).

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘ITUB4’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • body (str) – Governance body filter: ‘board’, ‘executive’, or ‘committee’. Field is not required.

  • limit (int) – Maximum number of snapshots to return. Field is not required. Default: 12.

Related-party transactions from CVM FRE filings.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘ITUB4’.

  • relation_category (str) – Relation category filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_governance_summary(company_id: str) dict[source]

Latest governance snapshot for a company (board size, independence, committees, CEO name, etc.).

Parameters:

company_id (str) – Company identifier (CNPJ, CVM code, B3 ticker, SEC ticker/CIK, etc.). Field is required. Example: ‘VALE3’.

get_insider_trades(company_id: str, start_date: str | None = None, end_date: str | None = None, transaction_code: str | None = None, limit: int = 100) dict[source]

Insider trade transactions from SEC Forms 3/4/5 (US only).

Parameters:
  • company_id (str) – Company identifier (SEC ticker or CIK). Field is required. Example: ‘AAPL’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • transaction_code (str) – SEC transaction code filter (e.g. ‘P’ for purchase, ‘S’ for sale). Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

btgsolutions_dataservices.rest.alternative_data_funds module

class btgsolutions_dataservices.rest.alternative_data_funds.AlternativeDataFunds(api_key: str)[source]

Bases: object

This class provides fund-level alternative data: holdings snapshots, portfolio exposures, history, look-through, and manager aggregate holdings.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataFunds
>>> funds = AlternativeDataFunds(api_key='YOUR_API_KEY')
>>> funds.get_holdings(fund_id='73.232.530/0001-46')
>>> funds.get_exposures(fund_id='73.232.530/0001-46')
>>> funds.get_history(fund_id='73.232.530/0001-46')
Parameters:

api_key (str) – User identification key. Field is required.

get_exposures(fund_id: str, reference_date: str | None = None, exposure_type: str = 'all') dict[source]

Portfolio exposures for a Brazilian CVM fund (asset class, issuer, sector, indexer, maturity, country).

Parameters:
  • fund_id (str) – Fund CNPJ. Field is required. Example: ‘73.232.530/0001-46’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • exposure_type (str) – Exposure breakdown to return: ‘all’, ‘asset_class’, ‘issuer’, ‘sector’, ‘indexer’, ‘maturity’, or ‘country’. Field is not required. Default: ‘all’.

get_history(fund_id: str, start_date: str | None = None, end_date: str | None = None, limit: int = 12) dict[source]

Holdings history time-series for a Brazilian CVM fund (snapshot metadata per reference date: positions count, total value, NAV).

Parameters:
  • fund_id (str) – Fund CNPJ. Field is required. Example: ‘73.232.530/0001-46’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • limit (int) – Maximum number of snapshots to return (max 60). Field is not required. Default: 12.

get_holdings(fund_id: str, reference_date: str | None = None, asset_class: str | None = None, source: str = 'official', limit: int = 200, offset: int = 0) dict[source]

Holdings snapshot for a Brazilian CVM fund, ETF, or US fund.

Parameters:
  • fund_id (str) – Fund identifier. Accepts CNPJ (BR funds/ETFs) or US fund identifier. Field is required. Example: ‘73.232.530/0001-46’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • asset_class (str) – Asset class filter (e.g. ‘equity’, ‘fixed_income’). Field is not required.

  • source (str) – Data source: ‘official’, ‘approximate’, or ‘index’. Field is not required. Default: ‘official’.

  • limit (int) – Maximum number of holdings to return (max 5000). Field is not required. Default: 200.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_lookthrough(fund_id: str, reference_date: str | None = None, limit: int = 100) dict[source]

Look-through resolution for a fund-of-funds (resolves nested fund positions to underlying assets).

Parameters:
  • fund_id (str) – Fund CNPJ. Field is required.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • limit (int) – Maximum number of results to return (max 1000). Field is not required. Default: 100.

get_manager_aggregate_holdings(manager_id: str, reference_date: str | None = None, limit: int = 100) dict[source]

Aggregate holdings managed by a given investment manager across all their funds.

Parameters:
  • manager_id (str) – Manager identifier (CNPJ or name). Field is required.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

btgsolutions_dataservices.rest.alternative_data_macro_markets module

class btgsolutions_dataservices.rest.alternative_data_macro_markets.AlternativeDataMacroMarkets(api_key: str)[source]

Bases: object

This class provides macro and market alternative data: macro indicator time-series, Brazilian public debt (DPMFi), and B3 maximum theoretical margin.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataMacroMarkets
>>> macro = AlternativeDataMacroMarkets(api_key='YOUR_API_KEY')
>>> macro.get_macro_indicators(indicator='selic')
>>> macro.get_macro_indicators(indicator='ipca', start_date='2024-01', end_date='2024-12')
>>> macro.get_dpmfi(status='dados_oficiais')
>>> macro.get_maximum_theoretical_margin(asset='PETR4')
Parameters:

api_key (str) – User identification key. Field is required.

get_dpmfi(start_date: str | None = None, end_date: str | None = None, status: str = 'dados_oficiais', snapshot_date: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Monthly time-series of DPMFi (domestic federal public debt) outstanding stock broken down by bond type (NTN-B, LFT, NTN-F, LTN, Demais).

Parameters:
  • start_date (str) – Start of the query period in YYYY-MM format. Field is not required. Example: ‘2024-01’.

  • end_date (str) – End of the query period in YYYY-MM format. Field is not required. Example: ‘2024-12’.

  • status (str) – Data status filter: ‘dados_oficiais’ (official), ‘projecao’ (forecast), or ‘estipulado’ (PAF target). Field is not required. Default: ‘dados_oficiais’.

  • snapshot_date (str) – Presto partition date in YYYY-MM-DD format. Defaults to the latest available weekly snapshot when omitted. Field is not required.

  • limit (int) – Maximum number of rows to return (max 500). Field is not required. Default: 100.

  • offset (int) – Number of rows to skip for pagination. Field is not required. Default: 0.

get_dpmfi_composition(start_date: str | None = None, end_date: str | None = None, bond_type: str | None = None, snapshot_date: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Monthly PAF composition by bond type: new issuances, end-of-month outstanding stock, and share of total DPMFi debt (Prefixado, IPCA, Selic, Total).

Parameters:
  • start_date (str) – Start of the query period in YYYY-MM format. Field is not required. Example: ‘2026-04’.

  • end_date (str) – End of the query period in YYYY-MM format. Field is not required. Example: ‘2026-06’.

  • bond_type (str) – Bond category filter: ‘Prefixado’, ‘IPCA’, ‘Selic’, or ‘Total’. Returns all categories when omitted. Field is not required.

  • snapshot_date (str) – Presto partition date in YYYY-MM-DD format. Defaults to the latest available weekly snapshot when omitted. Field is not required.

  • limit (int) – Maximum number of rows to return (max 500). Field is not required. Default: 100.

  • offset (int) – Number of rows to skip for pagination. Field is not required. Default: 0.

get_macro_indicators(indicator: str, start_date: str | None = None, end_date: str | None = None, year: str | None = None, month: str | None = None, period: str | None = None, state: str | None = None, country: str | None = None, source: str | None = None, type: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Time-series observations for a macro indicator. Defaults to the most recent period when no date filter is supplied.

Available indicators: selic, ipca, ipca_contributions, copom, pim, pmc, pms, pnad, gdp, comexstat, rreo.

Parameters:
  • indicator (str) – Macro indicator code. Field is required. Example: ‘selic’.

  • start_date (str) – Start of the query period in YYYY-MM format. Field is not required. Example: ‘2024-01’.

  • end_date (str) – End of the query period in YYYY-MM format. Field is not required. Example: ‘2024-12’.

  • year (str) – Four-digit year filter (ComexStat and RREO). Field is not required.

  • month (str) – Numeric month filter 1-12 (ComexStat only). Field is not required.

  • period (str) – Bimester filter 1-6 (RREO only). Field is not required.

  • state (str) – Brazilian state UF filter (ComexStat or RREO). Field is not required. Example: ‘SP’.

  • country (str) – Partner country filter (ComexStat only). Field is not required.

  • source (str) – Data source filter (e.g. ‘BCB/Demab’, ‘IBGE/DPE’). Field is not required.

  • type (str) – Variation type for PIM/PMC/PMS/GDP: ‘yoy’ or ‘mom’. Field is not required.

  • limit (int) – Maximum number of observations to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_maximum_theoretical_margin(report_date: str | None = None, asset: str | None = None, instrument_id: str | None = None, origin: str | None = None, start_date: str | None = None, end_date: str | None = None, min_margin: float | None = None, max_margin: float | None = None, limit: int = 100, offset: int = 0) dict[source]

B3 maximum theoretical margin (haircut) reference data.

Parameters:
  • report_date (str) – Reference date in YYYY-MM-DD format. Defaults to the latest available snapshot. Field is not required.

  • asset (str) – Ticker asset filter. Field is not required. Example: ‘PETR4’.

  • instrument_id (str) – B3 instrument identifier filter. Field is not required. Example: ‘PETR4F’.

  • origin (str) – Origin market filter (e.g. ‘EQUITIES’, ‘DERIVATIVES’). Field is not required.

  • start_date (str) – Start date of the query period in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date of the query period in YYYY-MM-DD format. Field is not required.

  • min_margin (float) – Lower bound filter on the discount_margin (haircut) value. Field is not required.

  • max_margin (float) – Upper bound filter on the discount_margin (haircut) value. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

btgsolutions_dataservices.rest.alternative_data_metadata module

class btgsolutions_dataservices.rest.alternative_data_metadata.AlternativeDataMetadata(api_key: str)[source]

Bases: object

This class provides metadata endpoints for the Alternative Data public sources: datasets catalog, available assets, available indicators, company directory, financial statement types, and sector/CNAE taxonomy.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataMetadata
>>> meta = AlternativeDataMetadata(api_key='YOUR_API_KEY')
>>> meta.get_company_directory(query='PETROBRAS')
>>> meta.get_taxonomy(system='b3')
>>> meta.get_company_sector(identifier='PETR4')
Parameters:

api_key (str) – User identification key. Field is required.

get_available_assets(report_date: str | None = None, dataset: str = 'all', prefix: str | None = None, limit: int = 1000) dict[source]

List available asset codes for a dataset on a given reference date.

Parameters:
  • report_date (str) – Reference date in YYYY-MM-DD format. Defaults to the latest available day. Field is not required.

  • dataset (str) – Dataset to scope the listing: ‘maximum_theoretical_margin’, ‘investor_categories’, or ‘all’ (default). Field is not required. Default: ‘all’.

  • prefix (str) – Ticker/code prefix filter (e.g. ‘PETR’ to list only PETR3, PETR4, …). Field is not required.

  • limit (int) – Maximum number of asset codes to return. Field is not required. Default: 1000.

get_available_indicators() dict[source]

List the available macro indicator codes for use with AlternativeDataMacroMarkets.get_macro_indicators().

get_cnae(code: str) dict[source]

CNAE code lookup (Brazilian National Classification of Economic Activities).

Parameters:

code (str) – CNAE code. Field is required. Example: ‘6422100’.

get_company_directory(query: str | None = None, jurisdiction: str | None = None, limit: int = 50, offset: int = 0) dict[source]

Free-text company search to discover company_id values.

Parameters:
  • query (str) – Free-text search over company name, ticker, CNPJ, or CIK. Field is not required. Example: ‘PETROBRAS’.

  • jurisdiction (str) – Filter by jurisdiction: ‘BR’ or ‘US’. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 50.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_company_sector(identifier: str) dict[source]

Sector classification for a company.

Parameters:

identifier (str) – Company identifier (CNPJ, CVM code, or B3 ticker). Field is required. Example: ‘PETR4’.

get_datasets() dict[source]

List the public-source market-data datasets available for discovery (maximum_theoretical_margin, investor_categories).

get_financial_statement_types() dict[source]

List the available financial statement types (e.g. income_statement, balance_sheet, cash_flow).

get_sector_companies(sector: str | None = None, subsector: str | None = None, segment: str | None = None, active_only: bool = False, limit: int = 500) dict[source]

Companies belonging to a given sector, subsector, or segment.

Parameters:
  • sector (str) – Sector name filter. Field is not required. Example: ‘Petróleo, Gás e Biocombustíveis’.

  • subsector (str) – Subsector name filter. Field is not required.

  • segment (str) – Segment name filter. Field is not required.

  • active_only (bool) – If True, returns only companies with active listings. Field is not required. Default: False.

  • limit (int) – Maximum number of companies to return. Field is not required. Default: 500.

get_sectors_summary() dict[source]

Aggregate sector summary statistics across all classified companies.

get_taxonomy(system: str | None = None, limit: int = 5000) dict[source]

Full sector taxonomy tree (B3 or CNAE classification system).

Parameters:
  • system (str) – Classification system: ‘b3’ or ‘cnae’. Field is not required. Example: ‘b3’.

  • limit (int) – Maximum number of taxonomy entries to return. Field is not required. Default: 5000.

btgsolutions_dataservices.rest.alternative_data_ownership module

class btgsolutions_dataservices.rest.alternative_data_ownership.AlternativeDataOwnership(api_key: str)[source]

Bases: object

This class provides ownership alternative data: top shareholders, ownership structure, change events, official notices, control group, free float, shareholder holdings, and institutional/fund holders of assets.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataOwnership
>>> ownership = AlternativeDataOwnership(api_key='YOUR_API_KEY')
>>> ownership.get_top_shareholders(company_id='VALE3')
>>> ownership.get_ownership_current(company_id='ITUB4')
>>> ownership.get_shareholder_holdings(shareholder_id='00.000.000/0001-91')
Parameters:

api_key (str) – User identification key. Field is required.

get_fund_holders(identifier: str, identifier_type: str = 'b3_ticker', reference_date: str | None = None, limit: int = 50) dict[source]

Funds that hold a specific asset.

Parameters:
  • identifier (str) – Asset identifier. Field is required. Example: ‘PETR4’.

  • identifier_type (str) – Type of identifier: ‘b3_ticker’, ‘isin’, ‘cusip’, or ‘issuer_cnpj’. Field is not required. Default: ‘b3_ticker’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • limit (int) – Maximum number of fund holders to return (max 500). Field is not required. Default: 50.

get_institutional_holders(identifier: str, identifier_type: str = 'b3_ticker', reference_date: str | None = None, limit: int = 50) dict[source]

Institutional holders of a specific asset.

Parameters:
  • identifier (str) – Asset identifier. Field is required. Example: ‘VALE3’.

  • identifier_type (str) – Type of identifier: ‘b3_ticker’, ‘isin’, ‘cusip’, or ‘issuer_cnpj’. Field is not required. Default: ‘b3_ticker’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • limit (int) – Maximum number of holders to return. Field is not required. Default: 50.

get_ownership_change_events(company_id: str, start_date: str | None = None, end_date: str | None = None, ownership_category: str = 'all', limit: int = 100) dict[source]

Ownership change events for a company (with inline official notices).

Parameters:
  • company_id (str) – Company identifier. Field is required.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • ownership_category (str) – Ownership category filter. Field is not required. Default: ‘all’.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

get_ownership_control_group(company_id: str) dict[source]

Control group composition for a Brazilian company (CVM FRE).

Parameters:

company_id (str) – Company identifier. Field is required. Example: ‘VALE3’.

get_ownership_current(company_id: str) dict[source]

Current ownership structure snapshot for a company.

Parameters:

company_id (str) – Company identifier. Field is required. Example: ‘ITUB4’.

get_ownership_free_float(company_id: str, limit: int = 20) dict[source]

Free float breakdown for a company.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘PETR4’.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 20.

get_ownership_history(company_id: str, start_date: str | None = None, end_date: str | None = None, ownership_category: str = 'all', limit: int = 12) dict[source]

Monthly ownership history snapshots for a company.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘VALE3’.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • ownership_category (str) – Ownership category filter. Field is not required. Default: ‘all’.

  • limit (int) – Maximum number of snapshots to return. Field is not required. Default: 12.

get_ownership_official_notices(company_id: str, start_date: str | None = None, end_date: str | None = None, parser_status: str = 'all', limit: int = 100) dict[source]

Official ownership notices (CVM IPE, SEC 13D/13G/13F, IR page structures).

Parameters:
  • company_id (str) – Company identifier. Field is required.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • parser_status (str) – Filter by parser status. Field is not required. Default: ‘all’.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

get_shareholder_holdings(shareholder_id: str, start_date: str | None = None, end_date: str | None = None, ownership_category: str = 'all', limit: int = 100, offset: int = 0) dict[source]

Holdings owned by a shareholder across companies (reverse lookup).

Parameters:
  • shareholder_id (str) – Shareholder identifier (CNPJ, CPF, or name). Field is required.

  • start_date (str) – Start date in YYYY-MM-DD format. Field is not required.

  • end_date (str) – End date in YYYY-MM-DD format. Field is not required.

  • ownership_category (str) – Ownership category filter. Field is not required. Default: ‘all’.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

get_top_shareholders(company_id: str, reference_date: str | None = None, ownership_category: str = 'all', limit: int = 20) dict[source]

Top shareholders for a company.

Parameters:
  • company_id (str) – Company identifier. Field is required. Example: ‘VALE3’.

  • reference_date (str) – Reference date in YYYY-MM-DD format. Defaults to the most recent snapshot. Field is not required.

  • ownership_category (str) – Ownership category filter. Field is not required. Default: ‘all’.

  • limit (int) – Maximum number of shareholders to return. Field is not required. Default: 20.

btgsolutions_dataservices.rest.alternative_data_people module

class btgsolutions_dataservices.rest.alternative_data_people.AlternativeDataPeople(api_key: str)[source]

Bases: object

This class provides people-level alternative data: governance appointments for individuals across BR, US, and UK companies.

  • Main use case:

>>> from btgsolutions_dataservices import AlternativeDataPeople
>>> people = AlternativeDataPeople(api_key='YOUR_API_KEY')
>>> people.get_appointments(person_id='slug:Jean Paul Lemann')
Parameters:

api_key (str) – User identification key. Field is required.

get_appointments(person_id: str, active_only: bool = False, body: str | None = None, group_by: str | None = None, name: str | None = None, limit: int = 100, offset: int = 0) dict[source]

Governance appointments for a person across BR, US, and UK companies.

Parameters:
  • person_id (str) – Person identifier. Accepts CPF, ‘slug:name’, ‘cpf:CPF’, ‘uk_officer:id’, or SEC CIK. Field is required. Example: ‘slug:Jean Paul Lemann’.

  • active_only (bool) – If True, returns only current active appointments. Field is not required. Default: False.

  • body (str) – Governance body filter: ‘board’, ‘executive’, or ‘committee’. Field is not required.

  • group_by (str) – Group results by ‘company’. Field is not required.

  • name (str) – Name search filter. Field is not required.

  • limit (int) – Maximum number of results to return. Field is not required. Default: 100.

  • offset (int) – Number of results to skip for pagination. Field is not required. Default: 0.

btgsolutions_dataservices.rest.authenticator module

class btgsolutions_dataservices.rest.authenticator.Authenticator(api_key)[source]

Bases: object

get_new_token()[source]
property token

btgsolutions_dataservices.rest.bulk_data module

class btgsolutions_dataservices.rest.bulk_data.BulkData(api_key: str | None)[source]

Bases: object

This class provides market data by ticker and date, in .csv format

  • Main use case:

>>> from btgsolutions_dataservices import BulkData
>>> bulk_data = BulkData(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> bulk_data.get_data(
>>>     ticker = 'DI1F18',
>>>     date = '2017-01-02',
>>>     data_type = 'trades',
>>>     raw_data = False
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(date: str, data_type: str, prefix: str = '')[source]

This method provides all tickers available for query, for the provided market data type.

Parameters:
  • date (str) – Date period. Field is required. Format: ‘YYYY-MM-DD’. Example: ‘2023-07-03’.

  • data_type (str) – Market data type. Field is required. Example: ‘trades’, ‘books’ or ‘trades-and-book-events’.

  • prefix (str) – Filters tickers starting with the prefix. Field is optional. Example: ‘DOL’.

get_compressed_data(channel: str, date: str, data_type: str = 'instruments', feed: str = '')[source]

This method provides market data via compressed files (instruments, snapshot, incremental) for a given market data channel and date. Function get_market_data_channels provides all the available channels for a given date.

Parameters:
  • channel (str) – Market Data channel. Field is required. Example: ‘72’.

  • date (str) – Date period. Field is required. Format: ‘YYYY-MM-DD’. Example: ‘2026-01-30’.

  • data_type (str) – Market data type. Field is required. Example: ‘instruments’, ‘snapshot’, ‘incremental’.

  • feed (str) – Available only for ‘incremental’ data type. Allowed values: ‘feedA’ or ‘feedB’ Field is not required.

get_data(ticker: str, date: str, data_type: str = 'trades', raw_data: bool = False)[source]

This method provides tick-by-tick market data (trades, book events, book snapshots) for a given ticker and date.

Parameters:
  • ticker (str) – Ticker that needs to be returned. Field is required. Example: ‘DI1F18’.

  • date (str) – Date period. Field is required. Format: ‘YYYY-MM-DD’. Example: ‘2023-07-03’, ‘2023-07-28’.

  • data_type (str) – Market data type. Field is required. Available types: ‘trades’, ‘books’, ‘trades-and-book-events’

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_market_data_channels(date: str)[source]

This method provides all the available market data channels for a given date. For more detailed information about market data channels, please consult our documentation, at https://dataservicesdocs.btgpactualsolutions.com/home > Data Specs > Market Data channel definition.

Parameters:

date (str) – Date period. Field is required. Format: ‘YYYY-MM-DD’. Example: ‘2026-01-30’.

get_security_list(date: str, raw_data: bool = False)[source]

This method returns the security list for a given date.

Parameters:
  • date (str) – Date period. Field is required. Format: ‘YYYY-MM-DD’. Example: ‘2025-05-12’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Default: False.

btgsolutions_dataservices.rest.bulk_data.download_compressed_file(url, headers)[source]

btgsolutions_dataservices.rest.broker_reference module

class btgsolutions_dataservices.rest.broker_reference.BrokerReference(api_key: str | None)[source]

Bases: object

This class provides broker reference information.

  • Main use case:

>>> from btgsolutions_dataservices import BrokerReference
>>> broker_reference = BrokerReference(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> broker_reference.get()
Parameters:

api_key (str) – User identification key. Field is required.

get(raw_data: bool = False)[source]

Returns the full broker reference dataset from the API.

Parameters:

raw_data (bool) – If False, returns the response as a pandas DataFrame. If True, returns the raw JSON payload. Field is not required. Default: False.

Returns:

Broker reference data returned by the API.

Return type:

pandas.DataFrame | dict | list

btgsolutions_dataservices.rest.book_scope module

class btgsolutions_dataservices.rest.book_scope.BookScope(api_key: str | None)[source]

Bases: object

This class provides market scope data (trades, book snapshots, book incremental) for a given symbol and time window.

  • Main use case:

>>> from btgsolutions_dataservices import BookScope
>>> book_scope = BookScope(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> book_scope.get(
>>>     symbol='DOLM26',
>>>     market_type='derivatives',
>>>     start_time='2026-05-28T14:12:00Z',
>>>     end_time='2026-05-28T14:15:00Z',
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get(symbol: str, market_type: str, start_time: str, end_time: str, select: List[str] = ['trades', 'book_snapshot', 'book_incremental'], aggregate_info: bool = False)[source]

Returns trades, book snapshot and book incremental data for the given symbol and time window.

Pagination is handled automatically: if the API returns the maximum number of rows (10 000), additional pages are fetched using the rpt_seq cursor until all events in the requested horizon are retrieved. The caller always receives a single, complete DataFrame per dataset.

Parameters:
  • symbol (str) – The ticker symbol to query. Field is required. Example: ‘PETR4’, ‘DOLM26’.

  • market_type (str) – Market type. Field is required. Allowed values: ‘derivatives’, ‘options’, ‘stocks’.

  • start_time (str) – Start of the analysis window in ISO-8601 UTC format. Field is required. Example: ‘2026-05-28T14:12:00Z’.

  • end_time (str) – End of the analysis window in ISO-8601 UTC format. Field is required. Example: ‘2026-05-28T14:15:00Z’.

  • select (list of str) – Which datasets to return. Field is optional. Default: [‘trades’, ‘book_snapshot’, ‘book_incremental’]. Allowed values: ‘trades’, ‘book_snapshot’, ‘book_incremental’.

  • aggregate_info (bool) – When True, returns a single pandas.DataFrame containing the selected datasets. Field is optional. Default: False.

Returns:

When aggregate_info is False (default): dictionary with the selected keys (‘trades’, ‘book_snapshot’, ‘book_incremental’), each mapping directly to a pandas.DataFrame with all rows for the requested time window. When aggregate_info is True: returns a single pandas.DataFrame with all selected datasets combined.

Return type:

dict or pandas.DataFrame

btgsolutions_dataservices.rest.broker_analytics module

class btgsolutions_dataservices.rest.broker_analytics.BrokerAnalytics(api_key: str, market_type: str)[source]

Bases: object

This class provides broker analytics data (summary, top brokers, top tickers) for a given market type.

  • Main use case:

>>> from btgsolutions_dataservices import BrokerAnalytics
>>> broker_analytics = BrokerAnalytics(
>>>     api_key='YOUR_API_KEY',
>>>     market_type='stocks',
>>> )
>>> broker_analytics.get_summary(
>>>     brokers=['85', '3'],
>>>     tickers=['ABCB4', 'PETR4'],
>>> )
>>> broker_analytics.get_top_brokers(n=10, tickers=['ABCB4'])
>>> broker_analytics.get_top_tickers(n=10, brokers=['85', '3'])
Parameters:
  • api_key (str) – User identification key. Field is required.

  • market_type (str) – Market type to query. One of: ‘derivatives’, ‘stocks’, ‘options’. Field is required.

get_summary(brokers: List[str], tickers: List[str], side: str | None = None) dict[source]

Get day analytics summary for specific brokers and tickers.

Parameters:
  • brokers (List[str]) – List of broker names to filter. Required.

  • tickers (List[str]) – List of ticker symbols to filter. Required.

  • side (str, optional) – Filter by side (‘buy’ or ‘sell’). If None, both sides are returned.

Returns:

JSON response with broker analytics summary data.

Return type:

dict

get_top_brokers(n: int, tickers: List[str] | None = None, side: str | None = None) dict[source]

Get top N brokers ranked by financial volume, with ticker breakdown.

Parameters:
  • n (int) – Number of top brokers to return. Required.

  • tickers (List[str], optional) – List of ticker symbols to filter.

  • side (str, optional) – Filter by side (‘buy’ or ‘sell’).

Returns:

JSON response with top brokers and their top assets breakdown.

Return type:

dict

get_top_tickers(n: int, brokers: List[str] | None = None, side: str | None = None) dict[source]

Get top N tickers ranked by financial volume, with broker breakdown.

Parameters:
  • n (int) – Number of top tickers to return. Required.

  • brokers (List[str], optional) – List of broker names to filter.

  • side (str, optional) – Filter by side (‘buy’ or ‘sell’).

Returns:

JSON response with top tickers and their top brokers breakdown.

Return type:

dict

btgsolutions_dataservices.rest.company_data module

class btgsolutions_dataservices.rest.company_data.CompanyData(api_key: str | None)[source]

Bases: object

This class provides company general information and fundamentalist data.

  • Main use case:

>>> from btgsolutions_dataservices import CompanyData
>>> company_data = CompanyData(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> company_data.general_info(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.income_statement(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.balance_sheet(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.cash_flow(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.valuation(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.ratios(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.growth(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.interims(
>>>     ticker = 'PETR4'
>>> )
>>> company_data.all_financial_tables(
>>>     ticker = 'PETR4'
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

all_financial_tables(ticker: str, raw_data: bool = False)[source]

This method returns all available financial tables (such as Valuation, Income Statement, Cash Flow) for the requested company ticker.

Parameters:
  • ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

  • raw_data (bool) – If false, returns financial tables in dataframes. If true, returns raw data. Field is not required. Default: False.

balance_sheet(ticker: str)[source]

This method returns the company Balance Sheet.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

cash_flow(ticker: str)[source]

This method returns the company Cash Flow.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

general_info(ticker: str, raw_data: bool = False)[source]

This method returns company general information such as name, ticker, sector, description.

Parameters:
  • ticker (str) – Company ticker symbol. Field is required. Example: ‘PETR4’.

  • raw_data (bool) – If false, returns financial tables in dataframes. If true, returns raw data. Field is not required. Default: False.

growth(ticker: str)[source]

This method returns the company Growth.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

income_statement(ticker: str)[source]

This method returns the company Income Statement.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

interims(ticker: str)[source]

This method returns the company Interims.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

ratios(ticker: str)[source]

This method returns the company Ratios.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

valuation(ticker: str)[source]

This method returns the company Valuation.

Parameters:

ticker (str) – Company ticker symbol. Field is required. Example: “PETR4”. The ticker radical is also allowed. Example: “PETR”.

btgsolutions_dataservices.rest.company_data.process_financial_table(financial_table_content: list)[source]

btgsolutions_dataservices.rest.corporate_events module

class btgsolutions_dataservices.rest.corporate_events.CorporateEvents(api_key: str | None)[source]

Bases: object

This class provides the market data corporate events

  • Main use case:

>>> from btgsolutions_dataservices import CorporateEvents
>>> corporate_events = CorporateEvents(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> corporate_events.get(
>>>     start_date = '2024-05-10',
>>>     end_date = '2024-05-31',
>>>     tickers = ['PETR4']
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get(start_date: str, end_date: str, tickers: List[str] = [], raw_data: bool = False)[source]

This method uses corporate events filtered by a range of dates (ex_date) and a list of tickers

Parameters:
  • start_date (string<date>) – Lower bound for corporate events. Filtering by ex_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • end_date (string<date>) – Upper bound for corporate events. Filtering by ex_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • ticker (List[str]) – List of tickers. Field is not required. Example: [‘PETR4’, ‘VALE3’]. Default: [].

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.hfn module

class btgsolutions_dataservices.rest.hfn.HighFrequencyNews(api_key: str | None)[source]

Bases: object

This class provides latest and historical news through the HFN API, with rich filtering by feed, source, language, tags, categories and free text.

  • Main use case:

>>> from btgsolutions_dataservices import HighFrequencyNews
>>> hfn = HighFrequencyNews(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> latest = hfn.get_latest_news(
>>>     feed='economy',
>>>     limit=10,
>>> )
>>> petro_news = hfn.get_latest_news(
>>>     tags=['PETR4'],
>>>     text_language='portuguese',
>>> )
>>> historical = hfn.get_historical_news(
>>>     start_date='2025-01-01T00:00:00.000Z',
>>>     end_date='2025-01-01T23:59:59.999Z',
>>>     feed='economy',
>>> )
>>> filters = hfn.get_available_filters()
Parameters:

api_key (str) – User identification key. Field is required.

get_available_filters(countries: List[str] | None = None, sources: List[str] | None = None, source_types: List[str] | None = None, feeds: List[str] | None = None, text_languages: List[str] | None = None)[source]

Retrieve available filter values for the Latest News and Historical News endpoints. Returns available countries, source types, sources, feeds and text languages. All parameters are optional and can be used to narrow down the results.

Parameters:
  • countries (list of str) – Filter the available results by one or more country codes. Matches any provided value. Example: [‘BR’]. Field is not required.

  • sources (list of str) – Filter the available results by one or more source names. Matches any provided value. Example: [‘Bloomberg - Markets’]. Field is not required.

  • source_types (list of str) – Filter the available results by one or more source types. Matches any provided value. Accepted values: ‘rss’, ‘html’, ‘pdf’. Field is not required.

  • feeds (list of str) – Filter the available results by one or more feeds. Matches any provided value. Example: [‘economy’, ‘crypto’]. Field is not required.

  • text_languages (list of str) – Filter the available results by one or more text languages. Matches any provided value. Accepted values: ‘portuguese’, ‘english’, ‘spanish’, ‘german’, ‘french’. Field is not required.

get_historical_news(countries: List[str] | None = None, source_type: str | None = None, source: str | None = None, feed: str | None = None, text_language: str | None = None, tags: List[str] | None = None, start_date: str | None = None, end_date: str | None = None, limit: int | None = None, categories: List[str] | None = None, text: str | None = None, raw_data: bool = False)[source]

Provide a datetime interval and get all news registered in that interval. All filter parameters are optional and can be combined freely.

Parameters:
  • countries (list of str) – Filter results by one or more country codes. Matches any provided value. Example: [‘BR’], [‘BR’, ‘US’]. Field is not required.

  • source_type (str) – Filter results by ingestion source type. Accepted values: ‘rss’, ‘html’, ‘pdf’. Field is not required.

  • source (str) – Filter results by a specific news source name. Example: ‘Infomoney’, ‘Exame - Mercado’. Field is not required.

  • feed (str) – Filter results by thematic feed category. Accepted values: ‘politics’, ‘economy’, ‘crypto’, ‘technology’, ‘sports’, ‘health’, ‘commodities’, ‘energy’, ‘general’. Field is not required.

  • text_language (str) – Filter results by the language of the news content. Accepted values: ‘portuguese’, ‘english’, ‘spanish’, ‘german’, ‘french’. Field is not required.

  • tags (list of str) – Filter results by one or more tags (ticker symbols, index names, etc.). Matches any provided value. Example: [‘PETR4’], [‘PETR4’, ‘VALE3’]. Field is not required.

  • start_date (str) – Lower bound for news publishing time. Accepted formats: ISO 8601 date-time (YYYY-MM-DDTHH:MM:SS.sssZ) or date (YYYY-MM-DD). Example: ‘2026-03-13T00:00:00.000Z’. Field is not required.

  • end_date (str) – Upper bound for news publishing time. Accepted formats: ISO 8601 date-time (YYYY-MM-DDTHH:MM:SS.sssZ) or date (YYYY-MM-DD). Example: ‘2026-03-13T23:59:59.999Z’. Field is not required.

  • limit (int) – Maximum number of news items to return. Example: 100. Field is not required.

  • categories (list of str) – Filter results by one or more category keywords extracted from news content. Matches any provided value. Example: [‘Petrobras’], [‘Bitcoin’, ‘Ethereum’]. Field is not required.

  • text (str) – Free text search within news title and body. Example: ‘trump ira’, ‘taxa selic’. Field is not required.

  • raw_data (bool) – If True, returns raw data from API, if False, returns a Pandas DataFrame. Default: False. Field is not required.

get_latest_news(countries: List[str] | None = None, source_type: str | None = None, source: str | None = None, feed: str | None = None, text_language: str | None = None, tags: List[str] | None = None, start_date: str | None = None, end_date: str | None = None, limit: int | None = None, categories: List[str] | None = None, text: str | None = None, raw_data: bool = False)[source]

Most recent news captured by the HFN Engine. By default returns the latest 20 news (max 5000 with limit). All filter parameters are optional and can be combined freely.

Parameters:
  • countries (list of str) – Filter results by one or more country codes. Matches any provided value. Example: [‘BR’], [‘BR’, ‘US’]. Field is not required.

  • source_type (str) – Filter results by ingestion source type. Accepted values: ‘rss’, ‘html’, ‘pdf’. Field is not required.

  • source (str) – Filter results by a specific news source name. Example: ‘Infomoney’, ‘Exame - Mercado’. Field is not required.

  • feed (str) – Filter results by thematic feed category. Accepted values: ‘politics’, ‘economy’, ‘crypto’, ‘technology’, ‘sports’, ‘health’, ‘commodities’, ‘energy’, ‘general’. Field is not required.

  • text_language (str) – Filter results by the language of the news content. Accepted values: ‘portuguese’, ‘english’, ‘spanish’, ‘german’, ‘french’. Field is not required.

  • tags (list of str) – Filter results by one or more tags (ticker symbols, index names, etc.). Matches any provided value, including substrings. Example: [‘PETR4’], [‘PETR4’, ‘VALE3’]. Field is not required.

  • start_date (str) – Lower bound for news publishing time. Accepted formats: ISO 8601 date-time (YYYY-MM-DDTHH:MM:SS.sssZ) or date (YYYY-MM-DD). Example: ‘2026-03-13T00:00:00.000Z’. Field is not required.

  • end_date (str) – Upper bound for news publishing time. Accepted formats: ISO 8601 date-time (YYYY-MM-DDTHH:MM:SS.sssZ) or date (YYYY-MM-DD). Example: ‘2026-03-13T23:59:59.999Z’. Field is not required.

  • limit (int) – Maximum number of news items to return (max 5000). Example: 100. Field is not required.

  • categories (list of str) – Filter results by one or more category keywords extracted from news content. Matches any provided value, including substrings. Example: [‘Petrobras’], [‘Bitcoin’, ‘Ethereum’]. Field is not required.

  • text (str) – Free text search within news title and body. Example: ‘trump ira’, ‘taxa selic’. Field is not required.

  • raw_data (bool) – If True, returns raw data from API, if False, returns a Pandas DataFrame. Default: False. Field is not required.

btgsolutions_dataservices.rest.historical_candles module

class btgsolutions_dataservices.rest.historical_candles.HistoricalCandles(api_key: str | None)[source]

Bases: object

This class provides historical candles for a given ticker or all tickers available for query.

  • Main use case - Interday:

>>> from btgsolutions_dataservices import HistoricalCandles
>>> hist_candles = HistoricalCandles(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> hist_candles.get_interday_history_candles(
>>>     ticker = 'PETR4',
>>>     market_type = 'stocks',
>>>     corporate_events_adj = True,
>>>     start_date = '2023-10-11',
>>>     end_date = '2023-10-20',
>>>     rmv_after_market = True,
>>>     timezone = 'UTC',
>>>     round = True,
>>>     raw_data = False
>>> )
  • Main use case - Intraday:

>>> hist_candles.get_intraday_history_candles(
>>>     ticker = 'PETR4',
>>>     market_type = 'stocks',
>>>     corporate_events_adj = True,
>>>     date = '2023-10-20',
>>>     rmv_after_market = True,
>>>     timezone = 'UTC',
>>>     candle='1m',
>>>     round = True,
>>>     raw_data = False
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(market_type: str, date: str)[source]

This method provides all tickers available for query.

Parameters:
  • market_type (str) – Market type. Options: ‘stocks’, ‘derivatives’ or ‘indices’. Field is required.

  • date (string<date>) – Date of requested data. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

get_interday_history_candles(market_type: str, ticker: str, start_date: str, end_date: str, corporate_events_adj: bool, rmv_after_market: bool, timezone: str, raw_data: bool = False, round: bool = True)[source]

This method provides historical candles for a given ticket in determined period.

Parameters:
  • market_type (str) – Field is required. Allowed values: ‘stocks’, ‘derivatives’ or ‘indices’.

  • ticker (str) – Ticker that needs to be returned. Field is required. Example: ‘PETR4’.

  • start_date (string<date>) – Start date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2022-10-06’.

  • end_date (string<date>) – End date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-01-22’.

  • corporate_events_adj (bool) – Corporate events adjustment. Field is required. Allowed values: ‘true’ or ‘false’.

  • rmv_after_market (bool) – Remove trades after market close. Field is required. Allowed values: ‘true’ or ‘false’.

  • timezone (str) – Timezone of the datetime. Field is required. Allowed values: ‘America/Sao_Paulo’ or ‘UTC’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

  • round (bool) – Apply rounding to prices. Useful when corporate_events_adj=True, since price adjustment factors may generate values with many decimal places. Field is not required. Default: True.

get_interday_history_candles_batch(market_type: str, tickers: list, start_date: str, end_date: str, corporate_events_adj: bool, rmv_after_market: bool, timezone: str, raw_data: bool = False, round: bool = True)[source]

This method provides historical candles for a batch of tickers in determined period.

Parameters:
  • market_type (str) – Field is required. Allowed values: ‘stocks’ or ‘derivatives’.

  • tickers (list) – Tickers that need to be returned. Field is required. Example: [‘PETR4’, ‘VALE3’].

  • start_date (string<date>) – Start date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2022-10-06’.

  • end_date (string<date>) – End date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-01-22’.

  • corporate_events_adj (bool) – Corporate events adjustment. Field is required. Allowed values: ‘true’ or ‘false’.

  • rmv_after_market (bool) – Remove trades after market close. Field is required. Allowed values: ‘true’ or ‘false’.

  • timezone (str) – Timezone of the datetime. Field is required. Allowed values: ‘America/Sao_Paulo’ or ‘UTC’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

  • round (bool) – Apply rounding to prices. Useful when corporate_events_adj=True, since price adjustment factors may generate values with many decimal places. Field is not required. Default: True.

get_intraday_history_candles(market_type: str, ticker: str, date: str, candle: str, corporate_events_adj: bool, rmv_after_market: bool, timezone: str, raw_data: bool = False, round: bool = True)[source]

This method provides historical candles for a given ticket in determined period.

Parameters:
  • market_type (str) – Field is required. Allowed values: ‘stocks’, ‘derivatives’ or ‘indices’.

  • ticker (str) – Ticker that needs to be returned. Field is required. Example: ‘PETR4’.

  • date (string<date>) – Date of requested data. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • candle (str) – Candle period. Field is required. Allowed values: ‘1s’, ‘1m’, ‘5m’, ‘15m’, ‘30m’ or ‘1h’.

  • corporate_events_adj (bool) – Corporate events adjustment. Field is required. Allowed values: ‘true’ or ‘false’.

  • rmv_after_market (bool) – Remove trades after market close. Field is required. Allowed values: ‘true’ or ‘false’.

  • timezone (str) – Timezone of the datetime. Field is required. Allowed values: ‘America/Sao_Paulo’ or ‘UTC’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

  • round (bool) – Apply rounding to prices. Useful when corporate_events_adj=True, since price adjustment factors may generate values with many decimal places. Field is not required. Default: True.

btgsolutions_dataservices.rest.historical_candles_crypto module

class btgsolutions_dataservices.rest.historical_candles_crypto.HistoricalCandlesCrypto(api_key: str | None)[source]

Bases: object

This class provides historical candles for cryptocurrencies.

Available tickers: ETH, SOL, BTC Available exchanges: coinbase, mercado_bitcoin, consolidated Available currencies: BRL, USD Available candles: ‘1s’, ’30s’, ‘1m’, ‘5m’, ‘15m’, ‘30m’, ‘1h’

  • Main use case - Interday:

>>> from btgsolutions_dataservices import HistoricalCandlesCrypto
>>> hist_candles = HistoricalCandlesCrypto(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> hist_candles.get_interday_history_candles(
>>>     ticker = 'BTC',
>>>     currency = 'BRL',
>>>     exchange = 'consolidated',
>>>     start_date = '2025-06-01',
>>>     end_date = '2025-07-01',
>>>     timezone = 'UTC',
>>>     raw_data = False
>>> )
  • Main use case - Intraday:

>>> hist_candles.get_intraday_history_candles(
>>>     ticker = 'BTC',
>>>     currency = 'BRL',
>>>     exchange = 'consolidated',
>>>     date = '2025-06-01',
>>>     timezone = 'America/Sao_Paulo',
>>>     candle='1h',
>>>     raw_data = False
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(exchange: str, date: str)[source]

This method provides all cryptocurrency tickers available for query.

Parameters:
  • exchange (str) – Exchange name. Field is required. Allowed values: ‘coinbase’, ‘mercado_bitcoin’, ‘consolidated’.

  • date (string<date>) – Date of requested data. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-01-13’.

get_interday_history_candles(ticker: str, currency: str, exchange: str, start_date: str, end_date: str, timezone: str, raw_data: bool = False)[source]

This method provides historical daily candles for cryptocurrencies.

Parameters:
  • ticker (str) – Cryptocurrency ticker. Field is required. Allowed values: ‘BTC’, ‘ETH’, ‘SOL’.

  • currency (str) – Currency for the prices. Field is required. Allowed values: ‘BRL’ or ‘USD’.

  • exchange (str) – Exchange name. Field is required. Allowed values: ‘coinbase’, ‘mercado_bitcoin’, ‘consolidated’.

  • start_date (string<date>) – Start date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2025-06-01’.

  • end_date (string<date>) – End date of analysis. Format: “YYYY-MM-DD”. Field is required. Example: ‘2025-07-01’.

  • timezone (str) – Timezone of the datetime. Field is required. Allowed values: ‘America/Sao_Paulo’ or ‘UTC’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_intraday_history_candles(ticker: str, currency: str, exchange: str, date: str, candle: str, timezone: str, raw_data: bool = False)[source]

This method provides historical intraday candles for cryptocurrencies.

Parameters:
  • ticker (str) – Cryptocurrency ticker. Field is required. Allowed values: ‘BTC’, ‘ETH’, ‘SOL’.

  • currency (str) – Currency for the prices. Field is required. Allowed values: ‘BRL’ or ‘USD’.

  • exchange (str) – Exchange name. Field is required. Allowed values: ‘coinbase’, ‘mercado_bitcoin’, ‘consolidated’.

  • date (string<date>) – Date of requested data. Format: “YYYY-MM-DD”. Field is required. Example: ‘2025-06-01’.

  • candle (str) – Candle period. Field is required. Allowed values: ‘1s’, ’30s’, ‘1m’, ‘5m’, ‘15m’, ‘30m’, ‘1h’.

  • timezone (str) – Timezone of the datetime. Field is required. Allowed values: ‘America/Sao_Paulo’ or ‘UTC’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.intraday_candles module

class btgsolutions_dataservices.rest.intraday_candles.IntradayCandles(api_key: str | None)[source]

Bases: object

This class provides realtime intraday candles for a given ticker or all tickers available for query.

  • Main use case:

>>> from btgsolutions_dataservices import IntradayCandles
>>> intraday_candles = IntradayCandles(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> candles = intraday_candles.get_intraday_candles(
>>>     market_type = 'stocks',
>>>     tickers = ['PETR4', 'ABEV3'],
>>>     candle_period = '1m',
>>>     delay='delayed',
>>>     mode='absolute',
>>>     timezone='UTC',
>>>     raw_data=False
>>> )
>>> PETR4 = candles.get('PETR4')
>>> ABEV3 = candles.get('ABEV3')
>>> intraday_candles.get_available_tickers(
>>>     market_type='stocks',
>>>     delay='delayed'
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(market_type: str, delay: str)[source]

This method provides all tickers available for query.

Parameters:
  • market_type (str) – Market type. Options: ‘stocks’, ‘derivatives’ or ‘options’. Field is required.

  • delay (str) – Data delay. Options: ‘delayed’ or ‘realtime’. Field is required.

get_intraday_candles(market_type: str, tickers: list, delay: str, timezone: str, candle_period: str, start: int = 0, end: int = 0, mode: str = 'absolute', raw_data: bool = False, cross_filter: str = '', market_status: str = '')[source]

This method provides realtime intraday candles for a given ticker.

Parameters:
  • market_type (str) – Market type. Options: ‘stocks’, ‘derivatives’, ‘options’ or ‘indices’. Field is required.

  • tickers (list of str) – Tickers that needs to be returned. Example: [‘PETR4’, ‘ABEV3’] Field is required.

  • delay (str) – Data delay. Options: ‘delayed’ or ‘realtime’. Field is required.

  • timezone (str) – Timezone of the datetime. Options: ‘America/Sao_Paulo’ or ‘UTC’. Field is required.

  • candle_period (str) – Grouping interval. Example: ‘1m’, ‘5m’, ‘30m’, ‘1h’ or ‘1d’. Field is required.

  • start (int) – Start date (in Unix timestamp format).

  • end (int) – End date (in Unix timestamp format)

  • mode (str) – Candle mode. Example: ‘absolute’, ‘relative’ or ‘spark’. Default: absolute.

  • cross_filter (str) – Filter trades by cross status. Options: ‘all’, ‘only_cross’ or ‘without_cross’. Default: ‘all’.

  • market_status (str) – Filter trades by market status. Not available for ‘Indices’. Options: ‘all’ or ‘regular’. Default: ‘all’.

  • raw_data (bool) – If false, returns data in a dict of dataframes. If true, returns raw data. Default: False.

btgsolutions_dataservices.rest.intraday_tick_data module

class btgsolutions_dataservices.rest.intraday_tick_data.IntradayTickData(api_key: str | None)[source]

Bases: object

This class provides tick-by-tick market data from the current day, for the provided ticker

  • Main use case:

>>> from btgsolutions_dataservices import IntradayTickData
>>> tick_data = IntradayTickData(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> tick_data.get_trades(
>>>     ticker = 'PETR4',
>>>     raw_data = False
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_trades(ticker: str, start: str = None, end: str = None, raw_data: bool = False)[source]

This method provides tick-by-tick trade data from the current day, for the provided ticker.

Parameters:
  • ticker (str) – Ticker symbol. Field is required. Example: ‘PETR4’.

  • start (str) – Query start datetime, in ISO string format (UTC). Field is required. Examples: ‘2025-02-11’, ‘2025-02-11T17:40:00.000Z’.

  • end (str) – Query end datetime, in ISO string format (UTC). Field is required. Examples: ‘2025-02-12’, ‘2025-02-11T18:10:00.000Z’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.public_sources module

class btgsolutions_dataservices.rest.public_sources.PublicSources(api_key: str)[source]

Bases: object

This class provides data from public sources

  • Main use case:

>>> from btgsolutions_dataservices import PublicSources
>>> public_sources = PublicSources(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> public_sources.get_opas(
>>>     start_date = '2024-05-10',
>>>     end_date = '2024-05-31'
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_opas(start_date: str, end_date: str, asset: str | None = None, type: str | None = None, raw_data: bool = False)[source]

This method uses OPAs filtered by a range of dates (registration_date), asset or type.

Parameters:
  • start_date (string<date>) – Lower bound for OPAS. Filtering by registration_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • end_date (string<date>) – Upper bound for OPAS. Filtering by registration_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • asset (str) – Ticker asset. Field is not required. Example: VALE. Default: None.

  • type (str) – Filtering by OPA type Field is not required. Example: VOLUNTARIO. Default: None.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_share_repurchase(start_date: str, end_date: str, asset: str | None = None, raw_data: bool = False)[source]

This method returns a list of share repurchase transactions filtered by period (reference_date) and/or asset.

Parameters:
  • start_date (string<date>) – Lower bound. Filtering by reference_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • end_date (string<date>) – Upper bound. Filtering by reference_date. Format: “YYYY-MM-DD”. Field is required. Example: ‘2023-10-06’.

  • asset (str) – Ticker asset. Field is not required. Example: VALE. Default: None.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.quotes module

class btgsolutions_dataservices.rest.quotes.Quotes(api_key: str | None)[source]

Bases: object

This class provides ticker quote information and quotes sorted by top-bottom quote variation, filtered by ticker market type.

  • Main use case:

>>> from btgsolutions_dataservices import Quotes
>>> quotes = Quotes(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> quotes.get_quote(
>>>     market_type = 'stocks',
>>>     tickers = ['PETR4', 'VALE3'],
>>> )
>>> quotes.get_top_bottom(
>>>     market_type = 'stocks',
>>>     ticker_type = 'IBOV',
>>> )
>>> quotes.get_available_tickers(market_type="stocks")
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(market_type: str, mode: str = 'realtime')[source]

This method provides all tickers available for query, for the provided market type.

Parameters:
  • market_type (str) – Market type. Field is required. Example: ‘stocks’, ‘options’, ‘derivatives’, ‘indices’.

  • mode (str) – Realtime or 15-minutes delayed. Field is not required. Example: ‘realtime’ or ‘delayed’. Default: ‘realtime’.

get_quote(tickers: list, market_type: str, mode: str = 'realtime', raw_data: bool = False)[source]

This method provides realtime and delayed quote information for a given ticker.

Parameters:
  • tickers (list) – List of tickers that needs to be returned. Field is required. Example: [‘VALE3’], [‘PETR4’, ‘PRIO3’].

  • market_type (str) – Market type. Field is required. Example: ‘stocks’, ‘options’, ‘derivatives’, ‘indices’.

  • mode (str) – Realtime or 15-minutes delayed. Field is required. Example: ‘realtime’ or ‘delayed’. Default: ‘realtime’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_top_bottom(market_type: str, mode: str = 'realtime', ticker_type: str = 'IBOV', variation: str = 'interday', n: int = 5, raw_data: bool = False)[source]

This method provides realtime and delayed quotes sorted by top-bottom quote variation, filtered by ticker market type.

Parameters:
  • market_type (str) – Market type. Field is required. Example: ‘stocks’, ‘options’, ‘derivatives’, ‘indices’.

  • mode (str) – Realtime or 15-minutes delayed. Field is not required. Example: ‘realtime’ or ‘delayed’. Default: ‘realtime’.

  • ticker_type (str) – Type of tickers to be returned. Field is not required. Example: ‘SHARE’, ‘BDR’, ‘FII’, ‘ETF’, ‘UNIT’, ‘IBOV’. Default: ‘IBOV’.

  • variation (str) – Choose between intraday or interday quotes. Field is not required. Example: ‘interday’ or ‘intraday’. Default: ‘interday’.

  • n (int) – Top-N tickers to be returned. Field is not required. Default: 5.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.reference_data module

class btgsolutions_dataservices.rest.reference_data.ReferenceData(api_key: str | None)[source]

Bases: object

This class provides market reference data, such as ticker info, broker codes, index composition, etc.

  • Main use case:

>>> from btgsolutions_dataservices import ReferenceData
>>> ref = ReferenceData(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> ref.ticker_reference(
>>>     tickers = ['PETR4', 'VALE3']
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

ticker_reference(tickers: List[str], raw_data: bool = False)[source]

This method provides ticker reference data from current day, such as SecurityId, Currency, MinLotSize, MinTickSize, etc.

Parameters:
  • tickers (List[str]) – List of tickers. Field is required. Example: [‘PETR4’, ‘VALE3’].

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.stock_loan module

class btgsolutions_dataservices.rest.stock_loan.StockLoan(api_key: str | None)[source]

Bases: object

This class provides trades related to stock loan operations.

  • Main use case:

>>> from btgsolutions_dataservices import StockLoan
>>> stock_loan = StockLoan(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> trades = stock_loan.get_trades(
>>>     ticker = 'PETR4'
>>> )
>>> trades = stock_loan.get_paginated_trades(
>>>     page = 1,
>>>     limit = 1000
>>> )
>>> stock_loan.get_available_tickers()
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers()[source]

This method provides all tickers available for query.

get_paginated_trades(page: int, limit: int, ticker: str | None = '')[source]

Returns paginated trades related to stock loan operations.

Parameters:
  • ticker (str, optional) – The ticker symbol to be returned. Example: ‘PETR4’

  • page (int) – Page number for paginated results. Example: 1

  • limit (int) – Maximum number of items to return per page. Example: 1000

get_trades(ticker: str | None = '')[source]

Returns trades related to stock loan operations.

Parameters:

ticker (str, optional) – The ticker symbol to be returned. Example: ‘PETR4’

btgsolutions_dataservices.rest.ticker_last_event module

class btgsolutions_dataservices.rest.ticker_last_event.TickerLastEvent(api_key: str | None)[source]

Bases: object

This class provides the last market data event available, for the provided ticker

  • Main use case:

>>> from btgsolutions_dataservices import TickerLastEvent
>>> last_event = TickerLastEvent(
>>>     api_key='YOUR_API_KEY',
>>> )
>>> last_event.get_trades(
>>>     data_type = 'equities',
>>>     ticker = 'PETR4',
>>>     raw_data = False
>>> )
>>> last_event.get_tob(
>>>     data_type = 'derivatives',
>>>     raw_data = False
>>> )
Parameters:

api_key (str) – User identification key. Field is required.

get_available_tickers(type: str, data_type: str)[source]

This method provides all the available tickers for the specific data type.

Parameters:
  • type (str) – Data Type. Field is required. Example: ‘trades’, ‘books’

  • data_type (str) – Market Data Type. Field is required. Example: ‘equities’, ‘derivatives’.

get_status(tickers: List[str] = None, raw_data: bool = False)[source]

This method provides the current ticker trading status information.

Parameters:
  • tickers (List[str]) – Ticker symbol. Field is not required. Default: None Example: [‘PETR4’, ‘VALE3’, ‘DOLM25’]. If no ticker is provided, it returns trading status information for all available tickers.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_tobs(data_type: str, raw_data: bool = False)[source]

This method provides the last available top of book for all tickers of the given market type.

Parameters:
  • data_type (str) – Market Data Type. Field is required. Example: ‘equities’, ‘derivatives’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_trades(data_type: str, ticker: str, raw_data: bool = False)[source]

This method provides the last market data event available, for the provided ticker.

Parameters:
  • data_type (str) – Market Data Type. Field is required. Example: ‘equities’, ‘derivatives’.

  • ticker (str) – Ticker symbol. Field is required. Example: ‘PETR4’.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

btgsolutions_dataservices.rest.ticker_last_event_polling module

class btgsolutions_dataservices.rest.ticker_last_event_polling.TickerLastEventPolling(api_key: str | None, data_type: str, data_subtype: str, interval_seconds: float | None = None)[source]

Bases: object

This class continuously polls and caches the latest ticker market data in the background for quick and up-to-date access.

  • Main use case:

>>> from btgsolutions_dataservices import TickerLastEventPolling
>>> last_event = TickerLastEventPolling(
>>>     api_key='YOUR_API_KEY',
>>>     data_type='top-of-books',
>>>     data_subtype='stocks',
>>> )
>>> last_event.get(
>>>     raw_data=False
>>> )
Parameters:
  • api_key (str) – User identification key. Field is required.

  • data_type (str) – Market Data type. Options: ‘top-of-books’, ‘snapshot-tob’. Field is required.

  • data_subtype (str) – Market Data subtype. Options: ‘stocks’, ‘options’, ‘derivatives’, ‘equities’. Field is required.

get(force_update: bool = False, raw_data: bool = False)[source]

This method provides the last events for all tickers of the given data type and data subtype.

Parameters:
  • force_update (bool) – If true, forces an update before returning the data. If false, returns the data. Field is not required. Default: False.

  • raw_data (bool) – If false, returns data in a dataframe. If true, returns raw data. Field is not required. Default: False.

get_available_tickers()[source]

This method provides all the available tickers for the specific data type and data subtype.

Module contents