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()
- 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()
- 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.2.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for ig_trading_api-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4af5062be1e6df3291362a36405568c89e1bd42be441087d2b99ae929a0839a4 |
|
MD5 | e2c55538d68b78cab90bd0a72883f50b |
|
BLAKE2b-256 | 1b0bc9f00257eb02bca4e46585338057ca985464552e54ce90f9f1a77844c08f |