Skip to main content

IG.com Trading API

PyPI PyPI - Downloads PyPI - Python Version PyPI - Wheel GitHub contributors GitHub issues GitHub Action GitHub

Install

pip install ig-trading-api

or

pip install --upgrade ig-trading-api

Usage

  • Initializing
import igapi
ig = igapi.IG(apikey, username, password, account, acc_type)
  • Check version
print(ig.getVersion())
  • Login
ig.login()
  • Logout
ig.logout()
  • Get account information
account = ig.account()
  • Get account balance
ig.getBalance()

or

ig.getBalance(account)
  • Get account available balance
ig.getAvailable()

or

ig.getAvailable(account)
  • Get account deposit
ig.getDeposit()

or

ig.getDeposit(account)
  • Get account getProfitLoss
ig.getProfitLoss()

or

ig.getProfitLoss(account)
  • Get watchlists
watchlists = ig.watchlists()
  • Get specific watchlist
watchlist = ig.watchlist(id)
  • Get account transactions
transactions = ig.getAccountTransactions(type='ALL',period=86400)
  • Get account activities
activities = ig.getAccountActivities()
  • Get price
price = ig.getPrice(epic, [resolution], [numPoints])
  • Get prices
prices = ig.getPrices(epic, [resolution], [numPoints],[start],[end])
  • Get open positions
positions = ig.getOpenPosition([dealId])
  • Create position
dealReference = ig.createPosition(currency, direction, epic, expiry, orderType, size, [limitDistance], [stopDistance], [forceOpen], [guaranteedStop])
  • Close position
dealReference = ig.closePosition(dealId, direction, epic, expiry, orderType, size)

Example

order = ig.createPosition('AUD', 'BUY', 'IX.D.NASDAQ.IFA.IP', '-', 'MARKET', 2, 20, 40)

dealReference = ig.closePosition([dealId],'SELL',  '-', 'MARKET', 2)

Metadata

Release files for ig-trading-api 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ig-trading-api 1.0.6
File Size Uploaded Provenance Actions
ig-trading-api-1.0.6.tar.gz 4.4 kB Without provenance Details for ig-trading-api-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ig-trading-api 1.0.6
File Interpreter ABI Platform Actions
ig_trading_api-1.0.6-py3-none-any.whl Python 3 none any Details for ig_trading_api-1.0.6-py3-none-any.whl

Total release size: 9.2 kB

Release files / ig-trading-api-1.0.6.tar.gz

Download URL ig-trading-api-1.0.6.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d0456a9b40052aaa9b91a525814763cd4bae9c0527051db97e6d5055e0ff3bb0
BLAKE2b-256 checksum
How to use checksums
bbb75de70763bb53d3478bfe6316b3352a8fbb9cc8e9adf764e79781e0b87694
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / ig_trading_api-1.0.6-py3-none-any.whl

Download URL ig_trading_api-1.0.6-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96647f38835fc2c399874e30901663faf73313b4e40c35ed6d4888bbc7f43a1d
BLAKE2b-256 checksum
How to use checksums
d9e94bd5621145187181843790f11aafa6b8dea16917beb4a017fbef541694fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for ig-trading-api 1.0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page