Backtesting a Trading Strategy in Python With AI Generated Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น • 18

  • @RyanOConnellCFA
    @RyanOConnellCFA  4 หลายเดือนก่อน +1

    🤖 Sign Up For Datalore:
    jb.gg/check-out-datalore
    💾 Download Free Code & AI Prompts Automatically:
    jb.gg/datalore-report
    🖺 Link to Full Article:
    jb.gg/blog-datalore

  • @SariKhayyal
    @SariKhayyal 4 หลายเดือนก่อน +4

    Great presentation! As you noted, if you factor in the 10 US Treasury note average interest rate over the past 10 years (2.0377%) the Sharpe Ratio works out to 0.730973 for the Mean Reversion Strategy, versus 0.776654 for the DIA, and this also doesn't include transaction costs - as you also mentioned - so caveat emptor for the implementation of this strategy.

    • @RyanOConnellCFA
      @RyanOConnellCFA  4 หลายเดือนก่อน

      Thank you and very good point! A more accurate backtest would include the risk free rate. I think a good way to adjust the prompt would be to ask the AI to source data on the 10 year treasury rates over the last 10 years, average it, and then include it in the sharpe ratio calculation as you hinted at

  • @Abhinavjain2004
    @Abhinavjain2004 3 หลายเดือนก่อน +3

    Sir, I want to express my heartfelt gratitude. You are truly one of the best teachers and a guiding light for many mathematics and computer science students. Your videos are incredibly insightful and make learning so much easier.
    Thank you for sharing your vast knowledge with us.
    If possible, could you consider creating a course or youtube playlist on Python for Quantitative Finance, covering everything from beginner to advanced topics such as risk models, option pricing, and algorithmic trading?
    It would be extremely helpful and invaluable for students pursuing a career in quantitative finance.
    Thank you once again for your dedication and generosity in teaching.
    🙏🙏

    • @RyanOConnellCFA
      @RyanOConnellCFA  3 หลายเดือนก่อน

      Thank you so much for the awesome feedback! I have gotten started on a playlist of this nature here: th-cam.com/play/PLPe-_ytPHqyg4ap7hysD4pOBJMz0mnLly.html

  • @Berghiker
    @Berghiker 24 วันที่ผ่านมา

    How can I correct this? AI cannot do it. "Cannot join with no overlapping index names"

  • @thbrown81yt
    @thbrown81yt หลายเดือนก่อน

    If you were to actually try to execute this you would need to make adjustments to not sell holdings that were consecutively one of the bottom 10 performers. Most trading platforms have restrictions on the availability of cash for holdings that were liquidated same day. While funds from a sale can be available immediately, usually buying a stock with funds from the sale of the same stock within 24 hours will get a trading restriction placed on your account.

  • @jw-sx4pi
    @jw-sx4pi หลายเดือนก่อน

    a few observations for people looking now, script returning errors fetching data from Wikipedia - its table 2 not table 1 you have in the code, im guessing theyve moved around since your video was published, - also im getting append has been deprecated in pandas dataframes use concat instead - always something when using any open source software

  • @arnavsutodiya4468
    @arnavsutodiya4468 2 หลายเดือนก่อน

    Love this video man. Really simple and useful.

  • @victoricus1
    @victoricus1 2 หลายเดือนก่อน

    I wonder if the results change if you use perplexity or chat gpt

  • @SlashnKashmir
    @SlashnKashmir 4 หลายเดือนก่อน +2

    Great video. Please continue similar strategy+coding concept.

    • @RyanOConnellCFA
      @RyanOConnellCFA  4 หลายเดือนก่อน

      Thank you! This video seems to be a hit so I will definitely make more strategy and coding videos in the future

  • @pablomoure2963
    @pablomoure2963 4 หลายเดือนก่อน +1

    Top notch video man¡ Could you please make a video setting up this strategy (or whichever you prefer) in a demo broker account? It would be nice to understand how to connect to broker apis, so we know the whole process end to end. Cheers

    • @RyanOConnellCFA
      @RyanOConnellCFA  4 หลายเดือนก่อน +2

      Hey Pablo, great idea! I have thought of creating a series of videos on setting up algorithmic trading strategies in a paper trading account (fake money for practicing) so I will absolutely look into it in the future

  • @shih-binshih9889
    @shih-binshih9889 4 หลายเดือนก่อน +1

    thanks for sharing, always learning a lots from your video!!!

    • @RyanOConnellCFA
      @RyanOConnellCFA  4 หลายเดือนก่อน

      Much appreciated and glad to hear that you are getting value out of it!

  • @alwikah5664
    @alwikah5664 4 หลายเดือนก่อน +1

    Top video.
    Possible to do the same process with Forex (EURUSD or GBPUSD) ?
    Thanks a lot !!!

    • @RyanOConnellCFA
      @RyanOConnellCFA  4 หลายเดือนก่อน

      I appreciate it and thank you for the video idea! I can look into this as a potential future video topic