Fireship · @fireship

How to buy Stocks with JavaScript // Algo Trading Tutorial for Dummies

Uploaded January 24, 2022 · Length 8:13

How to buy Stocks with JavaScript // Algo Trading Tutorial for Dummies

Summary

Build an algo trading app with JavaScript using Firebase Cloud Functions, GPT3, and Alpaca API to make real trades based on AI-powered algorithm.

  • javascript algo trading
  • firebase cloud functions
  • gpt3 api
  • alpaca api
  • stock market trading
  • ai powered algorithm

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    i've always wanted to make money with

  2. 0:01

    stonks but every time i listen to advice

  3. 0:03

    from guys on tv like jim cramer i lose a

  4. 0:05

    ton of money like a few months ago he

  5. 0:07

    told me to buy this technology stock

  6. 0:09

    called peloton but failed to mention

  7. 0:10

    it's just an exercise bike with an ipad

  8. 0:12

    strap to it lost 80 on that trade then

  9. 0:15

    last week he tipped me off to a stock

  10. 0:16

    called netflix that one's not going too

  11. 0:18

    well either and it's gone now i've got a

  12. 0:20

    second mortgage on my horse but

  13. 0:22

    thankfully i've learned the perfect

  14. 0:23

    investment strategy listen to jim then

  15. 0:25

    do the exact opposite of what he says so

  16. 0:27

    in this video we're going to build an

  17. 0:28

    algo trading app with javascript that

  18. 0:30

    can make real trades in the stock market

  19. 0:32

    based on an iron-clad ai-powered

  20. 0:34

    algorithm quick disclaimer this video

  21. 0:36

    does contain investment advice as long

  22. 0:37

    as your strategy is to be poor all i ask

  23. 0:39

    in return is that you hit the like

  24. 0:41

    button and subscribe the inverse kramer

  25. 0:43

    strategy is not unique but the problem

  26. 0:45

    is that i don't think there's a public

  27. 0:46

    api that provides jim cramer picks i had

  28. 0:48

    to sell my tv so i can't watch a show

  29. 0:50

    anymore which means we need to go with

  30. 0:52

    plan b we'll use the world's premier ai

  31. 0:54

    model gpt3 and ask it if jim cramer

  32. 0:56

    would buy or sell whatever stocks we're

  33. 0:58

    interested in gpt3 writes pretty much

  34. 1:00

    all my code these days with github

  35. 1:01

    copilot so it should really have no

  36. 1:03

    problem figuring out stock picks let's

  37. 1:05

    first take a look at the architecture

  38. 1:06

    and tech stack of this application first

  39. 1:08

    we'll need a backend server and for that

  40. 1:10

    i'm using firebase cloud functions i was

  41. 1:12

    going to use cloudflare because i felt

  42. 1:14

    bad about how far their stock has fallen

  43. 1:15

    after it was recommended by jim cramer

  44. 1:17

    but i think firebase is the best fit for

  45. 1:19

    this project we'll have a function

  46. 1:20

    running on a cron job during market

  47. 1:22

    hours that when invoked we'll make a

  48. 1:23

    call to the gpt3 api generative

  49. 1:26

    pre-trained transformer 3 is one of the

  50. 1:28

    most sophisticated and terrifying

  51. 1:29

    algorithms out there we can take a list

  52. 1:31

    of stocks and simply ask it if jim

  53. 1:33

    cramer would buy them or not and it will

  54. 1:34

    respond with a simple yes or no and we

  55. 1:37

    could even provide it more context like

  56. 1:38

    kramer's recent tweets and articles to

  57. 1:40

    nudge it in the right direction if the

  58. 1:42

    answer is sell then we'll buy if the

  59. 1:43

    answer is buy then we'll short sell now

  60. 1:45

    to trade a stock we'll need a broker and

  61. 1:47

    for that i'm using the alpaca api which

  62. 1:49

    is basically robinhood for developers

  63. 1:51

    also i'm deeply saddened and dismayed to

  64. 1:53

    report that the robin hood guys are no

  65. 1:55

    longer billionaires their stonk also

  66. 1:57

    tanked big time after being recommended

  67. 1:59

    by jim kramer alpaca is really cool