Skip to main content

IG Markets Trading API

Project description

This is a fork from ig-markets-api-python-library

Added support for asyncio and aiohttp


import logging
from import IGParams, IGClient, Order, OrderType, Side, Money
import os
import asyncio

logger = logging.getLogger()

params = IGParams()
params.Url = os.environ['IG_URL']
params.Key = os.environ['X_IG_API_KEY']
params.Identifier = os.environ['IDENTIFIER']
params.Password = os.environ['PASSWORD']

async def main():
    async with IGClient(params, logger) as client:
        auth = await client.Login()

        order = Order('IX.D.SPTRD.DAILY.IP', Side.Buy, Money(100, 'GBP'), OrderType.Market, 'DFB')

        deal = await client.CreatePosition(order)

        await client.Logout()

if __name__ == '__main__':
    app_loop = asyncio.get_event_loop()


Full details about the API along with information about how to open an account with IG can be found at the link below:


From Python package index

$ pip install pyIG

Project details

Download files

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

Files for pyIG, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pyIG-1.0.0.tar.gz (16.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page