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()
- 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.3.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for ig_trading_api-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9e2acddd735ca468f32edbc00a245b7b56128d662a2b910da923b65efb05b11 |
|
MD5 | f823074849f43b3c81a91bbd04f440a5 |
|
BLAKE2b-256 | ff19ed7c1974c1e3822928c7dda5259078a942aa36703e1d1ada87ce069c3ebf |