I Gave My Terrible Trading Bot $10,000 to Trade Stocks
Вставка
- Опубліковано 3 чер 2024
- Thanks to DataStax for helping with the Trading Bot.
Sign up for Astra vector database today. Use your business email address and get from $1000- $3000 in free credits and consulting with your subscription: www.datastax.com/lp/astra-reg...
In this video, I build 3 stock trading bots with $10,000 of my own money to see if I can make a profit.
The first bot uses a mix of momentum trading and value investing on a set of "safe" stocks. It analyzes price and P/E ratio to determine when to buy and sell.
The second bot scans news articles for company mentions. If the news is good, it buys the stock. If bad news comes out about a stock it owns, it sells right away.
The third bot randomly selects a stock, finds related news articles, and uses AI to match them with Taylor Swift lyrics to gauge sentiment. If the lyrics are happy, it buys the stock. When negative lyrics come up, it sells.
I built the bots in Python, used historical data to backtest strategies, and ran them live for 3-4 days. Despite issues with delayed and partial orders through Interactive Brokers API, the bots made a small profit of $109. But after fees, I ended up losing $8 overall.
I learned that algorithmic trading involves complex math and mechanics like partial fills and sync issues. The real winners are the APIs charging for data. But I had fun developing the bots and dipping my toes into algorithmic finance and trading.
None of this would be possible without the support of my viewers on UA-cam and other platforms. Thank you for allowing me to take risks like this $10k experiment. I appreciate you watching my coding videos focused on building real projects. Please check the description for a special Discord event and to see other coding projects I've made like a Reddit bot and news bot.
MY NEWSLETTER 💌
thebetter.dev
------
DISCORD:
/ discord
CONNECT WITH ME ON SOCIAL
📸 Instagram: / lewismenelaws
🎚TikTok: / lewismenelaws
🐣 Twitter: / lewismenelaws
--
My gear 💻
liinks.co/lewismenelaws
-----
TIMESTAMPS
00:00 - Introduction
00:30 - Before we Start
01:00 - The 3 Trading Bots
02:02 - The Tech I Will Build With (AD)
03:30 - The First Trading Bot Build
06:10 - The Second Trading Bot Build
08:44 - The Taylor Swift Trading Bot Build
09:14 - Delivering Data Back to the User
10:33 - Deployment...
11:29 - The Results of Bot 1
12:16 - The Results of Bot 2
13:45 - The Results of Bot 3
14:46 - Results of Everything (Win or Loss?)
15:23 What I Learned from Coding This
17:06 The API Pricing.....
17:32 Thank You... - Наука та технологія
Hi everyone! Open sourcing this bot! I am just doing a couple of extra tweaks and security things in order to make it easy to read.
Warning though! The code won't be fun to read! Open sourcing will be an attempt for me to show you what I dealt with and how I did it :)
Should be up by later this week!
That is awesome! Thank you for the amazing content you are making!!
Hey Lewis, really looking forward to seeing this code in depth. Such an interesting video keep at it🤖
Where can we see the code?
More like a couple weeks...
@@thechampshrimp9337 God i know i am so bad with timelines. its almost done. will make a community post about it
This is awesome. I would like to do this as a hobby. But why do live trading when you can (I presume) do paper trading instead ?
Because the real💰💰is made in a life account! Paper trading is just demo.
Well put :)
It’s not so easy doing it as a beginner I’d say learning a second language is way easier than this lmao
Eh, one thing I know certain about the market, as long as you don’t do anything silly and you’re going about it with a systematic approach, every situation can in turn be profitable!…
Risk management & Psychology are the ‘nuts and bolts’ of this industry.
now imagine if you were able to run this for a month let say, the trading fees and other things would become a not that significant cut of your profits, but considering the bots actually perform like this continually.
Or if he scaled it up giving the not 100k?
@@DamianVaz sure but i would think a bot should be much more polished for able to be trusted it with 100k,
@@DamianVaz I don't trust myself with $10,000. Let alone $100,000
Wrong. He would probably lose most of his money. He just gained anything in this time period because the market melted up these past 2 weeks.
@@xthesayuri5756 Maybe we need an update
I don't think enough people are apresciating how insane the results from bot 2 are! Even though the profits are not sky high, doing 9 trades and have only a single negative one is mental. I would really like to see it running longer and maybe some updates!
Same here!
Or less time use leverage trading to increase profit and losses
89% win rate for a bot is basically unheard of. It did only run for a few days but damn
The real question is if it outperformed the market as a whole
@@ryanignites5923 TBH, that's not a small detail. Some days are just good market-wide so nearly anything is profitable in the short term. A good test would be beating SPY average returns for a few consecutive years. Even if something is profitable, if it's less money than just buying and sitting on SPY than it's not worth the effort.
The most gratifying thing is reaching a point where we can be the reason for someone else's livelihood. Congrats Lewis.
This channel is seriously underrated, I cant believe this kind of content only has this little views. Keep going Lewis!
Some of you have been wondering why I haven't been posting as much... this is why! I spent SO LONG on this... I am so glad I can do this! Let me know if you want me to open source the code. (I will remove the Interactive Brokers part lol)
UPDATE: Going to be open sourcing soon. Have been dealing with some burnout and some other tasks. Will get up asap!
Only 2 minutes into the video and can already tell that in the long term, Swift-Trade 1.0 will be the foundation for all future alpha in the markets. Please release the code!
And thanks for all the awesome content on the channel!
Great video! I’d love to test something like this if you could provide the GitHub link that would be great! Thanks man!
Please open source the code!! Thanks so much 😃
Yes please OS it. This video was AWESOME. By the way. Excellent work. Worth the time.
Yes please! I have been trying to do something like that for a loong time. So that will help me a lot.
I'm not exactly surprised but it was super interesting to me that the news bot was the most "effective" overall. (making the most trades, green on almost every trade) I do seriously wonder what that bot would look like over a month, or even 6 months. However, as you mentioned, API costs are an important consideration
The news have the same effect as a stock price pumping campaign on pennystocks . regular stocks are just no that volatile. But the news bot basically does the same as traders that knowingly buy into a pump and dumb scheme, planing to exit the commitment before the fraudsters, dump their shares.
"How hard can it be? Buy high, sell low!"
You sure got me hooked! 😄👍
The greatest tech channel, Lewis makes videos fun and informative for every developer regardless of their software speciality.
Also the editing is OP
My man really gave the bot money instead of giving it hypothetical currency and letting it track the value of it for the sake of an effective test
The amount of effort that goes into the animations for your videos is insane. I respect the effort + ofcourse the time it takes to write three trading bots :p
I stabled across these questions after comparing my research on such bots:
1) doesn't this fall under PDT (Pattern day trading) and wouldnt you need 25k$ in your account to legally trade?
2) what AI did you choose for the news articles and maybe share a video on how you combined those generated stock vectors
3) how did you handle opening and closing hours, was it though the API or made your own script to check the time and wait till open hours?
P.S thank you for the statistics and the whole process/time you spent making this and if possible open soruce it ❤️
1) no idea! That’s way over my head lol
2) I used DataStax vector database but used OpenAIs embedding model to do the search.
3) I just stopped and started the scripts on opening and close lol. I had a condition in their anyway that would cancel any orders on hold so it would’ve just cancelled out
@@CodingWithLewisthank you for sharing!
he's Canadian, he doesn't have to worry about PDT
PDT applies only to US residents
Amazing video, loved the graphics and animation you used. Would love to see more about the technical side in future videos. Keep up the great work!
We love u!!!! Ur content is really good, keep it up
U really grew the interest of coding in me, thanks Lewis!!!
Your editing is... just wow, greatest tech channel, seriously underrated
"Buy high. Sell low" wow I've never thought of that. If you buy $1000 worth of stock and you sell it when it goes to $900, you'll make a -$100 profits 😮
now do that often enough you get an integer overflow and you're a gazillionaire
In day trading you can buy stocks for higher prices and sell it when it drops for a profit
@@Sumit-wo8pq You can never buy high and sell low for a profit. You are talking about selling high and then buying low.
Awesome video lewis, keep these awesome projects coming!
The effort to make this video is commendable
Thank you!
sup lewis@@CodingWithLewis
your teaching is insane ur voice is soft it makes easy to understand thank you !
Love it how you said buy hi sell low 0:37 😅
This is crazy! keep up the good work
Insane amount of works. I build my own tiktok bot using your video on it, in java, and included OpenAI calls & automatic uploads
For the first bot, you could try random parameters and then automatically adjust them based on the outcome. You could also be really extra and use ai
I made one of these and I make like +3 dollars a day it just is a basic system that compares a ton of stocks selects the two best contenders to split the money between and then just detects when the stock is at its highest in the past X days and sells it
It kinda sucks but I have not implemented back testing and have it sell if it goes 1 dollar over set
in the middle of the video, and you just said based on an AI of Taylor's lyrics, I'm cracking up, loving this !
I love when UA-camrs appreciate the viewers who are indirectly employing them through eyeballs and time. In 'Hollywood', we in the audience might get that if someone wins an award, but in general, it just does not happen much, if at all..
Considering these bots are not running with enough capitol to move a market you can run them without actual money to see how they perform.
Loved this. Thanks Sir !
Buy low sell high alone is already a pretty good tactic if you don't care about pace in and amount of earning money at all - because you can basically use no leverage at all and buy many low stocks - if they're high enough you can sell them, if they get low - you don't touch 'em at all - no matter how bad they go you can't lose more then you put in and so you let it stay until it's either completely gone (well bye bye money) or there will be eventually a point when they go back up and over long term it's more likely if you started low that it's going up then disappearing completely so you would make profit - not much and also not fast, but that's kinda safe - did that before and made approximately 120€ out of 100€ in one year of really watching it the whole time, so yeah I'm lucky I didn't had to live from that money because - yeah 20€/year isn't anywhere near enough to live from and as I had no time to work while doing that I'd be fucked if I'd to live from that, but still it's way more than you get from a credit, but with 50hrs/week of work vs. no work at all it's not very good, but it totally works 😂
honestly I like these bot based videos as im quite interested in automation of daily boring stuff
Okay look;
I am gonna be honest; I've been trying to crack how to do this for years. I've had many successful first / second attempts -- but I've never been able to get it to work how I wanted it to.
This was insanely cool to watch, and I cannot wait to see the open source files.
Thank you for restoring my confidence in the world and coding.
Here is a sub, you deserve it.
Quality content , super beautiful videos nice job!
Insane dude! I was smiling on whole video!
Glad you enjoyed!
I think this has been one of the most interesting videos I’ve watched
I think you should also try to create a bot that would buy/sell based on insider trading. Because for most companies you can look up what the higher management doing with the stock, whether they are buying or selling
That thank you at the end was very sweet
A trading bot cannot really be terrible per se. If it could predictably be terrible you could just do the opposite and have an infinite money printing machine.
Out of all the expenses, how much of it was a one-time vs re-occurring? That definitely changes numbers in the long-run if the bots were used for mid to long-term.
I have built bots professionally for a while now. Most bots are more focused in keeping themselves safe from black swan events while sustaining a consistent growth, chasing higher profits is chasing righer risks, by definition, and most rich people dont want to play around with their money.
Banger content Lewis! Love this stuff and it deserves way more views! Found u from shorts and realising you do quality long form content is a big surprise as most shorts creators just do shorts cause it gets tons of views ahaha
I just found your channel and subed this was a fun video.
Great insight on the pickaxes story! Why gamble when you can just enable the marketplace!
wow great job man im a big fan of this channel now
This was amazing. I watched the full video.
I really enjoy your complete non-aversion to risk. Honestly thought the news bot would do way worse hahaha.
Me too... but honestly I think long term it might have been bad. anything for views!
@@CodingWithLewis You could maybe use fake money so instead of really buying in you just log or insert some data into your database, about what the bot would have bought and when you sell your stocks you log/insert data what you would have made/lost when selling it. And than keep that up and running for a while and check the results.
news sentiment analysis is at the cutting edge of stock prediction but its main limitation is getting up to date news
That's no fun
@@jaspervandijk27
Amazing and genuine content!
Would be interesting to compare your results to simply buying and holding something like SPY over the same period.
This Video was really intersting to watch! :D
Amazing vid Lewis, great ideas here
Sucks that this video didn't get more views cause it was really good, although only a week old so maybe will spike. This video was very good, very entertaining, really glad you made money.
It [mostly] self funded this knowledge and experience gathering exercise, which is worth it in my book.
This reminds me of using a goldfish, cat or monkey to pick stocks (that all has been actually done). Consistent with the EMH, whatever you're picking, you can expect the market return on average (of course: before fees, more or less if you're biased toward some factors, etc.), but with more volatility because you're picking a relatively small number of stocks. I would expect the second, more clever one, to perform the worse on the long run (assuming it's working as intended) because it would be replicating what emotional humans do: sell low when the news is bad, buy high when the news is good. Fun and interesting coding project though!
Amazing editing!
Thanks for sharing! Would be cool to see a comparison to the SP500 for the same time interval.
Congratulations, you are one of the few people who have made money going long(ish) on GameStop! 😄
Should have included the market indices performances during those days. To compare the results to.
Awesome Video !!
i think its good idea, but if u want to go with it u need more data to back it up
how did it determine position sizing?
also what's the best ML model to play a game of hangman?
Lewis, Am Brian from Uganda,,,,Great work, you inspired me to join software engineering
This is awesome. Out of curiosity, what news source did you use?
Great video guy 👍.
Just started the video, bro has gotten me hooked with the Swift trade... Cannot wait to see how this turns out >:)
Welcome aboard!
Combine the first two bots one that way based on new data and the slope it’ll choose to buy or sell
I’d love to see an in-depth video about the creation of these models
You are very talented and hardworking. 😮
Transaction costs ignored, finding a terrible, loosing trading strategy is equally hard as finding a winning strategy. As you could just invert the first one into a winning one.
How would that work ? You can't just invert that '1 worst stock' to figure out which one will win ? You could attempt shorting, but I'm not sure this was the focus here
@@werneryc Exactly... by shorting! When the terrible algorithm says "buy" then you sell (short) and when it says "sell" then you buy back. Note that shorting is very easy and can be replicated by options (called a synthetic short). So your broker doesn't even need to offer shorting. But obviously there is no guaranteed winning or loosing strategy. If that would exist everybody could extract money in a zero-sum-game.
Since the stock market is nearly efficient, any news article will already be priced into the stock by the time you see it. buying/selling when the stock is doing good/bad should also not work in expectation. if it did someone would be doing it already and capturing all the gains
News & Financial reports. Very important.
I think with that one loss, it would’ve benefited with a bit of technical trading knowledge of market cycles. It might’ve been stalling.
2/3 of the bots were news related and made a profit. So news are very important.
Incredible work
It's pretty cool, I'm planning to make a trading bot for a while
This was a really funny combination of coding and money. good stuff!
The best polish trader lately did an experiment where he would let his hamster trade cryptocurrencies. By spinning the wheel it picked the currency pair and it had two tubes to run through - one was for buy, other for sell. I don't know how it has finished, but for sure there was a time where it made profit :D
I really like your videos :)
nice video. a video about how you edit would be cool too
Grid bot. 10k, 200 orders, 1% order gap. Scale profits into orders. Looks like a mountain, bowl, or equal line if graphed. 50c profit - fees per trade cycle, exponentially.
Such a grid will eventually run out the top or bottom. Hopefully the top. Track your average buy price + profits accumulated relative to the spot price. With enough trades captured you can just keep walking the grid down without losing anything.
5 or 10% is better but you'll see a lack of activity. But you will win harder.
I hope you're able to run some longer tests with these bots some day. 3-4 days is not really enough time to see much stock movement, and while I don't stay up to date with market trends, someone in the comments said that you got lucky and managed to pick a time to run the test when the markets had a general upturn so if that's true, the results of this test doesn't really speak much to the viability of doing something like this on a longer timescale.
Doing it for real would probably mean having to carefully parse a lot more news data and add a lot more trend and market analysis parameters though, so it might not be a great idea from a financial perspective to do it.
I know that at least eToro has a virtual trading mode where you don't use real money. I don't know if they have any APIs that you could use, but maybe it would be possible to just feed it the market data and have it output it's purchases to a local database or something.
the editing is so sick
Liking before I even watch bc I know it's going to be awesome
Any chance this code is public on github or similar?
The most important thing was left out, that is did you beat or match the index
This is amazing, would love to look at the code! But I can’t find the repo link!😅
this project is insane!!!!
I will be forever grateful to you, you changed my entire life and I will continue to preach on your behalf for the whole world to hear you saved me from huge financial debt with just a small investment, thank you Claudia Jenkins.
Wow. I'm a bit perplexed seeing her been mentioned here also Didn’t know she has been good to so many people too this is wonderful, i'm in my fifth trade with her and it has been super.
Jenkins' expertise in customizing investment portfolios based on changing market conditions and personal risk profiles is exceptional. It's not a one-size-fits-all approach, which is crucial in crypto investing.
What impresses me most about Claudia Jenkins is how well she explains basic concept of winning before actually letting you use her trade signals. This goes a long way to ensure winning trades.
You trade with Claudia Jenkins too? Wow that woman has been a blessing to me and my family.
I'm new at this, please how can I reach her?
Is there a more detailed thought process behind it? Even just an article?
What is the overall market performance during that time? It's easier to make money by holding stocks when the stock market is up on average.
I wonder if more time was spent running the programs, would they climb themselves out of the +$8 loss. It seems like if they ran for a couple of more days, they would've continued to make consistently similar decisions, resulting in higher wins over losses. And depending on the going rate for the request limits and the cost of the API's, it may turn a profit. But I wouldn't be able to tell without fully understanding the costs involved.
I take the broker-fees were not factored in into the profit/losses - if it was most would likely have been negative...
Could you run a backtest for the last few weeks? Would be very interesting.
So there's no Pepperstone or XM in Canada? You know, the trading bot platforms without commision fees?
From the start I was like, "buy high, sell low"? pretty sure you're supposed to sell high and buy low
I would love to watch monthly results, even with small money or none, just %
Curve fitting at its finest.
i think you should build a bot based on snoop dog lyrics. then the bot select high stocks.
you should make the first two programs public
4 days of running is literally nothing. You just got lucky with this, I would like to see a comparison of the backtest results across the last 3 years. I bet all 3 years would lead to a completely different result.
0:33 Am I the only one that noticed he said buy high and sell low?
That was a joke, self irony
Nice vidéo !
alright i need that third bot.