IG streaming API client
Project description
IG streaming API client
Small Python library to connect to IG streaming API (more information and API reference is available on IG Labs website).
Installation
To use most recent release:
pip install ig-streaming-client
To use current master branch:
pip install git+https://github.com/wjszlachta/ig-streaming-client.git
Usage
For demo account:
import time
from ig_streaming_client import IgStreamingSession
from lightstreamer_client import LightstreamerSubscription
api_key = '...'
account_id = '...'
rest_api_username = '...'
rest_api_password = '...'
session = IgStreamingSession(api_key, account_id, rest_api_username, rest_api_password)
subscription = LightstreamerSubscription('MERGE',
['MARKET:CS.D.BITCOIN.TODAY.IP'],
['UPDATE_TIME', 'BID', 'OFFER'])
subscription.addlistener(lambda item: print(item))
session.subscribe(subscription)
time.sleep(30)
session.log_out()
For live account:
import time
from ig_rest_client import IG_REST_TRADING_API_LIVE_URL
from ig_streaming_client import IgStreamingSession
from lightstreamer_client import LightstreamerSubscription
api_key = '...'
account_id = '...'
rest_api_username = '...'
rest_api_password = '...'
session = IgStreamingSession(api_key, account_id, rest_api_username, rest_api_password, rest_api_url=IG_REST_TRADING_API_LIVE_URL)
subscription = LightstreamerSubscription('MERGE',
['MARKET:CS.D.BITCOIN.TODAY.IP'],
['UPDATE_TIME', 'BID', 'OFFER'])
subscription.addlistener(lambda item: print(item))
session.subscribe(subscription)
time.sleep(30)
session.log_out()
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
Close
Hashes for ig_streaming_client-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 389d9ba4d1f738a014206c035abb95ca4d72904f0f2fe5f63d01cf25aa339ed3 |
|
MD5 | 36c8ee54321729e5eb7350f0c127658a |
|
BLAKE2b-256 | d1fd39f16155f15352083616ef32bf79a47af768de6ed73c07b58383d65f714a |