Skip to main content

Finazon gRPC client library for Python

Project description

Finazon Python gRPC Client

This is the official Python library for Finazon, offering access to:

  • Lists of datasets, publishers, markets, and tickers.
  • Market data: ticker snapshots, time series, trades, and technical indicators.
  • Data from specific datasets such as Benzinga, Binance, Crypto, Forex, SEC, and SIP.

🔑 API key is essential. If you haven't got one yet, sign up here.

Requirements

Ensure you have Python 3.8 or later.

Installation

Use the package manager pip to install Finazon Python gRPC Client library:

pip install finazon-grpc-python

Or use poetry package manager to add Finazon Python gRPC Client library to your project:

poetry add finazon-grpc-python

🔗 View the package on PyPI.

Updating to last version

Using pip:

pip install -U finazon-grpc-python

Using poetry:

poetry add finazon-grpc-python@latest

Quick start

1. Create project virtual environment (venv)

mkdir hello-finazon && cd hello-finazon
python3 -m venv .venv

Activate venv (Linux/MacOS)

source .venv/bin/activate

Activate venv (Windows cmd.exe)

<full_path_to_project>\.venv\Scripts\activate.bat

More information about Python virtual environments can be found here

2. Install package

pip install finazon-grpc-python

3. Create time_series.py script

import logging
import grpc
from finazon_grpc_python.time_series_pb2_grpc import TimeSeriesServiceStub
from finazon_grpc_python.time_series_pb2 import GetTimeSeriesRequest, GetTimeSeriesResponse


api_url = 'grpc-latest.finazon.io:443'
api_token = 'your_api_key'

# Setup gRPC credentials
call_credentials = grpc.access_token_call_credentials(api_token)
channel_credentials = grpc.ssl_channel_credentials()
credentials = grpc.composite_channel_credentials(channel_credentials, call_credentials)

try:
    # Open gRPC channel and call method
    with grpc.secure_channel(api_url, credentials=credentials) as channel:
        stub = TimeSeriesServiceStub(channel)
        request = GetTimeSeriesRequest(ticker="AAPL", dataset="sip_non_pro")
        response: GetTimeSeriesResponse = stub.GetTimeSeries(request)

        # Iterate over time series response result
        for item in response.result:
            print(item)
# Catch gRPC exceptions
except grpc.RpcError as e:
    if e.code() == grpc.StatusCode.UNAUTHENTICATED:
        logging.error('Invalid API key was provided')
    else:
        logging.error(f'gRPC exception: {e}')

4. Input your API key

Replace 'your_api_key' with your actual key.

5. Run script

python3 time_series.py

📝 Expected output:

timestamp: 1698955140
open: 177.57
close: 177.57
high: 177.78
low: 177.55
volume: 8330379

timestamp: 1698955080
open: 177.58
close: 177.572
high: 177.605
low: 177.5317
volume: 398134

timestamp: 1698955020
open: 177.67
close: 177.58
high: 177.69
low: 177.56
volume: 439780

...

👀 Check the full example and other examples here

RPC support

The following table outlines the supported rpc calls:

Service rpc Description
ApiUsageService GetApiUsage Get a list of products with quota limit/usage
BenzingaService GetDividentsCalendar Returns the dividends calendar from Benzinga
BenzingaService GetEarningsCalendar Returns the earnings calendar from Benzinga
BenzingaService GetNews Returns the news articles from Benzinga
BenzingaService GetIPO Returns IPO data from Benzinga
BinanceService GetTimeSeries Get time series data without technical indicators
DatasetsService GetDatasets Get a list of all datasets available at Finazon
ExchangeService GetMarketsCrypto Returns a list of supported crypto markets
ExchangeService GetMarketsStocks Returns a list of supported stock markets
PublisherService GetPublishers Get a list of all publishers available at Finazon
SecService GetFilings Real-time and historical access to all forms, filings, and exhibits directly from the SEC's EDGAR system
SipService GetTrades Returns detailed information on trades executed through the Securities Information Processor (SIP)
SipService GetMarketCenter Returns a list of market centers
SnapshotService GetSnapshot This endpoint returns a combination of different data points, such as daily performance, last quote, last trade, minute data, and previous day performance
TickersService FindTickersStocks This API call returns an array of stocks tickers available at Finazon Data API. This list is updated daily
TickersService FindTickersCrypto This API call returns an array of crypto tickers available at Finazon Data API. This list is updated daily
TickersService FindTickersForex This API call returns an array of forex tickers available at Finazon Data API. This list is updated daily
TickersService FindTickerUS This API call returns an array of US tickers available at Finazon Data API. This list is updated daily
TimeSeriesService GetTimeSeries Get time series data without technical indicators
TimeSeriesService GetTimeSeriesAtr Get time series data for ATR technical indicator
TimeSeriesService GetTimeSeriesBBands Get time series data for BBands technical indicator
TimeSeriesService GetTimeSeriesIchimoku Get time series data for Ichimoku technical indicator
TimeSeriesService GetTimeSeriesMa Get time series data for Ma technical indicator
TimeSeriesService GetTimeSeriesMacd Get time series data for Macd technical indicator
TimeSeriesService GetTimeSeriesObv Get time series data for Obv technical indicator
TimeSeriesService GetTimeSeriesRsi Get time series data for Rsi technical indicator
TimeSeriesService GetTimeSeriesSar Get time series data for Sar technical indicator
TimeSeriesService GetTimeSeriesStoch Get time series data for Stoch technical indicator
TradeService GetTrades Returns general information on executed trades

Here's how you can import stub and request objects:

from finazon_grpc_python.service_name_pb2_grpc import ServiceNameServiceStub
from finazon_grpc_python.service_name_pb2 import RpcNameRequest, RpcNameResponse

# ...

stub = ServiceNameStub(channel)
response = stub.RpcName(RpcNameRequest())

Documentation

Delve deeper with our official documentation.

Examples

Explore practical scenarios in the examples directory.

Support

Stay updated

Contributing

  1. Fork and clone: $ git clone https://github.com/finazon-io/finazon-grpc-python.git.
  2. Branch out: $ cd finazon-grpc-python && git checkout -b my-feature.
  3. Commit changes and test.
  4. Push your branch and open a pull request with a comprehensive description.

For more guidance on contributing, see the GitHub Docs on GitHub.

License

This project is licensed under the MIT License. See the LICENSE.txt file in this repository for more details.

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

finazon_grpc_python-1.0.131.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

finazon_grpc_python-1.0.131-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file finazon_grpc_python-1.0.131.tar.gz.

File metadata

  • Download URL: finazon_grpc_python-1.0.131.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.5.0-17-generic

File hashes

Hashes for finazon_grpc_python-1.0.131.tar.gz
Algorithm Hash digest
SHA256 66da6a64dc3248082d9e7555b507d503243fae56058ef8783c30d4c0bebb1517
MD5 d400b388182ac22b4bbf45737963d483
BLAKE2b-256 6617b9a2e441ac137010003cdc771e2a10f571f51255655763c2db15a05ec12d

See more details on using hashes here.

File details

Details for the file finazon_grpc_python-1.0.131-py3-none-any.whl.

File metadata

File hashes

Hashes for finazon_grpc_python-1.0.131-py3-none-any.whl
Algorithm Hash digest
SHA256 52dcaf79885beb233c1ce7eef0a828e12a00fdf0785fd6b342a9a5763c3a202e
MD5 e46901e6be468c568b4d128254df172d
BLAKE2b-256 b558fc64e58c64cdfe896beb9c92741bc9d8da03da54fd45c81fbdf9dd37c02f

See more details on using hashes here.

Supported by

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