All Projects β†’ intrinio β†’ intrinio-realtime-python-sdk

intrinio / intrinio-realtime-python-sdk

Licence: GPL-3.0 license
Intrinio Python SDK for Real-Time Stock Prices

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to intrinio-realtime-python-sdk

intrinio-realtime-java-sdk
Intrinio Java SDK for Real-Time Stock Prices
Stars: ✭ 22 (-72.15%)
Mutual labels:  realtime, exchange, fintech, stock-market, market-data, stocks, stock-data, stock-prices, stock-market-data
robinhood.tools
πŸ“ˆπŸ€‘πŸ’° Advanced trading tools and resources for Robinhood Web.
Stars: ✭ 27 (-65.82%)
Mutual labels:  real-time, exchange, stock-market, market-data, stocks, stock-data
Intrinio Realtime Node Sdk
Intrinio NodeJS SDK for Real-Time Stock & Crypto Prices
Stars: ✭ 30 (-62.03%)
Mutual labels:  real-time, websockets, fintech, stock-market, stock-data
Iex Api
The IEX API provides any individual or academic, public or private institution looking to develop applications that require stock market data to access near real-time quote and trade data for all stocks trading on IEX.
Stars: ✭ 683 (+764.56%)
Mutual labels:  real-time, fintech, stock-market, market-data, stocks
TerminalStocks
Pure terminal stock ticker for Windows.
Stars: ✭ 88 (+11.39%)
Mutual labels:  stock-market, stocks, stock-data, stock-prices
Sumzerotrading
A Java API for Developing Automated Trading Applications for the Equity, Futures, and Currency Markets
Stars: ✭ 128 (+62.03%)
Mutual labels:  stock-market, market-data, stocks, stock-data
Tushare
TuShare is a utility for crawling historical data of China stocks
Stars: ✭ 11,288 (+14188.61%)
Mutual labels:  fintech, stock-market, stock-data
Cryptofeed
Cryptocurrency Exchange Websocket Data Feed Handler
Stars: ✭ 643 (+713.92%)
Mutual labels:  websockets, exchange, market-data
Sandstone
PHP microframework designed to build a RestApi working together with a websocket server. Build a real time RestApi!
Stars: ✭ 98 (+24.05%)
Mutual labels:  real-time, websockets, realtime
Pytse Client
work with Tehran stock exchange data in Python
Stars: ✭ 130 (+64.56%)
Mutual labels:  stock-market, market-data, stocks
Stl.fusion
Get real-time UI updates in Blazor apps and 10-1000x faster API responses with a novel approach to distributed reactive computing. Fusion brings computed observables and automatic dependency tracking from Knockout.js/MobX/Vue to the next level by enabling a single dependency graph span multiple servers and clients, including Blazor apps running in browser.
Stars: ✭ 858 (+986.08%)
Mutual labels:  real-time, websockets, realtime
Tardis Node
Convenient access to tick-level real-time and historical cryptocurrency market data via Node.js
Stars: ✭ 126 (+59.49%)
Mutual labels:  real-time, exchange, market-data
StockScreener
A handy tool for screening stocks based on certain criteria from several markets around the world. The list can then be delivered to your email address (one-off or regularly via crontab).
Stars: ✭ 51 (-35.44%)
Mutual labels:  stock-market, stock-data, stock-prices
Ta Rs
Technical analysis library for Rust language
Stars: ✭ 248 (+213.92%)
Mutual labels:  stock-market, market-data, stocks
pyEX
Python interface to IEX and IEX cloud APIs
Stars: ✭ 407 (+415.19%)
Mutual labels:  stock-market, stocks, stock-data
market-monitor
Interactive app to monitor market using Python
Stars: ✭ 20 (-74.68%)
Mutual labels:  stock-market, stocks, stock-prices
IQFeed.CSharpApiClient
IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
Stars: ✭ 103 (+30.38%)
Mutual labels:  stock-market, market-data, stock-data
Simplestockanalysispython
Stock Analysis Tutorial in Python
Stars: ✭ 126 (+59.49%)
Mutual labels:  stock-market, stocks, stock-data
soketi
Just another simple, fast, and resilient open-source WebSockets server. πŸ“£
Stars: ✭ 2,202 (+2687.34%)
Mutual labels:  real-time, websockets, realtime
dukascopy-tools
✨ Download historical price tick data for Crypto, Stocks, ETFs, CFDs, Forex via CLI and Node.js ✨
Stars: ✭ 128 (+62.03%)
Mutual labels:  market-data, stock-data, stock-prices

intrinio realtime python sdk

SDK for working with Intrinio's realtime Multi-Exchange prices feed. Intrinio’s Multi-Exchange feed bridges the gap by merging real-time equity pricing from the IEX and MEMX exchanges. Get a comprehensive view with increased market volume and enjoy no exchange fees, no per-user requirements, no permissions or authorizations, and little to no paperwork.

Intrinio provides real-time stock prices via a two-way WebSocket connection. To get started, subscribe to a real-time data feed and follow the instructions below.

Documentation for our legacy realtime client

Requirements

  • Python 3.6

Features

  • Receive streaming, real-time price quotes (last trade, bid, ask)
  • Subscribe to updates from individual securities
  • Subscribe to updates for all securities

Installation

pip install intriniorealtime

Example Usage

import threading
import time
from threading import Timer,Thread,Event
from intriniorealtime.client import IntrinioRealtimeClient

trade_count = 0
ask_count = 0
bid_count = 0
backlog_count = 0

def on_quote(quote, backlog):
        global ask_count
        global bid_count
        global backlog_count
        backlog_count = backlog
        if 'type' in quote.__dict__:
            if quote.type == "ask": ask_count += 1
            else: bid_count += 1

def on_trade(trade, backlog): 
        global trade_count
        global backlog_count
        backlog_count = backlog
        trade_count += 1

class Summarize(threading.Thread):
    def __init__(self, event):
        threading.Thread.__init__(self, args=(), kwargs=None)
        self.daemon = True
        self.stopped = event

    def run(self):
        global trade_count
        global bid_count
        global ask_count
        global backlog_count
        while not self.stopped.wait(5):
            print("trades: " + str(trade_count) + "; asks: " + str(ask_count) + "; bids: " + str(bid_count) + "; backlog: " + str(backlog_count))

options = {
    'api_key': 'API_KEY_HERE',
    'provider': 'REALTIME'
}

client = IntrinioRealtimeClient(options, on_trade, on_quote)
client.join(['AAPL','GE','MSFT'])
#client.join(['lobby'])
client.connect()
stopFlag = Event()
summarize_thread = Summarize(stopFlag)
summarize_thread.start()
time.sleep(10)
client.disconnect()
# this will stop the summarize thread
stopFlag.set()

Handling Quotes and the Queue

There are thousands of securities, each with their own feed of activity. We highly encourage you to make your trade and quote handlers has short as possible and follow a queue pattern so your app can handle the volume of activity.

Quote Data Format

Quote Message

{ 'symbol': 'AAPL',
  'type': 'ask',
  'price': '102.3',
  'size': 100,
  'timestamp': 1636395583000000000 }
  • symbol - the ticker of the security
  • type - the quote type
  • ask - represents the top-of-book ask price
  • bid - represents the top-of-book bid price
  • price - the price in USD
  • size - the size of the last trade, or total volume of orders at the top-of-book bid or ask price
  • timestamp - a Unix timestamp (nanoseconds since unix epoch)

Trade Message

{ 'symbol': 'AAPL',
  'total_volume': '106812',
  'price': '102.3',
  'size': 100,
  'timestamp': 1636395583000000000 }
  • symbol - the ticker of the security
  • total_volume - the total volume of trades for the security so far today.
  • price - the price in USD
  • size - the size of the last trade, or total volume of orders at the top-of-book bid or ask price
  • timestamp - a Unix timestamp (nanoseconds since unix epoch)

API Keys

You will receive your Intrinio API Key after creating an account. You will need a subscription to a realtime data feed as well.

Documentation

Methods

client = IntrinioRealtimeClient(options) - Creates an Intrinio Realtime client

  • Parameter options.api_key: Your Intrinio API Key
  • Parameter options.provider: The real-time data provider to use ("REALTIME")
  • Parameter options.on_quote(quote, backlog): A function that handles received quotes. backlog is an integer representing the approximate size of the queue of unhandled quote/trade events.
  • Parameter options.on_trade(quote, backlog): A function that handles received trades. backlog is an integer representing the approximate size of the queue of unhandled quote/trade events.
  • Parameter options.logger: (optional) A Python Logger instance to use for logging
def on_quote(quote, backlog):
    print("QUOTE: " , quote, "BACKLOG LENGTH: ", backlog)
def on_trade(trade, backlog):
    print("TRADE: " , trade, "BACKLOG LENGTH: ", backlog)
    
options = {
    'api_key': '',
    'provider': 'REALTIME',
    'on_quote': on_quote,
    'on_trade': on_trade
}

client = IntrinioRealtimeClient(options)

client.join(channels) - Joins the given channels. This can be called at any time. The client will automatically register joined channels and establish the proper subscriptions with the WebSocket connection.

  • Parameter channels - A single channel or list of channels. You can also use the special symbol, "lobby" to join the firehose channel and recieved updates for all ticker symbols (you must have a valid "firehose" subscription).
client.join(["AAPL", "MSFT", "GE"])
client.join("GOOG")
client.join("lobby")

client.connect() - Retrieves an auth token, opens the WebSocket connection, starts the self-healing and heartbeat intervals, joins requested channels.


client.keep_alive() - Runs an infinite loop to keep the thread alive, so that the client continues to receive prices. You may call this function after connect() or use your own timing logic (for example: connect, listen for quotes for x minutes, disconnect).


client.disconnect() - Closes the WebSocket, stops the self-healing and heartbeat intervals. You must call this to dispose of the client.


client.on_quote(quote, backlog) - Changes the quote handler function

def on_quote(quote, backlog):
    print("QUOTE: " , quote, "BACKLOG LENGTH: ", backlog)
    
client.on_quote = on_quote

client.leave(channels) - Leaves the given channels.

  • Parameter channels - A single channel or list of channels
client.leave(["AAPL", "MSFT", "GE"])
client.leave("GOOG")

client.leave_all() - Leaves all channels.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].