IG Markets API - Python Library
This is a fork from ig-markets-api-python-library
Added support for asyncio and aiohttp
Usage
import logging
from pyIG.rest import IGParams, IGClient, Order, OrderType, Side, Money
import os
import asyncio
logger = logging.getLogger()
logger.setLevel(logging.INFO)
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()
print(auth)
order = Order('IX.D.SPTRD.DAILY.IP', Side.Buy, Money(100, 'GBP'), OrderType.Market, 'DFB')
deal = await client.CreatePosition(order)
print(deal)
await client.Logout()
if __name__ == '__main__':
app_loop = asyncio.get_event_loop()
app_loop.run_until_complete(main())
More
Full details about the API along with information about how to open an account with IG can be found at the link below:
Install
From Python package index
$ pip install pyIG
Thanks to
Metadata
Release files for pyIG 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyIG-1.0.0.tar.gz | 16.9 kB | Without provenance | Details for pyIG-1.0.0.tar.gz |
Release files / pyIG-1.0.0.tar.gz
| Download URL | pyIG-1.0.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e83c70ea2669ae013d49d1a9753d9920cef547746a8b2104ff83187b21c0c7dc
|
|
BLAKE2b-256 checksum How to use checksums |
836f0d4423c780775b3a54bfe2c715d4799614e1f441fda8ca7bfd4b35aa6f8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyIG 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.