Build a ChatGPT Trading Bot With Real Time News (Alpaca Markets API / JavaScript)

Поделиться
HTML-код
  • Опубликовано: 27 июн 2024
  • Enjoying my videos? Sign up for more content here: www.coopercodes.com/
    📩 Join CodeLetter by Cooper Codes, the 3 minute tech newsletter: thecodeletter.com
    Join the Cooper Codes Community: / discord (Weekly calls, free resources, tutoring, and more!)
    In this video we create a stock trading bot that uses ChatGPT and the Alpaca Markets API to trade against live news! This video is a great project for anyone who is looking to use ChatGPT functionality (or any other OpenAI API call) to enhance their trading, alongside making buys / sells to the market through an API. We use WebSockets to connect to a live news event data source from Alpaca Markets, analyze the headlines of live news, and then make decisions to buy/sell stocks based off of ChatGPT's reaction to the breaking news. A great introduction to WebSockets, API trading, and ChatGPT API calls.
    Final project code: github.com/coopercodes/ChatGP...
    0:00 Intro
    0:35 Trading system discussion
    2:13 Setup Alpaca API and OpenAI API
    4:10 Setup server.js / environment variables
    6:32 Setup WebSocket to live news events
    14:05 Create trading logic with ChatGPT API
    25:15 Testing out buy / sell logic (Alongside other notes!)
    28:17 Thank you so much for watching!
  • НаукаНаука

Комментарии • 35

  • @HtopSkills
    @HtopSkills 3 месяца назад +1

    This video offers valuable information to start with the Alpaca API.

  • @RafiDrawingAcademy
    @RafiDrawingAcademy 4 месяца назад

    Beautiful art!

  • @727iamsam
    @727iamsam Год назад +1

    Super creative idea- great video!

    • @CooperCodes
      @CooperCodes  Год назад

      Thank you! Appreciate the comment 😁

  • @BeyondPy
    @BeyondPy Год назад +6

    This is insane, I actually built a full fledged python app on the same exact idea, except I'm scraping the actual new's article (capped at 2500 chracters) and feeding it into chatGPT and providing my own prompt (should I buy/sell) and expect a custom output. I'll then process that and pipeline that into alpaca. Super fun project!

    • @braeder
      @braeder 11 месяцев назад

      I wrote mine in golang and can process all symbol in real-time.

    • @babypandajr172
      @babypandajr172 11 месяцев назад

      @@braeder @hansellcruz777 How are your bots going so far?

    • @braeder
      @braeder 11 месяцев назад

      @@babypandajr172 It does what I tell it too do. Goal was handle all data without crashing. IT handles all the data without crashing does it call out rockets yes and no.

  • @mmmar7317
    @mmmar7317 Год назад

    Nice tech, easy to implement and user friendly.
    Bump comment

  • @stefanianta6962
    @stefanianta6962 Год назад +2

    Cool Trading bot app! Should be integrated with a Social-AI skills/services mart to get continuous feeds of leading triggers on companies adopting/automating the most performant AI/cloud tech. Maybe that could become an AGI distributed smart market of Skills and Biz.

  • @shaikhsanuar5339
    @shaikhsanuar5339 Год назад

    Creative video. Thanks. Wish to have more videos

    • @CooperCodes
      @CooperCodes  Год назад

      Thank you for the comment! More stuff on the way :)

  • @Loui3Hunna
    @Loui3Hunna Год назад +1

    This project looks 🔥
    Will definitely watch the whole thing when I get home!

    • @CooperCodes
      @CooperCodes  Год назад

      Really enjoyed making this one, thanks for the support!

    • @Loui3Hunna
      @Loui3Hunna Год назад

      @@CooperCodes Just watched it and followed along! Cool to learn something other than creating a type of web app.
      I'm wondering if you encountered the error "position not found: {ticker}"? Seems to happen occasionaly which is weird because I can find the ticker in Alpaca app
      Thanks for another great vid anyway

    • @CooperCodes
      @CooperCodes  Год назад

      It could be that the ticker is for a crypto symbol, and I'm realizing I may have been wrong about buying/selling crypto (they may use different commands). It could also be that you're trying to sell a position of a stock you don't own, which I assumed which just null out (instead of error). If this is causing the error I would put a try / catch statement around the selling call. Hopefully this helps!
      Check this link out for help there: erikmartinjordan.com/continue-execution-try-catch

    • @Loui3Hunna
      @Loui3Hunna Год назад

      @@CooperCodes I will take a look 😁
      Really appreciate the follow-up btw!

  • @username_6948
    @username_6948 Год назад

    nice video🔥🔥

  • @raymondjenkins1161
    @raymondjenkins1161 Год назад +1

    Great video! I keep getting an error that fetch is not defined. I can see the new info in the console log, but the I get the fetch error and no trades occur.

    • @CooperCodes
      @CooperCodes  Год назад +1

      I believe you need Node.JS 18 (or the latest version) for fetch to work. My bad! I should have mentioned this

  • @zp1405
    @zp1405 15 дней назад

    keep getting error reading properties (reading'0') and it may have something to do with it not letting me use openai keys for free fsr but if i increase my limits will it work?

  • @samueljamieson4505
    @samueljamieson4505 25 дней назад

    Why is it saying my current quota is exceeded and to check my billing plans and details for chatGPT? did the monetize their API?

  • @carlyparly6633
    @carlyparly6633 Год назад +2

    Thank you for vid. Just check you delete those API keys. They are exposed now.

    • @CooperCodes
      @CooperCodes  Год назад +2

      Yup they have been deactivated, thank you for the heads up :) And thank you for your comment and support.

  • @wallyd8160
    @wallyd8160 3 месяца назад

    Cool idea. I'm lost though. I know nothing about coding. We went from alpaca to a coding screen? What is the coding screen called? Im guessing just a python library?

  • @SadSling
    @SadSling 11 месяцев назад +2

    I keep getting this error does anyone have any suggestions?
    {
    error: {
    message: 'You exceeded your current quota, please check your plan and billing details.',
    type: 'insufficient_quota',
    param: null,
    code: null
    }

    • @happyjohn1656
      @happyjohn1656 11 месяцев назад

      Even though I was under my OpenAI cap I was getting this error too, I just generated a new API key and everything began working again.
      5:08 PM
      7/5/2023

    • @doords
      @doords 11 месяцев назад

      Did you hit the number of inputs per minute?

  • @automioai
    @automioai Год назад

    I Cant follow all the stuff that is going on brosss jaja, please stop, I need to finish my Solopreneur SaaS Xd.
    Thanks for sharing, Saved for latter😶‍🌫

  • @jared6157
    @jared6157 10 месяцев назад +4

    I tried this and it lost me $35k