Simple IG trading API for Python
Project description
ig 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.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for ig_trading_api-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f566978ee7586059ad4ee052588cd22cf6bef8ec5babb044c4a03f6251d011c |
|
MD5 | c81991ec2a8c250a41656687aee728fd |
|
BLAKE2b-256 | b39122d23ebaddf5c1278c50a850b545c25506acd02908dc82b309f393a4c4b8 |