Simple IG trading API for Python
Project description
IG.com Trading API
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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ig-trading-api-1.0.6.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file ig-trading-api-1.0.6.tar.gz
.
File metadata
- Download URL: ig-trading-api-1.0.6.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0456a9b40052aaa9b91a525814763cd4bae9c0527051db97e6d5055e0ff3bb0 |
|
MD5 | e5f839d0e6a8b370e71c2c479f95e8fd |
|
BLAKE2b-256 | bbb75de70763bb53d3478bfe6316b3352a8fbb9cc8e9adf764e79781e0b87694 |
File details
Details for the file ig_trading_api-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: ig_trading_api-1.0.6-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96647f38835fc2c399874e30901663faf73313b4e40c35ed6d4888bbc7f43a1d |
|
MD5 | 2df676dc38723a7daa9d7fdf20f3be28 |
|
BLAKE2b-256 | d9e94bd5621145187181843790f11aafa6b8dea16917beb4a017fbef541694fe |