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

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ส.ค. 2024
  • 🎓 Join my learning platform for module based courses, learning exercises, and more: coderprep.com/
    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!
  • วิทยาศาสตร์และเทคโนโลยี

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

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

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

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

    Beautiful art!

  • @727iamsam
    @727iamsam ปีที่แล้ว +1

    Super creative idea- great video!

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

      Thank you! Appreciate the comment 😁

  • @mmmar7317
    @mmmar7317 ปีที่แล้ว

    Nice tech, easy to implement and user friendly.
    Bump 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!

    • @babypandajr172
      @babypandajr172 ปีที่แล้ว

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

    • @boredguy1663
      @boredguy1663 19 วันที่ผ่านมา

      @@braeder What's the rate of success?

    • @braeder
      @braeder 19 วันที่ผ่านมา

      @@boredguy1663 zero percent

    • @braeder
      @braeder 19 วันที่ผ่านมา

      @@boredguy1663 zero. Because it is a hard problem to solve.

    • @TheFootballVib3
      @TheFootballVib3 วันที่ผ่านมา

      Doesn’t Alpaca only offer 4 day-trades per week? It’s impossible to run a bot with only 4 day trades

  • @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🔥🔥

  • @shaikhsanuar5339
    @shaikhsanuar5339 ปีที่แล้ว

    Creative video. Thanks. Wish to have more videos

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

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

  • @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.

  • @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 หลายเดือนก่อน

    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 2 หลายเดือนก่อน

    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 5 หลายเดือนก่อน

    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?

    • @NivLeibowitz-ok2lh
      @NivLeibowitz-ok2lh 4 หลายเดือนก่อน

      is it a coding enviroment called VScode

  • @SadSling
    @SadSling ปีที่แล้ว +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 ปีที่แล้ว

      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 ปีที่แล้ว

      Did you hit the number of inputs per minute?

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

    I tried this and it lost me $35k

    • @michaelconradi3359
      @michaelconradi3359 11 หลายเดือนก่อน +1

      oh really? How did this happen?

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

      was is it really so bad

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

      Details if true.

  • @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😶‍🌫