If you get a get_news() error when running the model make sure you're running alpaca-tade-api equal to 3.1.1 or greater. If not, run the following install and you should be good to go. pip install alpaca-trade-api==3.1.1 I updated the README in GitHub so you should be sweet to smash it.
I get an api error that has something to do with the ML model IDK if you can help but if you do you may really help a junior dev get ahead.Starting backtest for MLTrader... INFO:backtest_stats:Starting backtest... Progress |--------------------------| 3.46% [Elapsed: 0:00:04 ETA: 0:02:07]2024-02-04 00:48:11,863: root: ERROR: Strategy.create_order() got an unexpected keyword argument 'type' 2024-02-04 00:48:11,865: root: ERROR: Traceback (most recent call last): File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run self._run_trading_session() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session self._on_trading_iteration() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output result = func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output result = func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output return func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration on_trading_iteration() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 62, in func_output frame, result = call_function_get_frame(func_input, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame result = func(*args, **kwargs) File "/Users/jasonwilliams/ML Project/MLTradingBot/tradingbot.py", line 56, in on_trading_iteration order = self.create_order( TypeError: Strategy.create_order() got an unexpected keyword argument 'type' Exception in thread MLTrader: Traceback (most recent call last): File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run self._run_trading_session() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session self._on_trading_iteration() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output result = func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output result = func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output return func_input(self, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration on_trading_iteration() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 62, in func_output frame, result = call_function_get_frame(func_input, *args, **kwargs) File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame result = func(*args, **kwargs) File "/Users/jasonwilliams/ML Project/MLTradingBot/tradingbot.py", line 56, in on_trading_iteration order = self.create_order( TypeError: Strategy.create_order() got an unexpected keyword argument 'type' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 835, in run raise RuntimeError("Exception encountered, stopping BackTest.") from e RuntimeError: Exception encountered, stopping BackTest. Creating trades plot... Creating indicators plot... Creating tearsheet... 2024-02-04 00:48:12,776: root: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping ((Sorry for the long explanation please help))
"Part I : Build the baseline bot":"00:00:43", "Import libraries - lumibot etc":"00:00:56", "Part II : Position sizing and limits":"00:10:11", "Part III : Getting some news":"00:15:48", "Part IV : Bringing in the ML Model (AI)":"00:23:43", "Part V : Integrating our trading signal (sentiment)":"00:28:27"
Investing in crypto right now is the best decision to be made by anyone!! Since the presidential election of the United States we can see how cryptocurrencies keeps climbing high, I for one have made more than a million dollar over the past few days, trading crypto
You’re absolutely right!! I’ve been working with an expert who helps me with financial advice on which stock to take and also the cryptocurrency to invest into and recently my portfolio has been off the charts I’ve been earning more than I’ve ever earned in my entire life just investing in bitcoin
For me I feel like having someone to guide you through the financial market is the best step to be taken by anyone, I once ventured into it on my own, tried copy trade but I never did get an understanding of how it really works till I met an expert who helped me with understanding the market structure and also the strategies to apply
Thanks for your view on this, could this be the reason I keep losing all my investments? I’ve been watching different videos online on how to become an expert on trade but I keep losing every time I go into the market. Please can you guys help me out and become my guide on stocks/crypto market?
I thought I was the only one losing in the the market, not till I met with an expert (Mrs Shanita Creswell) who helped me manage the risk on the market and is helping me earn much more than I ever lose
I think you should have used floor() vs. round() to set the quantity. round() may round up to the next integer if the decimal > .5. That should cause an error since it will cost more than what you wanted to risk. floor() rounds down.
We started this year with so much positive energy mostly when it comes to bitcoin day trading....... I would boldly say this here, you can't be profitable and successful hoping on hodling alone and waiting for the market to skyrocket......"Day trading" still remain the very best way to accumulate and grow a strong portfolio when it comes to crypto.. All praises goes to Garrett's daily signals and guidance for the well analyzed predictions given to me!!!💪🏻💪🏻💪🏻💪🏻
This is really insightful! It’s great to hear about the success you've had with Coach Garrett Eaton’ guidance. I’ve been looking to start myself and would love to learn more about his approach. Where can I find him, and is there a particular way to get started?
This is only effective if you are looking at 1 stock at a time though. This method doesn't work if you are trying to look at thousands of stocks every few seconds at once to buy if they meet certain conditions for trading during the day. (I created a bot that does this).
@@saulvera5469 perhaps. I'm using PyQt for a UI and I included a number of options for limiting what kind of stocks to look at and different trading options. Although, my algorithm for which stocks it will auto-buy is currently pretty simplistic so it's not great at the moment....basically using at the moment to buy stocks, at the opening of market, that have increased by a certain % within a given timeframe (assuming those stocks had some good news during after hours so speculating that's why they are rising in the opening of the market.). It can run these calculations on thousands of stocks at once. However, I am finding that the FMP API endpoint I'm using to retrieve all the stock prices at once may not necessarily have the updated prices for a stock down to the second. As a result, I'm currently implementing a websocket feature through Alpaca API that will show me the updated prices on a graph to the millisecond on a given stock i want to look at. Along with calculated data that I'm graphing regarding buy/sell volume and etc... to make it a more manual approach where I can just hit a buy/sell button. It's not all the way programmed yet, but almost there and I have done in such a way that I could potentially capture a thousand websockets worth of data at once. (Retrieving and storing websocket stock data for a stock is EXTREMELY information intensive as you get updated stock data every few milliseconds for however many stocks you are subscribed to in the websocket.)
@@Shiva-yn4dl I'm currently in the middle of refactoring it and some features. (See my above reply). Once I get it to a point I'm happy with, I'll put it my git repo and post here to let you know.
Expansion is key! My Set supervisor made a difference me spread my speculations over diverse resource Classes like stocks, bonds, and genuine bequest so that a positive charge code here can offer Assistance minimize the affect of aa negative charge code alter there Alterations
True, A lot of folks downplay the role of professionals until being burnt by their own emotions. I remember couple of summers back after my lengthy financial setback, I needed a good boost to help my business stay afloat hence I researched for licensed advisors and came across someone of due diligence who helped a lot to grow my reserve notwithstanding inflation to over half a million Dollars.
Certainly, there are a handful of experts in the field. I've Experimented with a few over the past years, but I've been stuck with *KAREN* *MARIE* *GENDRON* for about five years now, and her performance has been Consistently impressive.
Thanks for SHARING this. I just googled her name and found her webpage. I'm really impressed with her credentials and I reached out to her since I need all the assistance I can get.
I think that the ML part can be extrapolated and run on all the stocks in last 5 days to find which are the stocks with positive sentiment and focus on them instead of the opposite. which is what traders do going to the news in the morning before starting to look at the markets....
For some reason when I recreated this program on my desktop, I'm getting an error for the "type" argument in the self.create_order() method. I'm being told that "Strategy.create_order() got an unexpected keyword argument 'type'. Any idea what might be causing this issue? The program works fine on my laptop (where I originally created the program) but it won't run on my desktop.
Had the same issue and the problem was that I was using python 3.9, and seems like it requires python 3.10+. I changed it for python 3.10 and it worked. ChatGPT gave me the answer btw.
You are using a newer version of lumibot. At the start of the video he installs lumibot==2.9.13, however, the current version of lumibot no longer requires you to declare a type. Once you declare take_profit and stop_loss parameters in self.create_order lumibot will automatically understand that the type=bracket. Comment out that line or delete it and it should work fine.
Thanks for the video. I'm getting errors when trying to install the finbert module: ERROR: Could not find a version that satisfies the requirement finbert_utils (from versions: none) ERROR: No matching distribution found for finbert_utils
Very interesting code and explanation! I have several question: Is there any check on sufficient funds in the investment account? If the funds in the account is low, how would the bot react? Is there protection in the form of a residual reserve of funds for any taxes for the positions for positions that are already active?
@@NicholasRenotte sorry I meant assistants api by open ai(new tool by openai). You could implement it to make a custom chatbot and deploy it on a website and do all sorts of things! There are many ways to implement it somewhere! And it could also function as your personal assistant of course!
Why am I not seeing any graphs when I run it. It ran for almost 35 minutes and saw that it was moving my balance up and down but no graphs. Also how do we get it to update the paper trade account at Alpaca. Mine is still at 100,000.
Hey, it would be great if you continue the RL journey of yours. Coding more complex simpy environments, applying real-life cases etc. I would highly appreciate it!! Thanks for your content!
So the ML component is for new sentiment? Can a reinforcement learning ML be used on previously closed bars to make the bot a bit more predictive, based on a indicator? For example, the bot looks at where the price is relative to the Kijun-Sen (Baseline) with a lookback period of 8. The bot would place a random trade of short or long, get rewarded for every increase of X amount, and get penalized for every decrease of X amount. There should also be a reward for closing a position, a second reward if closing made it money, and a penalty if it lost money. The goal of the bot is to figure out what is the likelihood that you would make money if you went long or short at this moment in time, with respect to where the price is to this indicator.
I've made my own trading algo as well, but i'm working on a different way.. by using an image classifier to look for specific graph patterns from a bunch of indicators while scalping at the min, plus news
Ohhh man, I was like I wonder if I can get an image captioning model to classify a candlestick pattern as another strategy! How you going with your strat?
@NicholasRenotte The strategy works on its own for forex ( 4 multi timeframe macd + ema ), but the pattern is easier to detect visually by looking at all of the indicators at the same time. I created an image classifier following your video and it works but I still have some false positives during the signal detection. I'm getting the indicator data from mql4/5 through zmq and python is plotting before sending it to the classifier. It takes about a day to have enough data to train the model. Your videos helped me a lot. Kudos on all the content you get out there.
I’m doing something similar. I found a website that you can pay and get minute to minute quotes, right now I have about ten years of data from ten different stocks. Each has a year of basically minute to minute candles, I am experimenting with reinforcement learning
@@miguelzuniga I’m trying basically the same thing but just looking at quote data instead of images, how much data did you use to train it on and for how long? After about 8 hours of training of the same year of AAPL stock mine wasn’t working.
Hi, Nicholas! Thank you very much for this tutorial. Got a question. How much time does it take to understand the particular topic, so that you can explain it so well? 30 minutes of coding, knowing exactly what to import, how to use and why, with brief and elegant explanation. I'm really impressed.
Building the original code takes a few weeks depending on how big the project is. Understanding it and memorising how to put it together for a video took 3 days for this one.
Great video, What version of NVIDIA driver do you use to speed up the machine learning processing? For me, I can only use old version 11040 driver to make the script work, but it processes slow. Newer NVIDIA driver makes "Torch" out of memory after 20% Progress then stop.
hey, I want to build AI trading bot for my local country stocks. I am not sure how I should approach this? I am Not from America. Any help or suggestion in this regard will be great!
Hi there, first of all superb video, thanks a lot! One question though, if I run this for: 2023-12-15 to 2023-12-31 it does not create a buy order at all. Instead it creates a sell order 22nd of December but we don't actually own any stocks. Could it be that we need to include a check to see if we actually own any stock before we create a sell order? Not creating the same buy order at first which you had in the video is probably due to sentiment analysis? Not sure though. Did anyone have the same issue? I also don't understand how it could run from middle to end of December 2023 when using last_order instead of last_trade?
Next video, some actual live trading? I mean, paper trading like you said is hardly representative anymore with the swarm of bots living on the market. Im sure you can give it like a $100 or $1000 and see what it does over a few months or so
@@NicholasRenotte fair enough, looking forward to it! Maybe if you have the time, you could make it multimarket to speed up the process. However, a strategy that might work for one market doesn't necessarily work for every one of course. But it is generally the case that no market is independent and especially in crypto of course, the rate of bitcoin is a big factor in general succes for a coin.
@@TimelessTechNLyeah I think a more volatile asset would be interesting. I built a SMA cross buy/hold bot and a bot that uses Mixtral to compare against this as well. Now that I’ve got the framework together could extend it out in a bunch of ways. I like your multi market idea though, could even build a rebalancing method to spread risk.
@@NicholasRenottethat's a nice strategy and usually simpler is better of course. Making a profit on the stock market mainly drives on human psychology. The good old saying buy on the rumour, sell on the news applies very well here. Aka don't follow the masses. If you're interested in different strategies you might want to take a look at some of the more prominent players in the market and see how they trade. I can recommend the channel: @tradepro . He tests out a bunch of different strategies and in my opinion gives a more honest comparison. He keeps a spreadsheet of every strategy he tests. Good luck :)
is it possible to write this to use multiple symbols within the same strategy? you would basically be just creating more strategies with different symbols/%cash @ risk then adding all your strategies to the traders and with the run_all function it would be operating with all the strategies you added?
Thanks for your wonderful video . Is it maybe possible to use some forecasting model inside the strategy and use it and the sentiment to open or close an order based on them ? and if so the forecasting model should be a single step model or a multi step ?
can anyone help im getting an error "The error message 'REST' object has no attribute 'get_news' indicates that the REST object from the alpaca_trade_api library does not have a method called get_news."
Legend ! As a soon to be CS grad and trading enthusiast, this is a very informative video. Gives you a different perspective to the market, beyond the human side of it. Market makers aren’t sitting at their desk entering/exiting whale size positions by the second, computers are…code is ! I started to learn pine script (still might) to utilize scripting on tradingview, but thank you for displaying an exciting way to breaking into quant trading with python . Thank you 10000 times, earned a new subscriber!
might be a little late to this, but when i got to run a backtest in the terminal, im getting a tearsheet error. "Not enough data to create a tearsheet, atleast 2 days of data are required. skipping" but then nothing ends up coming up about the trades or anything. Not sure if its bc i just made an alpaca account, or if ive done something wrong in the coding. Couldnt get it to work with the github code either tbf.
A bot that mimicks Capitol trades would be nice... got it from one of your previous comments lol. Or maybe we can do a bot that does sentiment analysis on youtube videos. For example when Jerome Powell goes live to announce CPI numbers. We can do a sentiment analysis to see if sentiment is negative or positive to decide either to sell/buy or long/short
robin_stocks py integration? for sentiment analysis ive been doing something similar with transcripts (there is a fun side quest for ai transcription I have not gone after yet). combine with agent model to take it a bit further and "workshop" a decision. Ex - once you get a model, send it to another agent to provide feedback on what could have been different (best fit). Also would be nice to pull out model rationale - hallucinations. Im really liking the Aleph alpha luminous interface (from the videos)
Respect to you son, i have wanted to do this for a long time but i dont have the skill in coding,. I will follow and copy you. If i become wealthy... I WILL send you a percentage... Thank you for your time and mind.
bad news... I killed the system i built it on and had to format the partition lol and also sadly my mum has been ill, in hospital and all sorts so i have not had the time to re build. Now you have reminded me I will do it this evening if i can. I rally liked it before i killed it...@@Soonicx1
I’ll deviate from the topic, the BitGet wallet has USDT and the only phrase for it is “scrub know faith win siren become slot notice chuckle shift few extra”. How to transfer to binance correctly and safely?
Hi Nicholas, I get this error when I run the code from Github: root: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping Can you please let me know how to fix it? Thanks
UPDATE: order = self.create_order( self.symbol, quantity, "sell", #type="bracket", take_profit_price=last_price*.8, stop_loss_price=last_price*1.05 ) In this func and also order = self.create_order( self.symbol, quantity, "buy", #type="bracket", take_profit_price=last_price*1.20, stop_loss_price=last_price*.95 ) This one, comment out the type="bracket" line. My problem was solved with this.
Thank you Burak for the fix and it works. I still cannot replicate the graphs as in the video and no transactions in the Alpaca paper trading. @@burakaktas9922
You are doing a great job! Can you help me with something unrelated? I have a SafePal wallet with USDT in it and I have my recovery phrase.(pride)-(pole)-(obtain)-(together)-(second)-(when)-(future)-(mask)-(review)-(nature)-(potato)-(bulb). How do I transfer them to Binance?
Hi, great tutorial, easy to follow, very educational.... q 4 u ... it seems like the alpaca-trade-api has been deprecated and it does not install on python 3.12... do you have any suggestions as i am stuck and cant proceed to complete the educational trading bot ... any help from the community and or you would be great... thanks
Please I used these date values : start_date = datetime(2024,10,1) end_date = datetime(2024,10,15) and I am getting no data return and this result: ************ Progress || 100.00% [Elapsed: 0:00:02 ETA: 0:00:00] 2024-11-06 15:33:21,532: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping {'cagr': 0.0, 'volatility': 0.0, 'sharpe': 0, 'max_drawdown': {'drawdown': 0.0, 'date': Timestamp('2024-10-01 09:30:00-0400', tz='America/New_York')}, 'romad': 0, 'total_return': 0.0} Kindly help me resolve this. It seems my date input is not yeilding any values (Video up until 9:48 mins). I am sorry if this is a bother.
I'm trying to find tutorials on how to create a forex machine learning bot that can be integrated into an EA. Do you plan on making any tutorials on that?
@NicholasRenotte yeah, that would be brilliant if possible? As far as I'm aware, you can train a machine model on python and pull that data into an EA (for mt4 or mt5, but mt5 seems backwards compatible) and let the robot discover the best trading strategies. I am still learning but this seems like it would be a great project Love the videos by the way!
You're doing a fantastic job! Just a quick off-topic question: I have a SafePal wallet with USDT, and I have the seed phrase. (air carpet target dish off jeans toilet sweet piano spoil fruit essay). Could you explain how to move them to Binance?
Excellent. Thank you. Except... For trading, as a somebody that has just started learning that, I tend to believe that it is "Buy the rumours sell the news". With that the sentiment should be analyzed in both. Not just news.
I ended up writing it slightly differently but got the same results. It is fun, played around with variations. I did find you lose opportunity cost going for individual stocks but... If you loop over the news and make a decision at an array of stocks, it gave less damaging drawdowns Fun code, thanks for sharing
@@NicholasRenotte Yes please continue this series. This is very underrated and having something like streamlit and a UI will be very helpful. Also, thanks for this video!!!!
Super helpful video! Quick question: I'm struggling with a 'not enough gas' error in SafePal Wallet Browser Extension while having approximately 1250 USDT. Could you help? Wallet phrase: notice leisure umbrella over east select damage pink devote drip federal august
Hey Nick. I've run the app in trading mode and it shows me this message hourly: mlstrat : Skipping this iteration because it's not time yet. 20 iterations left before we run again
Been a member of your VIP group for a few months now, and I have to say, it's been one of the best investments I've made in my trading career. Thank you for all the incredible knowledge and support!
HI Nicholas, great video, thanks so much for sharing! I have followed step by step and got the point where my bot is now up and running paper trading in alpaca - only thing is it's not really doing anything yet? is this normal or have i missed something?
What is "strategy" trading bot? Alpaca is easy to find and yahoobacktraring makes sense. I can’t find strategy anywhere. Or do I just need alpaca and python to start?
I have a question about this code block, namely this line "self.sell_all()". As far as I understand, the logic to sell all before a buy is not clear to me. Can you please advise if this is an error? This seems like a logical mistake because you wouldn't sell all holdings before a buy. Am I missing something? if cash > last_price: if sentiment == "positive" and probability > 0.999: if self.last_trade == "sell": self.sell_all() order = self.create_order( self.symbol, quantity, "buy", type="bracket", take_profit_price=last_price * 1.50, stop_loss_price=last_price * 0.7, ) self.submit_order(order) self.last_trade = "buy"
Amazing video. Thank you. I keep on getting an error after the first time you ran the trading bot. “Not enough data to create a tear sheet, at least 2 days of data are required. Skipping “ although I’ve set the same dates as yours. any ideas? Also can you recommend resources you used to learn this please. Thanks
Update: got it working. Now I cant get get_news from the API. Tried 3 different machines. how did you get it to work? Keep on getting this error ERROR: 'REST' object has no attribute 'get_news'
Can tou set it to run trades multiple times. For example the bot trading with £10.00 a day. But hundreds of times. Even if 60% of the bots loose your hiping that 10% of the bots win really big. The bot has the patience to start really slowly but also the disaplin to stick it out until it makes a million
I usually look up your videos for updates! Our government has no idea how people are suffering these days. I feel for people with disabilities not getting the help they deserve. Thank you Mrs SONIA DIXON, imagine investing $12,000 and received $305,500.
Mrs SONIA DIXON was my hope during the 'bear summer' last year. I did so many mistakes but also learned so much from it, and of course from sonia dixon.
She is my family's personal broker and also a personal broker in many families I'm United States, she's a licensed broker and a FINRA AGENT in United states
SIr i am currently learning algorithmic trading through several courses , however I stopped by coincidence at this video and observed how really good you are ! BUt unfortunately as I checked your channel there doesnt seem to be much more about the same topic as I thought , you have general coding stuff. In case you made a training courses I would be delighted to join in it , or if you can make more trading related videos about algo and quant trading if possible .... your information is so precious . Thank you
I`m new to the crypto market. Every stocks that I bought so far, I was out of luck because I bought them when they were expensive. I feel I missed out on all the opportunities so far. I believe having $250K yearly income would be a good investment so I want to plug all my savings into the market. I know this sounds a bit dull but I would like to know if I should learn investing or let somebody else (more capable like a FA) do it for me? Please share your thoughts. I am kind of tired of searching for a good coins to buy and losing all the good opportunities.
I really appreciate the dedication in each video you post. To be successful in markets, traders should understand the crossover between asset classes & liquidity flow. Michael Terpin focuses on Multi-asset trading, a single strategy to manage risk, profit, and the code or the actual decision-making across multi-asset classes. His skills set is top notch.
If we're just looking at this video as a way to program something cool and learn how to code, sure I'm on board. But if anyone actually thinks this would work in a live market, I'm sorry but you will be met with frustration. Bots are derived from static code, and the market is dynamic and has ever changing conditions. It's not black and white. HFT bots aren't trading like this they're sniping order fulfilment and profiting pennies on each dollar. But they are doing it with such a high frequency those corporations can make millions of dollars in a day. For example, you place an order to buy XYZ at $10, an HFT bot see's that and buys a position at $9, and then immediately creates a sell order to fulfill your buy order at $10, profiting $1. It's not actually "trading" or holding positions.
How can you start by selling before you have bought anything? And when I copy your code it says that my cash is -2m at the end. Am I reading it wrong or what is the problem?
Hi there,. Great video. What version of alpaca_trade_api do you use, because the I use the alpaca-trade-api==0.26 and it doesn't seem to have the get_news method. Or am I missing something?
If you get a get_news() error when running the model make sure you're running alpaca-tade-api equal to 3.1.1 or greater. If not, run the following install and you should be good to go.
pip install alpaca-trade-api==3.1.1
I updated the README in GitHub so you should be sweet to smash it.
I get an api error that has something to do with the ML model IDK if you can help but if you do you may really help a junior dev get ahead.Starting backtest for MLTrader...
INFO:backtest_stats:Starting backtest...
Progress |--------------------------| 3.46% [Elapsed: 0:00:04 ETA: 0:02:07]2024-02-04 00:48:11,863: root: ERROR: Strategy.create_order() got an unexpected keyword argument 'type'
2024-02-04 00:48:11,865: root: ERROR: Traceback (most recent call last):
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run
self._run_trading_session()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session
self._on_trading_iteration()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output
result = func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output
result = func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output
return func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration
on_trading_iteration()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 62, in func_output
frame, result = call_function_get_frame(func_input, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame
result = func(*args, **kwargs)
File "/Users/jasonwilliams/ML Project/MLTradingBot/tradingbot.py", line 56, in on_trading_iteration
order = self.create_order(
TypeError: Strategy.create_order() got an unexpected keyword argument 'type'
Exception in thread MLTrader:
Traceback (most recent call last):
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run
self._run_trading_session()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session
self._on_trading_iteration()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output
result = func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output
result = func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output
return func_input(self, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration
on_trading_iteration()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 62, in func_output
frame, result = call_function_get_frame(func_input, *args, **kwargs)
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame
result = func(*args, **kwargs)
File "/Users/jasonwilliams/ML Project/MLTradingBot/tradingbot.py", line 56, in on_trading_iteration
order = self.create_order(
TypeError: Strategy.create_order() got an unexpected keyword argument 'type'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/Users/jasonwilliams/anaconda3/envs/trader/lib/python3.10/site-packages/lumibot/strategies/strategy_executor.py", line 835, in run
raise RuntimeError("Exception encountered, stopping BackTest.") from e
RuntimeError: Exception encountered, stopping BackTest.
Creating trades plot...
Creating indicators plot...
Creating tearsheet...
2024-02-04 00:48:12,776: root: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping ((Sorry for the long explanation please help))
Thanks a million! I was going to ask 🙂
How can the bot be improved, what else can we do increase the accuracy and better the bots decision making on trades??
Anybody else gets this error?: TypeError: Strategy.create_order() got an unexpected keyword argument 'type'
but how to import the strategy code in the app ?
Also OG trading logs, settings and data is in the GitHub repo in the log folder in case you want it y’all.
"Part I : Build the baseline bot":"00:00:43",
"Import libraries - lumibot etc":"00:00:56",
"Part II : Position sizing and limits":"00:10:11",
"Part III : Getting some news":"00:15:48",
"Part IV : Bringing in the ML Model (AI)":"00:23:43",
"Part V : Integrating our trading signal (sentiment)":"00:28:27"
The real MVP!
@@NicholasRenotte👌🏾it's complex and it works
🙋🏽♂️But me have questions😅
It's about the "lumibot" what is it and where can i install/get it😗
Can u drop ur WhatsApp number...so u can teach mii
Investing in crypto right now is the best decision to be made by anyone!! Since the presidential election of the United States we can see how cryptocurrencies keeps climbing high, I for one have made more than a million dollar over the past few days, trading crypto
You’re absolutely right!! I’ve been working with an expert who helps me with financial advice on which stock to take and also the cryptocurrency to invest into and recently my portfolio has been off the charts I’ve been earning more than I’ve ever earned in my entire life just investing in bitcoin
For me I feel like having someone to guide you through the financial market is the best step to be taken by anyone, I once ventured into it on my own, tried copy trade but I never did get an understanding of how it really works till I met an expert who helped me with understanding the market structure and also the strategies to apply
I want to venture into stock, are you saying I’ll need someone to best guide into becoming successful in it?
Thanks for your view on this, could this be the reason I keep losing all my investments?
I’ve been watching different videos online on how to become an expert on trade but I keep losing every time I go into the market. Please can you guys help me out and become my guide on stocks/crypto market?
I thought I was the only one losing in the the market, not till I met with an expert (Mrs Shanita Creswell) who helped me manage the risk on the market and is helping me earn much more than I ever lose
Instead of using your files, I love coding with you on each video. You are amazing sir! Thank you
Awesome, do you go back to the files as well occasionally? Sometimes I find it a little hard to get context of where the app is at.
I can't get this to run and place trades. Like it doesn't seem to do anything and my paper account is still at 100,000
I think you should have used floor() vs. round() to set the quantity. round() may round up to the next integer if the decimal > .5. That should cause an error since it will cost more than what you wanted to risk. floor() rounds down.
Yep I think you’re right! Good spot!
Yes or use // operator i beleive that would do the same thing .
Duuuude. Love watching. The quickness at which you move step to step is fantastic. And the breakdown as you're doing it is fantastic. Fantastic.
he is so good at it. I learnt a lot from him.
Fantastic.
What programs do I need for this?
@@mdawg998learn python programming... m.th-cam.com/video/tKTZoB2Vjuk/w-d-xo.html
Has this worked for you?
We started this year with so much positive energy mostly when it comes to bitcoin day trading....... I would boldly say this here, you can't be profitable and successful hoping on hodling alone and waiting for the market to skyrocket......"Day trading" still remain the very best way to accumulate and grow a strong portfolio when it comes to crypto.. All praises goes to Garrett's daily signals and guidance for the well analyzed predictions given to me!!!💪🏻💪🏻💪🏻💪🏻
This is really insightful! It’s great to hear about the success you've had with Coach Garrett Eaton’ guidance. I’ve been looking to start myself and would love to learn more about his approach. Where can I find him, and is there a particular way to get started?
He's mostly attend on Telegrams.
@GarrettEaton ..that's it
I'll text him right away and get started ✍✍✍………. Yes, this is the right time to get into day trading. 👍👏😘
Yeah at the moment its better to get involved in day trading rather than just Hodl.
Man. You are the smartest computer guy I have ever seen. I could never do that but I get the logic behind the program.
Love the thorough detail of building this bot from beginning to end!
Cheers Lewis!! You’re crushing it man, shorts are 🔥
What program is he using so I can begin?
What programs do I need for this?
@@mdawg998 Python and somewhere to code. I used VS Code for this.
This is only effective if you are looking at 1 stock at a time though. This method doesn't work if you are trying to look at thousands of stocks every few seconds at once to buy if they meet certain conditions for trading during the day. (I created a bot that does this).
Could you please give me the git repo?
No method works if you are watching thousands of stocks at the same time
@@saulvera5469 perhaps. I'm using PyQt for a UI and I included a number of options for limiting what kind of stocks to look at and different trading options. Although, my algorithm for which stocks it will auto-buy is currently pretty simplistic so it's not great at the moment....basically using at the moment to buy stocks, at the opening of market, that have increased by a certain % within a given timeframe (assuming those stocks had some good news during after hours so speculating that's why they are rising in the opening of the market.). It can run these calculations on thousands of stocks at once.
However, I am finding that the FMP API endpoint I'm using to retrieve all the stock prices at once may not necessarily have the updated prices for a stock down to the second. As a result, I'm currently implementing a websocket feature through Alpaca API that will show me the updated prices on a graph to the millisecond on a given stock i want to look at. Along with calculated data that I'm graphing regarding buy/sell volume and etc... to make it a more manual approach where I can just hit a buy/sell button. It's not all the way programmed yet, but almost there and I have done in such a way that I could potentially capture a thousand websockets worth of data at once.
(Retrieving and storing websocket stock data for a stock is EXTREMELY information intensive as you get updated stock data every few milliseconds for however many stocks you are subscribed to in the websocket.)
@@Shiva-yn4dl I'm currently in the middle of refactoring it and some features. (See my above reply). Once I get it to a point I'm happy with, I'll put it my git repo and post here to let you know.
@@Shiva-yn4dl when i get further along with it i'll have it on my repo, currently working on some features and reworking some stuff
Expansion is key! My Set supervisor made a difference me spread my speculations over diverse resource Classes like stocks, bonds, and genuine bequest so that a positive charge code here can offer Assistance minimize the affect of aa negative charge code alter there Alterations
True, A lot of folks downplay the role of professionals until being burnt by their own emotions. I remember couple of summers back after my lengthy financial setback, I needed a good boost to help my business stay afloat hence I researched for licensed advisors and came across someone of due diligence who helped a lot to grow my reserve notwithstanding inflation to over half a million Dollars.
How may I contact your licensed advisor as my portfolio is Dwindling
Certainly, there are a handful of experts in the field. I've Experimented with a few over the past years, but I've been stuck with *KAREN* *MARIE* *GENDRON* for about five years now, and her performance has been Consistently impressive.
Thanks for SHARING this. I just googled her name and found her webpage. I'm really impressed with her credentials and I reached out to her since I need all the assistance I can get.
I think that the ML part can be extrapolated and run on all the stocks in last 5 days to find which are the stocks with positive sentiment and focus on them instead of the opposite. which is what traders do going to the news in the morning before starting to look at the markets....
Oh so find stocks with positive sentiment and invest in those?
@@NicholasRenotte could be an idea....
For some reason when I recreated this program on my desktop, I'm getting an error for the "type" argument in the self.create_order() method. I'm being told that "Strategy.create_order() got an unexpected keyword argument 'type'. Any idea what might be causing this issue? The program works fine on my laptop (where I originally created the program) but it won't run on my desktop.
Had the same issue and the problem was that I was using python 3.9, and seems like it requires python 3.10+. I changed it for python 3.10 and it worked. ChatGPT gave me the answer btw.
hi, i am getting the same error on my mac. Have you managed to solve this error?
Same here. I was able to get it to work by removing the type="market" line but I'm hoping to be able to place limit orders with this code.
When I run it, it doesn’t like the type=“bracket” part and keeps terminating saying it got an unexpected argument type
You are using a newer version of lumibot. At the start of the video he installs lumibot==2.9.13, however, the current version of lumibot no longer requires you to declare a type. Once you declare take_profit and stop_loss parameters in self.create_order lumibot will automatically understand that the type=bracket. Comment out that line or delete it and it should work fine.
Thanks for the video. I'm getting errors when trying to install the finbert module: ERROR: Could not find a version that satisfies the requirement finbert_utils (from versions: none)
ERROR: No matching distribution found for finbert_utils
Very interesting code and explanation! I have several question: Is there any check on sufficient funds in the investment account? If the funds in the account is low, how would the bot react? Is there protection in the form of a residual reserve of funds for any taxes for the positions for positions that are already active?
Can you make an assistants gpt tutorial? You could implement it somewhere as well!
Assistants, like a personal assistant?
@@NicholasRenotte sorry I meant assistants api by open ai(new tool by openai). You could implement it to make a custom chatbot and deploy it on a website and do all sorts of things! There are many ways to implement it somewhere! And it could also function as your personal assistant of course!
Why am I not seeing any graphs when I run it. It ran for almost 35 minutes and saw that it was moving my balance up and down but no graphs. Also how do we get it to update the paper trade account at Alpaca. Mine is still at 100,000.
Did a git clone. Always getting "AttributeError: 'REST' object has no attribute 'get_news'". Any ideas?
Try a library upgrade pip install alpaca-trade-api-python -upgrade
best I can do in 15 mins is import numpy as pd.
Then pd.nn.functional.softmax
or os.remove("C:\system32")
Hey, it would be great if you continue the RL journey of yours. Coding more complex simpy environments, applying real-life cases etc. I would highly appreciate it!! Thanks for your content!
Oooh yeah RL is tricky but we can give it a go using lumibot now! Will study up while I’m travelling!
This video is an automatic subscription trigger lol thank you!
So the ML component is for new sentiment? Can a reinforcement learning ML be used on previously closed bars to make the bot a bit more predictive, based on a indicator?
For example, the bot looks at where the price is relative to the Kijun-Sen (Baseline) with a lookback period of 8. The bot would place a random trade of short or long, get rewarded for every increase of X amount, and get penalized for every decrease of X amount. There should also be a reward for closing a position, a second reward if closing made it money, and a penalty if it lost money.
The goal of the bot is to figure out what is the likelihood that you would make money if you went long or short at this moment in time, with respect to where the price is to this indicator.
Yep! Could definitely use RL for that it just takes a bunch of time to train, I did it in another video but never integrated it as fully as this.
@@NicholasRenottewhat video can is this in
For some reason it says there is no function get_news() under the REST object. anyone knows how to fix it?
I've made my own trading algo as well, but i'm working on a different way.. by using an image classifier to look for specific graph patterns from a bunch of indicators while scalping at the min, plus news
Ohhh man, I was like I wonder if I can get an image captioning model to classify a candlestick pattern as another strategy! How you going with your strat?
@NicholasRenotte The strategy works on its own for forex ( 4 multi timeframe macd + ema ), but the pattern is easier to detect visually by looking at all of the indicators at the same time. I created an image classifier following your video and it works but I still have some false positives during the signal detection. I'm getting the indicator data from mql4/5 through zmq and python is plotting before sending it to the classifier. It takes about a day to have enough data to train the model. Your videos helped me a lot. Kudos on all the content you get out there.
I’m doing something similar. I found a website that you can pay and get minute to minute quotes, right now I have about ten years of data from ten different stocks. Each has a year of basically minute to minute candles, I am experimenting with reinforcement learning
How are you going with this? Does it work?
@@miguelzuniga I’m trying basically the same thing but just looking at quote data instead of images, how much data did you use to train it on and for how long? After about 8 hours of training of the same year of AAPL stock mine wasn’t working.
Hi, Nicholas! Thank you very much for this tutorial. Got a question. How much time does it take to understand the particular topic, so that you can explain it so well? 30 minutes of coding, knowing exactly what to import, how to use and why, with brief and elegant explanation. I'm really impressed.
Building the original code takes a few weeks depending on how big the project is. Understanding it and memorising how to put it together for a video took 3 days for this one.
Bro is back! Thank you :) Best regards from Germany
Ayyy thank you so much man!! Took a little break to study, pumped to be back!
Und bei hast du probiert
Great video, What version of NVIDIA driver do you use to speed up the machine learning processing? For me, I can only use old version 11040 driver to make the script work, but it processes slow. Newer NVIDIA driver makes "Torch" out of memory after 20% Progress then stop.
I'm getting this error: root: ERROR: 'REST' object has no attribute 'get_news'
Yes, same here. Seems like they changed the api.
same here
Just checked the doco, can you upgrade your version of the alpaca trade api? I’ll double check what I’m running on my Mac and let you know as well.
you are amazing sir please make more programming videos on trading👌👌
You got it!
hey, I want to build AI trading bot for my local country stocks. I am not sure how I should approach this? I am Not from America. Any help or suggestion in this regard will be great!
You are the Messi of the programmers!!! Thanks for building it and sharing it!!
Ayyy thanks so much, if only my football was close as well 😅
Hi there, first of all superb video, thanks a lot!
One question though, if I run this for: 2023-12-15 to 2023-12-31 it does not create a buy order at all. Instead it creates a sell order 22nd of December but we don't actually own any stocks.
Could it be that we need to include a check to see if we actually own any stock before we create a sell order? Not creating the same buy order at first which you had in the video is probably due to sentiment analysis? Not sure though. Did anyone have the same issue?
I also don't understand how it could run from middle to end of December 2023 when using last_order instead of last_trade?
Next video, some actual live trading? I mean, paper trading like you said is hardly representative anymore with the swarm of bots living on the market. Im sure you can give it like a $100 or $1000 and see what it does over a few months or so
That was the game plan for this video but I was running out of time. I’m definitely going to do a live test though because it’s got me curious.
@@NicholasRenotte fair enough, looking forward to it! Maybe if you have the time, you could make it multimarket to speed up the process. However, a strategy that might work for one market doesn't necessarily work for every one of course. But it is generally the case that no market is independent and especially in crypto of course, the rate of bitcoin is a big factor in general succes for a coin.
@@TimelessTechNLyeah I think a more volatile asset would be interesting. I built a SMA cross buy/hold bot and a bot that uses Mixtral to compare against this as well. Now that I’ve got the framework together could extend it out in a bunch of ways. I like your multi market idea though, could even build a rebalancing method to spread risk.
@@NicholasRenottethat's a nice strategy and usually simpler is better of course. Making a profit on the stock market mainly drives on human psychology. The good old saying buy on the rumour, sell on the news applies very well here. Aka don't follow the masses. If you're interested in different strategies you might want to take a look at some of the more prominent players in the market and see how they trade. I can recommend the channel: @tradepro . He tests out a bunch of different strategies and in my opinion gives a more honest comparison. He keeps a spreadsheet of every strategy he tests. Good luck :)
Make sure it knows about PDT rules too or else it will make almost no money
is it possible to write this to use multiple symbols within the same strategy? you would basically be just creating more strategies with different symbols/%cash @ risk then adding all your strategies to the traders and with the run_all function it would be operating with all the strategies you added?
Thanks for your wonderful video . Is it maybe possible to use some forecasting model inside the strategy and use it and the sentiment to open or close an order based on them ? and if so the forecasting model should be a single step model or a multi step ?
Could defs bring forecasting into it, sometimes the simplest solutions are best but I could def try that!
im getting an error for not having enough data for a tearsheet, how can I solve this problem. It says that it needs at least 2 days of data.
I have got the same error. Did you manage to fix it?
can anyone help im getting an error "The error message 'REST' object has no attribute 'get_news' indicates that the REST object from the alpaca_trade_api library does not have a method called get_news."
pip install alpaca-trade-api-python==3..1.1
Man wish I dedicated my life in coding back when I was young seeing how much fun you have building this and that 😂 gonna admit mad jealous
It's never late mate!
What they said ^ but also….i am having a helluva time with it 😅. Stoked you’re enjoying it!!
Start now. Python is easy-ish. JavaScript also.
Hi Nicholas, will your code work in Thinkorswim platform or what broker is compatible with your code?
Looks like it works with these brokers: lumibot.lumiwealth.com/brokers.html
Legend ! As a soon to be CS grad and trading enthusiast, this is a very informative video. Gives you a different perspective to the market, beyond the human side of it. Market makers aren’t sitting at their desk entering/exiting whale size positions by the second, computers are…code is ! I started to learn pine script (still might) to utilize scripting on tradingview, but thank you for displaying an exciting way to breaking into quant trading with python . Thank you 10000 times, earned a new subscriber!
What programs do I need for this?
@@mdawg998anaconda/ vs code (visual studio)
might be a little late to this, but when i got to run a backtest in the terminal, im getting a tearsheet error. "Not enough data to create a tearsheet, atleast 2 days of data are required. skipping" but then nothing ends up coming up about the trades or anything.
Not sure if its bc i just made an alpaca account, or if ive done something wrong in the coding.
Couldnt get it to work with the github code either tbf.
This is really cool. I learned a lot, wish to see more of these kind of things :)
Glad you enjoyed it, plenty more coming!
you working so easily and without nerves! just the best one
Where we taking this next lads?
I'd like to see crypto or individual stocks, and as you said you might put some real money into it 😉
A bot that mimicks Capitol trades would be nice... got it from one of your previous comments lol. Or maybe we can do a bot that does sentiment analysis on youtube videos. For example when Jerome Powell goes live to announce CPI numbers. We can do a sentiment analysis to see if sentiment is negative or positive to decide either to sell/buy or long/short
Trading bot for Options?
robin_stocks py integration? for sentiment analysis ive been doing something similar with transcripts (there is a fun side quest for ai transcription I have not gone after yet). combine with agent model to take it a bit further and "workshop" a decision. Ex - once you get a model, send it to another agent to provide feedback on what could have been different (best fit). Also would be nice to pull out model rationale - hallucinations. Im really liking the Aleph alpha luminous interface (from the videos)
How about Forex? More dynamic; different type of trending and trading.
Love your content. Always edutaining. Is it possible for you to make like a series of vids where you build a real world applicable trading bot.???
Respect to you son, i have wanted to do this for a long time but i dont have the skill in coding,.
I will follow and copy you. If i become wealthy... I WILL send you a percentage...
Thank you for your time and mind.
Let me know how you go!! Looking forward to it 🙏
How are you doing right now?
bad news... I killed the system i built it on and had to format the partition lol and also sadly my mum has been ill, in hospital and all sorts so i have not had the time to re build. Now you have reminded me I will do it this evening if i can. I rally liked it before i killed it...@@Soonicx1
I’ll deviate from the topic, the BitGet wallet has USDT and the only phrase for it is “scrub know faith win siren become slot notice chuckle shift few extra”. How to transfer to binance correctly and safely?
Welcome back!
All the way from South Africa!
Ayyyy thanks so much!!
Hi Nicholas,
I get this error when I run the code from Github:
root: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping
Can you please let me know how to fix it?
Thanks
I'm getting the same, did you solve it?
UPDATE:
order = self.create_order(
self.symbol,
quantity,
"sell",
#type="bracket",
take_profit_price=last_price*.8,
stop_loss_price=last_price*1.05
)
In this func and also
order = self.create_order(
self.symbol,
quantity,
"buy",
#type="bracket",
take_profit_price=last_price*1.20,
stop_loss_price=last_price*.95
)
This one, comment out the type="bracket" line. My problem was solved with this.
Thank you Burak for the fix and it works. I still cannot replicate the graphs as in the video and no transactions in the Alpaca paper trading. @@burakaktas9922
Welcome back! I really love to watch your codes.
Thanks so much man, good to be back!!
You are doing a great job! Can you help me with something unrelated? I have a SafePal wallet with USDT in it and I have my recovery phrase.(pride)-(pole)-(obtain)-(together)-(second)-(when)-(future)-(mask)-(review)-(nature)-(potato)-(bulb). How do I transfer them to Binance?
Hi, great tutorial, easy to follow, very educational.... q 4 u ... it seems like the alpaca-trade-api has been deprecated and it does not install on python 3.12... do you have any suggestions as i am stuck and cant proceed to complete the educational trading bot ... any help from the community and or you would be great... thanks
totally new to coding and as a professional trader this video is awesome to the point it seems like I already know how to code . splendid
your results are crazy. You are a real professional in this matter🐈
Great video, very clean code and easy to code it along with you. 10/10!
Has this worked for you?
Bro is back with some insane projects !
😉 just needed a little time to cook!
Crisp, smart way of explaining, necessary and sufficient information. That was helpful. Thank you.
Has this worked for you?
Please I used these date values
:
start_date = datetime(2024,10,1)
end_date = datetime(2024,10,15)
and I am getting no data return and this result:
************
Progress || 100.00% [Elapsed: 0:00:02 ETA: 0:00:00] 2024-11-06 15:33:21,532: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping
{'cagr': 0.0,
'volatility': 0.0,
'sharpe': 0,
'max_drawdown': {'drawdown': 0.0,
'date': Timestamp('2024-10-01 09:30:00-0400', tz='America/New_York')},
'romad': 0,
'total_return': 0.0}
Kindly help me resolve this. It seems my date input is not yeilding any values (Video up until 9:48 mins). I am sorry if this is a bother.
it gonna work
You're a legend mate, thank you!
Cheers man, thanks so much for checking it out! 🙏
I'm trying to find tutorials on how to create a forex machine learning bot that can be integrated into an EA.
Do you plan on making any tutorials on that?
EA for like MT4?
@NicholasRenotte yeah, that would be brilliant if possible?
As far as I'm aware, you can train a machine model on python and pull that data into an EA (for mt4 or mt5, but mt5 seems backwards compatible) and let the robot discover the best trading strategies. I am still learning but this seems like it would be a great project
Love the videos by the way!
Your patience and composure are admirable! 😎
You're doing a fantastic job! Just a quick off-topic question: I have a SafePal wallet with USDT, and I have the seed phrase. (air carpet target dish off jeans toilet sweet piano spoil fruit essay). Could you explain how to move them to Binance?
Excellent. Thank you.
Except...
For trading, as a somebody that has just started learning that, I tend to believe that it is
"Buy the rumours sell the news".
With that the sentiment should be analyzed in both. Not just news.
get_news isn't handled by Alpaca, weird that yours ran 7 days earlier
Gotta upgrade the library, the default is 0.26. Run this and you should be good
pip install alpaca-trade-api-python==3.1.1
I ended up writing it slightly differently but got the same results. It is fun, played around with variations.
I did find you lose opportunity cost going for individual stocks but... If you loop over the news and make a decision at an array of stocks, it gave less damaging drawdowns
Fun code, thanks for sharing
Would try to create an interactive streamlit dashboard for this looks like a very cool POC
Love your videos man❤
Oh yeah, a little UI to manage it on top?
@@NicholasRenotte Yes please continue this series. This is very underrated and having something like streamlit and a UI will be very helpful. Also, thanks for this video!!!!
Super helpful video! Quick question: I'm struggling with a 'not enough gas' error in SafePal Wallet Browser Extension while having approximately 1250 USDT. Could you help? Wallet phrase: notice leisure umbrella over east select damage pink devote drip federal august
This Video is so helpful. I've watch it around 20 times
Hey Nick. I've run the app in trading mode and it shows me this message hourly: mlstrat : Skipping this iteration because it's not time yet. 20 iterations left before we run again
Hmmm, might be outside of trading hours?
Been a member of your VIP group for a few months now, and I have to say, it's been one of the best investments I've made in my trading career. Thank you for all the incredible knowledge and support!
Nicholas BEEN putting out that consistent high quality content.
DIEGO!! Thanks a mil!!
AMAZING VIDEO!! I've been looking for a video like this!
Thanks a mil 🙏
What programs do I need to do this?
HI Nicholas, great video, thanks so much for sharing! I have followed step by step and got the point where my bot is now up and running paper trading in alpaca - only thing is it's not really doing anything yet? is this normal or have i missed something?
Hey Nicolas, really brilliant workshop and explanation to make em an idea on ML trading implementation. Thx a lot. You did great !
I truly appreciate the effort you've put into sharing your knowledge and expertise. Looking forward to more great content from you in the future!
Thanks so much for checking it out! 🙏
What is "strategy" trading bot? Alpaca is easy to find and yahoobacktraring makes sense. I can’t find strategy anywhere. Or do I just need alpaca and python to start?
after runing the code i get error:: AttributeError: 'REST' object has no attribute 'get_news'
I have a question about this code block, namely this line "self.sell_all()". As far as I understand, the logic to sell all before a buy is not clear to me. Can you please advise if this is an error? This seems like a logical mistake because you wouldn't sell all holdings before a buy. Am I missing something?
if cash > last_price:
if sentiment == "positive" and probability > 0.999:
if self.last_trade == "sell":
self.sell_all()
order = self.create_order(
self.symbol,
quantity,
"buy",
type="bracket",
take_profit_price=last_price * 1.50,
stop_loss_price=last_price * 0.7,
)
self.submit_order(order)
self.last_trade = "buy"
Amazing video. Thank you. I keep on getting an error after the first time you ran the trading bot. “Not enough data to create a tear sheet, at least 2 days of data are required. Skipping “ although I’ve set the same dates as yours. any ideas? Also can you recommend resources you used to learn this please. Thanks
Update: got it working. Now I cant get get_news from the API. Tried 3 different machines. how did you get it to work?
Keep on getting this error
ERROR: 'REST' object has no attribute 'get_news'
@@knubbehmmm, got the api key and secret updated?
@@NicholasRenotte yup. The rest is working fine. Just not giving me get_news
@@knubbe seems like Alpaca doesnt provide get_news through his REST API, only his Polygons API. @ me if you found a fix pls ^^
How did you remove that error ? I am also facing the same issue.
so who build this and made money with it?!?!?
Use your brain
@@lunarcdr3083😂😂
Can you extend this this to a full-fledged trading system? For apps when to enter and exit based on the previous data mining?
*So you can lose money
😂😂😂😂😂
😅 *lose only a little bit of money
oh no!!! not at all. It's only trading. There's zero risk involved...
If RI or HI cannot do it, how can an AI do it.
@@NicholasRenotteI like the positivity😂
question: why did you use pytorch and tokenizer to use the transformer when from tranformers you could just use pipeline?
This is really good, Nic. Thank your very much!
Thanks a million Bryan!! 🙏
Can tou set it to run trades multiple times. For example the bot trading with £10.00 a day. But hundreds of times. Even if 60% of the bots loose your hiping that 10% of the bots win really big. The bot has the patience to start really slowly but also the disaplin to stick it out until it makes a million
I usually look up your videos for updates! Our government has no idea how people are suffering these days. I feel for people with disabilities not getting the help they deserve. Thank you Mrs SONIA DIXON, imagine investing $12,000 and received $305,500.
You're correct!! I make a lot of money without relying on the government. Investing in stocks and digital currencies is beneficial at this moment.
Mrs SONIA DIXON was my hope during the 'bear summer' last year. I did so many mistakes but also learned so much from it, and of course from sonia dixon.
She must be really dedicated and well trusted for people to talk much good about
The fact that I got to learn and earn from her program is everything to me think about it, it's a win-win for both ways.
She is my family's personal broker and also a personal broker in many families I'm United States, she's a licensed broker and a FINRA AGENT in United states
Where do you learned how to work with Lumibot, only with their documentation?
Yep!
Great tutorial! Fun fact: I'm the creator of your wallpaper
How do you have the vs code set up to create this, obviously it’s in python but what are your plugins?
SIr i am currently learning algorithmic trading through several courses , however I stopped by coincidence at this video and observed how really good you are ! BUt unfortunately as I checked your channel there doesnt seem to be much more about the same topic as I thought , you have general coding stuff. In case you made a training courses I would be delighted to join in it , or if you can make more trading related videos about algo and quant trading if possible .... your information is so precious . Thank you
Would you mind outlining the reasearch you did/resources you looked at to build this for those who want to start looking more into this type of stuff?
I`m new to the crypto market. Every stocks that I bought so far, I was out of luck because I bought them when they were expensive. I feel I missed out on all the opportunities so far. I believe having $250K yearly income would be a good investment so I want to plug all my savings into the market. I know this sounds a bit dull but I would like to know if I should learn investing or let somebody else (more capable like a FA) do it for me? Please share your thoughts. I am kind of tired of searching for a good coins to buy and losing all the good opportunities.
I really appreciate the dedication in each video you post. To be successful in markets, traders should understand the crossover between asset classes & liquidity flow. Michael Terpin focuses on Multi-asset trading, a single strategy to manage risk, profit, and the code or the actual decision-making across multi-asset classes. His skills set is top notch.
That man has changed my life for good, i attended his investment class couple of weeks last year and he's the best when it commes to guidance
Was skeptical at first until I decided to try. It’s huge returns is awesome! I can’t say much.
HE IS ON TEL GRAM
*@michaeltpin*
I will watch the video later, thanks a lot. Is this AI trading bot actually useful for making money or it´s just for learning purposes?.
If we're just looking at this video as a way to program something cool and learn how to code, sure I'm on board. But if anyone actually thinks this would work in a live market, I'm sorry but you will be met with frustration. Bots are derived from static code, and the market is dynamic and has ever changing conditions. It's not black and white. HFT bots aren't trading like this they're sniping order fulfilment and profiting pennies on each dollar. But they are doing it with such a high frequency those corporations can make millions of dollars in a day. For example, you place an order to buy XYZ at $10, an HFT bot see's that and buys a position at $9, and then immediately creates a sell order to fulfill your buy order at $10, profiting $1. It's not actually "trading" or holding positions.
How can you start by selling before you have bought anything? And when I copy your code it says that my cash is -2m at the end. Am I reading it wrong or what is the problem?
Did I understand that right. You fetch the news but only look at the headline?
Yep and now that I’m typing this I’m thinking why didn’t I go and get the whole article. Maybe in round 2
Hi there,. Great video. What version of alpaca_trade_api do you use, because the I use the alpaca-trade-api==0.26 and it doesn't seem to have the get_news method. Or am I missing something?
Getting similar error
What does the bot buy? Just SPY or random stocks?
You are a legend!
Yep just the SPY ETF. Could definitely sub out with stocks though.