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 DISCLAIMERcnbc 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c06530ee2b9b8a86a41d9499cf820def515a9f11e6a4e1e7bf2fade068f1182
|
|
| MD5 |
ed031718b2289aa0bb48a8019c9d39b3
|
|
| BLAKE2b-256 |
6b070f047427a07ad24bdc77393741491d6f5f0c331bf2241930df06a0544402
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59843dbc500441a14a7e7a60ff129d6ed0a147d60d579a0999e64b42e2ca6b22
|
|
| MD5 |
faf69d0046bb319dffc4d659b7864917
|
|
| BLAKE2b-256 |
a4815808c29a5cdf893eef07ddcfa756c123eae21dea84b51cef95f6862732e0
|