Skip to main content

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

This version

0.1

Download files

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

Source Distribution

ig-streaming-client-0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

ig_streaming_client-0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file ig-streaming-client-0.1.tar.gz.

File metadata

  • Download URL: ig-streaming-client-0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for ig-streaming-client-0.1.tar.gz
Algorithm Hash digest
SHA256 fbb94cba0400395a399e1a17470e5154f98059681600494b667dc8b35a663d8f
MD5 d31e07dc01553ad8e8c66a832748d296
BLAKE2b-256 b98d75c783c151e622e1e36ade47d959db761311b9e226db1535465c03d69d12

See more details on using hashes here.

File details

Details for the file ig_streaming_client-0.1-py3-none-any.whl.

File metadata

  • Download URL: ig_streaming_client-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for ig_streaming_client-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 389d9ba4d1f738a014206c035abb95ca4d72904f0f2fe5f63d01cf25aa339ed3
MD5 36c8ee54321729e5eb7350f0c127658a
BLAKE2b-256 d1fd39f16155f15352083616ef32bf79a47af768de6ed73c07b58383d65f714a

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