Skip to main content

CNBC

A Python package that wraps CNBC API endpoints and returns financial data in JSON. The API queries business news and live market data to streamline the development of financial applications.


cnbc is not affiliated, endorsed, or vetted by CNBC, Inc. It is an open-source tool that uses a publicly available API and is intended for research and educational purposes.

Installation

pip install cnbc

Subscribe to CNBC API

Utilization

APIWrapper

The APIWrapper class is used to make requests to the CNBC API.
Note: A majority of the CNBC API endpoints require parameters. These must be set by an additional instruction.

from cnbc import APIWrapper, Endpoints

api_wrapper = APIWrapper(
    api_key='YOUR_API_KEY',
    endpoint=Endpoints.TRANSLATE
)
# The APIWrapper class will supply the required parameters for the configured CNBC API endpoint.
api_wrapper_params = api_wrapper.params
api_wrapper_params['symbol'] = 'AAPL'
# The APIWrapper class will make a request to the CNBC API and return the response in JSON.
json_response = api_wrapper.request()

# The APIWrapper class can be repurposed to make multiple requests to the CNBC API.
api_wrapper.endpoint = Endpoints.GET_SUMMARY
api_wrapper_params = api_wrapper.params
api_wrapper_params['issueIds'] = json_response['issueId']
json_response = api_wrapper.request()

Translate Endpoint

A majority of the CNBC API endpoints require an issueId or issueIds parameter. The translate endpoint is used to convert a symbol to an issueId.
Note: The APIWrapper class contains a translation table which can be loaded and saved to a file to reduce the number of requests to the CNBC API.

Metadata

Release files for cnbc 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cnbc 1.0.0
File Size Uploaded
cnbc-1.0.0.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cnbc 1.0.0
File Interpreter ABI Platform
cnbc-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.1 kB

Release files / cnbc-1.0.0.tar.gz

Download URL cnbc-1.0.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5c06530ee2b9b8a86a41d9499cf820def515a9f11e6a4e1e7bf2fade068f1182
BLAKE2b-256 checksum
How to use checksums
6b070f047427a07ad24bdc77393741491d6f5f0c331bf2241930df06a0544402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.0

Release files / cnbc-1.0.0-py3-none-any.whl

Download URL cnbc-1.0.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59843dbc500441a14a7e7a60ff129d6ed0a147d60d579a0999e64b42e2ca6b22
BLAKE2b-256 checksum
How to use checksums
a4815808c29a5cdf893eef07ddcfa756c123eae21dea84b51cef95f6862732e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page