Jump to content
  • 0

Open and Close positions on python trading_ig



I am new to trading_ig library.

I have connected to my live IG account.

from trading_ig import IGService
from trading_ig_config import config

ig_service = IGService(config.username, config.password, config.api_key, config.acc_type)

#account_info = ig_service.switch_account(config.acc_number, False) # not necessary

open_positions = ig_service.fetch_open_positions()
print("open_positions:\n%s" % open_positions)


I have been able to download the latest 100 days of an index:

resolution = 'D'
num_points = 100
response = ig_service.fetch_historical_prices_by_epic_and_num_points(epic, resolution, num_points)
df_ask = response['prices']['ask']
print("ask prices:\n%s" % df_ask)

Now, based on an algorithm that I have created, I want to be able to open and close a position automatically by letting the python code continuously run?

Do I need to use Lightstreamer?

How I open and close a position in Python?

Again, I am new to this and the IG documentation didn't provide much information.

Thanks for your help.

Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
    • Total Posts
    • Total Members
    • Most Online
      10/06/21 10:53

    Newest Member
    Joined 01/12/23 06:04
  • Posts

    • Poorer economic data from South Korea and China put pressure on Asian markets, with China's manufacturing declining for a second month in a row and South Korea seeing industrial output fall by the biggest monthly amount in ten years. Stocks in Europe were given a lift yesterday by slowing German inflation figures, and this also helped to support Wall Street to an extent. More inflation data is expected today, this time from France and the eurozone, along with the US PCE price index. Given the surge in stock markets over the last month, and with month-end upon us, any uptick in US inflation data could put some pressure on equities. Also on the calendar for the day is the OPEC+ meeting, with the body discussing further output cuts given the recent weakness in oil prices.   
    • USDCHF Elliott Wave Analysis Trading Lounge Day Chart, 1 December 23   U.S.Dollar/Swiss Franc(USDCHF) Day Chart USDCHF Elliott Wave Technical Analysis Function:   Trend Mode: impulsive   Structure: blue wave 1 Position:  Black wave 3 Direction Next Higher Degrees: Blue wave 1(may started) Details:  red wave 5 blue wave C of 2 looking completed between fib level 61.80 to 78.60  .Now blue wave 1 of 3 is in play .  Wave Cancel invalid level: 0.85548 The "USDCHF Elliott Wave Analysis Trading Lounge Day Chart" for 1 December 23, provides a detailed examination of the U.S. Dollar/Swiss Franc (USDCHF) currency pair within a daily timeframe, utilizing Elliott Wave principles for technical analysis. The analysis identifies the primary "Function" as "Trend," indicating a focus on discerning and comprehending the prevailing trend in the market. This suggests an emphasis on understanding the directional movements that could guide traders in their decision-making. The specified "Mode" is "impulsive," suggesting that the market is currently displaying characteristics of an impulsive wave. Impulsive waves are indicative of strong, directional movements in the market, signifying a potential trend in progress. The main "Structure" under scrutiny is "blue wave 1," implying that the analysis centers on the initial wave within a larger Elliott Wave structure. This indicates an attempt to capture the early stages of what could be a significant market movement. The designated "Position" is "Black wave 3," signifying the broader-degree wave within the Elliott Wave structure. This indicates that the analysis is conducted with a broader perspective, considering the potential third wave within a larger degree of trend. The directional guidance for "Next Higher Degrees" is "Blue wave 1 (may have started)," suggesting an anticipation of the initiation of a potential larger-degree trend. This aligns with the impulsive mode, indicating a strong move in the upward direction. Regarding "Details," the analysis notes that "red wave 5 blue wave C of 2 looking completed between fib level 61.80 to 78.60." This provides traders with a specific range of Fibonacci retracement levels within which the completion of the previous corrective wave is expected. The "Wave Cancel invalid level" is set at 0.85548, serving as a crucial reference point for potential invalidation of the current wave count. This level acts as a guide for traders, indicating potential trend reversals or confirmations. In conclusion, the USDCHF Elliott Wave Analysis on the daily chart suggests the potential commencement of an impulsive wave (blue wave 1) after the completion of a corrective phase. Traders are provided with insights into specific Fibonacci levels and a key reference point for potential trend reversals or confirmations in the broader trend. Technical Analyst : Malik Awais Source : Tradinglounge.com get trial here!    
  • Create New...