crapher / medium

Apache License 2.0
69 stars 44 forks source link

Question on the spy alert credit spread #2

Closed Farmhill closed 6 months ago

Farmhill commented 6 months ago

Hi Diego,

Thank you for sharing. I'm a little stuck and would really appreciate your advice.

The code runs at 10.30 and I get the following message: INFO:root:Sleeping for 23:53:18 (Checking @ 2024-01-03 10:30:00-05:00)

Q1. Any time I run the code it goes to sleep again after a couple of minutes until the next day. My understanding is the code is designed to run at 10.30 to examine the first hour of trading but I thought it would continue to run until the end of the trading day. Please advise.

Q2. Why 10.30?

Q3. Finally, have you tested this strategy on other stocks or ETFs?

Thank you,

Kieran

crapher commented 6 months ago

Hi Farmhill,

Q1: Yes, that is correct. The code is based on this article. The article backtested the strategy using the first hour to determine if we can open a trade that date or not based on the conditions. Please feel free to change it to whatever you feel that adapts to your needs. (I recommend you download de code in the mentioned article and backtest other combinations previous to changing the agent parameters)

Q2: It is what I used in the article mentioned before, the same as the -0.35 used for MAX_CHANGE_BEARISH and 0.35 for MIN_CHANGE_BULLISH. I did not use any optimization or anything to determine those values, I tested manually and those values gave me the best results.

Q3: Yes, I tested with SPX getting very similar results (as expected since SPY is the SPX ETF) but I am thinking of expanding and testing with other symbols in the future.

Regards Diego