Fireship · @fireship
How to buy Stocks with JavaScript // Algo Trading Tutorial for Dummies
Uploaded January 24, 2022 · Length 8:13
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.
- 0:00
i've always wanted to make money with
- 0:01
stonks but every time i listen to advice
- 0:03
from guys on tv like jim cramer i lose a
- 0:05
ton of money like a few months ago he
- 0:07
told me to buy this technology stock
- 0:09
called peloton but failed to mention
- 0:10
it's just an exercise bike with an ipad
- 0:12
strap to it lost 80 on that trade then
- 0:15
last week he tipped me off to a stock
- 0:16
called netflix that one's not going too
- 0:18
well either and it's gone now i've got a
- 0:20
second mortgage on my horse but
- 0:22
thankfully i've learned the perfect
- 0:23
investment strategy listen to jim then
- 0:25
do the exact opposite of what he says so
- 0:27
in this video we're going to build an
- 0:28
algo trading app with javascript that
- 0:30
can make real trades in the stock market
- 0:32
based on an iron-clad ai-powered
- 0:34
algorithm quick disclaimer this video
- 0:36
does contain investment advice as long
- 0:37
as your strategy is to be poor all i ask
- 0:39
in return is that you hit the like
- 0:41
button and subscribe the inverse kramer
- 0:43
strategy is not unique but the problem
- 0:45
is that i don't think there's a public
- 0:46
api that provides jim cramer picks i had
- 0:48
to sell my tv so i can't watch a show
- 0:50
anymore which means we need to go with
- 0:52
plan b we'll use the world's premier ai
- 0:54
model gpt3 and ask it if jim cramer
- 0:56
would buy or sell whatever stocks we're
- 0:58
interested in gpt3 writes pretty much
- 1:00
all my code these days with github
- 1:01
copilot so it should really have no
- 1:03
problem figuring out stock picks let's
- 1:05
first take a look at the architecture
- 1:06
and tech stack of this application first
- 1:08
we'll need a backend server and for that
- 1:10
i'm using firebase cloud functions i was
- 1:12
going to use cloudflare because i felt
- 1:14
bad about how far their stock has fallen
- 1:15
after it was recommended by jim cramer
- 1:17
but i think firebase is the best fit for
- 1:19
this project we'll have a function
- 1:20
running on a cron job during market
- 1:22
hours that when invoked we'll make a
- 1:23
call to the gpt3 api generative
- 1:26
pre-trained transformer 3 is one of the
- 1:28
most sophisticated and terrifying
- 1:29
algorithms out there we can take a list
- 1:31
of stocks and simply ask it if jim
- 1:33
cramer would buy them or not and it will
- 1:34
respond with a simple yes or no and we
- 1:37
could even provide it more context like
- 1:38
kramer's recent tweets and articles to
- 1:40
nudge it in the right direction if the
- 1:42
answer is sell then we'll buy if the
- 1:43
answer is buy then we'll short sell now
- 1:45
to trade a stock we'll need a broker and
- 1:47
for that i'm using the alpaca api which
- 1:49
is basically robinhood for developers
- 1:51
also i'm deeply saddened and dismayed to
- 1:53
report that the robin hood guys are no
- 1:55
longer billionaires their stonk also
- 1:57
tanked big time after being recommended
- 1:59
by jim kramer alpaca is really cool


