Jump to content
  • 0

Open and Close positions on python trading_ig


GP79

Question

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)
ig_service.create_session()

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

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

print("")

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

epic = 'IX.D.SPTRD.DAILY.IP'
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
  • image.png

  • Posts

    • Dear @Luis, Thank you for your post. Please make use of the search function on the platform. You can use ' 500 ETF' as keywords. Please also bear in mind that retail investors can't purchase most US ETFs. All the best, KoketsoIG
    • DE Elliott Wave Analysis Trading Lounge Daily Chart, Deere & Co., (DE) Daily Chart DE Elliott Wave Technical Analysis FUNCTION: Trend MODE: Impulsive STRUCTURE: Motive POSITION: Minor 2 of (1). DIRECTION: Bottoming in wave 2.   DETAILS: Looking for a three wave move in wave 2 to be soon completed, to then continue higher.   DE Elliott Wave Analysis Trading Lounge 4Hr Chart, Deere & Co., (DE) 4Hr Chart DE Elliott Wave Technical Analysis FUNCTION: Counter Trend MODE: Corrective   STRUCTURE: Flat POSITION: Wave {c} of C.   DIRECTION: Wave (v) of {c}. DETAILS: Looking for equality of {c} vs. {a} at 390$, looking for a Classic Trading Level Pattern around 400$ to then enter long positions.   Welcome to our latest Elliott Wave analysis for Deere & Co. (DE), In this report, we provide a detailed examination of DE's price movements and future projections using the Elliott Wave Theory. This analysis will cover both the daily and 4-hour charts, offering insights into the current trends and potential trading opportunities. Whether you are a seasoned trader or a market enthusiast, this analysis aims to enhance your understanding of DE's market behavior.   * DE Elliott Wave Technical Analysis – Daily Chart* In our latest Elliott Wave analysis of Deere & Co. (DE), we observe a bullish trend with an impulsive structure. Currently positioned at Minor wave 2 of (1), DE is bottoming in wave 2. We anticipate the three-wave move in wave 2 to soon complete, setting the stage for a continuation to the upside. Traders should watch for signs of this bottoming to prepare for potential long positions as the trend resumes. * DE Elliott Wave Technical Analysis – 4Hr Chart* On the 4-hour chart, DE is exhibiting a corrective mode within a flat structure, specifically positioned in wave {c} of C. We are looking for wave (v) of {c} to reach equality with wave {a} at the $390 level. Additionally, we expect a Classic Trading Level Pattern to emerge around the $400 mark. This pattern will provide an opportunity to enter long positions as DE completes its corrective phase and resumes its upward movement.   Technical Analyst : Alessio Barretta Source : Tradinglounge.com get trial here!  
    • What is the etf sp500 here without being CFD i can invest on please?
×
×
  • Create New...
us