Skip to main content

A Python package that wraps CNBC API endpoints and returns financial data in JSON.

Project description

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.

IMPORTANT LEGAL DISCLAIMER


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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cnbc-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cnbc-1.0.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file cnbc-1.0.0.tar.gz.

File metadata

  • Download URL: cnbc-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for cnbc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5c06530ee2b9b8a86a41d9499cf820def515a9f11e6a4e1e7bf2fade068f1182
MD5 ed031718b2289aa0bb48a8019c9d39b3
BLAKE2b-256 6b070f047427a07ad24bdc77393741491d6f5f0c331bf2241930df06a0544402

See more details on using hashes here.

File details

Details for the file cnbc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cnbc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for cnbc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59843dbc500441a14a7e7a60ff129d6ed0a147d60d579a0999e64b42e2ca6b22
MD5 faf69d0046bb319dffc4d659b7864917
BLAKE2b-256 a4815808c29a5cdf893eef07ddcfa756c123eae21dea84b51cef95f6862732e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page