tg12/FAIG

Pseudo Code

Opened this issue · 8 comments

Spent some time studying the code, and could you help on this questions?

Found the Pseudo code in the thread.
[https://www.reddit.com/r/UKInvesting/comments/7q67cw/faig_fully_automated_ig_trading_a_python_script/]
May I say the program is structured like this?

Step 1: Create IG session.

  • Login Code, generates a token that is used throughout the program.

Step 2: Keep watching market for opportunities

  • Read in lots of data from the markets for your chosen instrument.

Step 3: Training and prediction

  • Create two arrays, One Array has an (Low Price, Volume) and the second (High Price)
  • Pass this into a Linear Regression Algorithm.
  • Returns the next High price prediction point.
  • Check this is at least 80% accurate

Step 4: Open position

  • Check if this prediction is above or below current price on market.
  • Trade accordingly, Long or Short.

Step 5: Close position

  • Check the price continuously until in profit.
  • Trade either hits Limit Distance OR predefined limit.
  • Close trade
tg12 commented

Yep! That's pretty good ... You have helped the documentation as well. Please feel free to post this in the thread. I am sure it will help.

Thanks.

In fact while studying your code, I am splitting them into modules.
Probably will need your review soon.

After modulating the code, we may have better understanding and discussion about your idea.

tg12 commented

Yeah that is great! If you want to PM me on Reddit, I am chatting to a few people on there about this.

From my study, quite a lot of codes are used to deal with errors when communicating with IG (not so perfect world).

Also, there are 3 major decision in the code.

  1. During step 2 looking for opportunities, below are the criteria for an opportunity
  • Price change percentage is between 0.48% and 1.90%, and
  • Spread is less than 2.
  1. During step 3 training and prediction, the model is a linear regression model, with below inputs and outputs
  • Input x: low price and volume
  • Output y: high price
  1. During step 5 close position, 2 information are used to determine whether a position should be closed.
  • Time elapsed for the position, and
  • Profit of the position, and
  • A to-be-studied contrarian indicator.

Could you add any missing or important points on this understanding?

tg12 commented

A to-be-studied contrarian indicator... That decides the trade direction before entering the trade.

So for you predict y for x if that makes sense? ...

Rest looks good though!!

Added a module called market_watcher, and created a pull request.
Will you please have a look?

tg12 commented

Will do! I have messaged you also...

tg12 commented

This looks all OK!