IG Markets Trading API
Project description
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
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
pyIG-1.0.0.tar.gz
(16.9 kB
view details)
File details
Details for the file pyIG-1.0.0.tar.gz.
File metadata
- Download URL: pyIG-1.0.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e83c70ea2669ae013d49d1a9753d9920cef547746a8b2104ff83187b21c0c7dc
|
|
| MD5 |
0af62de7412c6993be8d72b95f8277fa
|
|
| BLAKE2b-256 |
836f0d4423c780775b3a54bfe2c715d4799614e1f441fda8ca7bfd4b35aa6f8b
|