Algorithmic Trading with Python and Backtrader (Part 3)

  Рет қаралды 49,694

Part Time Larry

Part Time Larry

Күн бұрын

Пікірлер: 69
@parttimelarry
@parttimelarry 4 жыл бұрын
Like the video? Support my content by signing up for Interactive Brokers using the link below: www.interactivebrokers.com/mkt/?src=ptlPY1&url=%2Fen%2Findex.php%3Ff%3D1338
@nicolaschataignon6201
@nicolaschataignon6201 3 жыл бұрын
Hi I've been going through your binance API tutorial , now just going through the backtesting videos in detail before finishing the binance API and starting implementing my strategies. Your channel is great and this is a euphemism, your teaching method is spot on, you focus on the important information but there's just enough in what you say, search or with what's on the screen to help me search for additional information I miss (install additional modules, etc.). I'm a beginner crypto trader, if I can really call myself a trader, and I'm poor programmer, but with your help I feel I can really progress. Not expecting to get rich but at least I'm understanding a lot more and it gives me key entry points to keep learning, whether it's about programming or technical analysis, or the exchange markets in general. Fascinating stuff. This is brilliant ! Thank you.
@JohnDoe-vo6uf
@JohnDoe-vo6uf 3 жыл бұрын
i cannot find this code on your github. which repository is it in?
@sayakbhattacharyyakf
@sayakbhattacharyyakf 5 жыл бұрын
This is a super well explained video. Looking forward to the next one!
@parttimelarry
@parttimelarry 5 жыл бұрын
Thanks man, I appreciate hearing that so much. Definitely planning to do more, it is motivating to hear these are useful. More to come. Thanks for watching.
@sayakbhattacharyyakf
@sayakbhattacharyyakf 5 жыл бұрын
@@parttimelarry would really like some more videos in your style on other strategies + connecting to robin_stocks API for example and placing orders. your logic looks sound definitely should be able to bring in real returns.
@wglind
@wglind 4 жыл бұрын
@@parttimelarry Did you ever finish the series and implement with alpaca?
@upperlower3889
@upperlower3889 5 жыл бұрын
I have been going over backtrader and love your approach to explaining it . Seeing more backtrader strategies would be super helpful too, thanks :)
@flydr2
@flydr2 2 жыл бұрын
Many thanks for taking the time to create these informative videos
@syproductions456
@syproductions456 4 жыл бұрын
Larry, once again, your tutorial has helped me greatly. This information is absolute gold and you're going to make me very rich :P. I'll be sure to send you some bitcoin if it all works out. Your channel is under appreciated. You turned a subject that is difficult to understand/dry, into something clear, easy and fun. Thank you.
@parttimelarry
@parttimelarry 4 жыл бұрын
Thanks so much! I took a break these past few weeks, but much more to come.
@melsaied101
@melsaied101 2 жыл бұрын
Thanks for this awesome tutorial
@moodz9217
@moodz9217 4 жыл бұрын
you are legend man, please keep doing what are you doing.
@vladimirsaraikin6888
@vladimirsaraikin6888 3 жыл бұрын
Hello, Larry! I've tried a few times to find this file on your github but did not find it. Could you please give me the link?
@ihebbibani7122
@ihebbibani7122 3 жыл бұрын
One more subscriber. Thanks for making things "easier" for us. Keep it up
@jc_777
@jc_777 5 жыл бұрын
Could you go deeper and build a custom strategy with custom data without using examples in the official tutorial?
@justanotherguycalledchris7297
@justanotherguycalledchris7297 3 жыл бұрын
For the people reading this: You can create your own CSV's, they just have to have the same format as the one in the example. For example you can obtain historic data via the Binance API and then reformat it to match the format of this CSV and then just use it like shown here.
@parttimelarry
@parttimelarry 3 жыл бұрын
I have done a number of videos since this one where I use backtrader (this was my first exposure). Check out the last video of the full stack tutorial where I backtest Opening Range Breakout, for instance.
@MartyBower
@MartyBower 2 жыл бұрын
The markers on the plot seem misplaced to me. For example, the 5th buy and sell. The blue/red indicator at the top indicates this sell was a loss, but the green/red markers below make it appear to be a gain (inspecting the numbers in the log confirms it was actually a loss). Is this just a "feature" of matplotlib? Great series of videos - your voice over makes it so much easier to understand the code. Coding quickly and effortlessly on camera like this with so few errors demonstrates strong coding skills.
@BorrowedAtoms
@BorrowedAtoms 4 жыл бұрын
I don't understand how the print(self.order) thing works or should work - from what I see, self.order is simply assigned None so I don't see how it could print as anything other than None (which is what it does for me). Any clues please?
@pavloruzanov682
@pavloruzanov682 3 жыл бұрын
Same problem
@Hutspotpwns
@Hutspotpwns 3 жыл бұрын
​@@pavloruzanov682 add self.order = self.buy() in the last line of the next function
@sushilkv2004
@sushilkv2004 4 жыл бұрын
Thanks. Very useful and nicely explained. I tried to follow the BT quickstart guide initially but this made it easier to understand. Would like to wait more videos on strategies tested on backtrader.
@rui3767
@rui3767 4 жыл бұрын
Thanks for making such a video! It's really helpful!!!
@akshayparate9362
@akshayparate9362 3 жыл бұрын
cant find the source code for this.
@adamderose9468
@adamderose9468 3 жыл бұрын
1000 shares @ ~$25 / share = $25k .. n a final p/l +$17k is actually really good. thx for the video
@Zauoyds
@Zauoyds 5 жыл бұрын
Really nice content. You should continue with the serie.
@wilamshields
@wilamshields 3 жыл бұрын
is source code on github, followed link cant find it (i see from previous links you have not bother to upload source, shame as it is giving errors on PyCharm. Actual source may solve this)
@luizfernandolopes
@luizfernandolopes 5 жыл бұрын
Man!!! This is a great content!! Awesome! Hug from brasil
@Pvsmuntje
@Pvsmuntje 4 жыл бұрын
Can you post the completed code somewhere?
@andref9639
@andref9639 3 жыл бұрын
IF you have problems with ploting at VSCode, try to install matplotlib==3.2.2, it should work!
@80amnesia
@80amnesia 4 жыл бұрын
Thank you, the was really helpful. I wish I knew this library before
@rverm1000
@rverm1000 4 жыл бұрын
everything works great. but couldnt get it to display a chart. right after final portfolio value =1017520.00 [[Figure size 432 x 288 with 4 axes>]] do i half to tell it what the screensize should be?
@arcsha2336
@arcsha2336 4 жыл бұрын
Hey, Thanks Larry.. Awesome I coded all worked as you explained including TDA streaming(your other video). One question: how to integrate Backtrader functionality code (back tested strategy class) directly in the other TDAmeritade streaming example with less modifications. Other words leverage all functionalities(indicators & order stack/array) instead of building my own logic.? Appreciate your help.
@parttimelarry
@parttimelarry 4 жыл бұрын
I think you are asking about Backtrader live trading right? I actually haven't tried it yet, but I should. Added it to my list.
@arcsha2336
@arcsha2336 4 жыл бұрын
@@parttimelarry Yes, thats correct. Pls make one simple example with TD-Ameritrade broker(streaming) and back-trader strategy class(how to promote from back testing to real prod environment). Thanks again for adding the request.
@tommyypoon
@tommyypoon 5 жыл бұрын
subscribed, amazing videos and clear explanation. Looking forward to more backtrader videos
@thomas2004ch
@thomas2004ch 4 жыл бұрын
Great! Isn't possible to connect to IB?
@josephastrahan6403
@josephastrahan6403 4 жыл бұрын
Looking forward to the next one, when do you plan to make this?
@hpssskkk
@hpssskkk 4 жыл бұрын
Thanks Larry. This is awsome method to test trading strategy
@brianrowe1152
@brianrowe1152 3 жыл бұрын
You talked about taking the strategy live, but I can't find that video? Did that happen somewhere? Thanks!
@SolidBuildersInc
@SolidBuildersInc 3 жыл бұрын
Time Stamp 8:07 Larry, I don't know if I need glasses or if you need glasses or I am just WRONG, but at the above timestamp you are saying that you only made $17.52. Ok, again, I could be wrong but it looks to me you made more like $808,017.52 Please confirm. If you made this, I would like to revisit this strategy and dive into what it is doing. Thanks, lol This is unbelievable. Also, If you can illustrate how to pull data for multiple currency pairs with multiple time intervals for analysis. Without multiple time intervals (S5, S30, M1, M3, M5), of course it's a waste of time. Would be much better off doing trading off the port folio of the company and trading long term, but for scalping we need all the time intervals aligned like a tsunami.
@smjure
@smjure 4 жыл бұрын
Thanks for sharing, great videos with nice explanation!!
@cjfeat.2631
@cjfeat.2631 4 жыл бұрын
Up to this video for today. ^^ See you soon.
@CR-er6pi
@CR-er6pi 4 жыл бұрын
I really enjoy backtrader, so glad that I discovered it through this video! Before, I was trying to get zipline up and running, it is also a very good package. Backtrader is much more user-friendly however, and still offers more than enough functionality :) thanks for the video, thumbs up
@futurestadawul
@futurestadawul 2 жыл бұрын
Hi Larry thanks a lot for sharing these precious tutorials.. I have 1 issue if you can help me please.. I developed a trading system with Backtrader but I want it to execute ONLY 1 trade per day.. How is this possible please? Thank you in advance
@dorkokotek4872
@dorkokotek4872 3 жыл бұрын
Hi! I'm have a little problem, I did everything just as you said and for some reason my orser.status keeps going to Margin(7), do you know why this could happen?
@zeromodz
@zeromodz 3 жыл бұрын
I noticed your orders are executing a day after the trigger. That is also happening with my code. Any suggestions? Also, some of my orders aren't executing at all..
@srivindhya950
@srivindhya950 4 жыл бұрын
how to get those values in the tabular formal of buy created and sell created
@moodz9217
@moodz9217 4 жыл бұрын
can you explain how to add another data feed like binance coinbase etc
@ahmedzaoui9130
@ahmedzaoui9130 2 жыл бұрын
anyone else having trouble with the execution ? The code is correct, but the Buy and Sell orders aren't being executed :/
@manojmahanty8830
@manojmahanty8830 2 жыл бұрын
you should have mentioned a specific github code path instead of giving your list of repositories. how can one identify the code from your repository?
@maciekpaciarski9343
@maciekpaciarski9343 4 жыл бұрын
greetings.Great job .It explains a lots
@ploleo
@ploleo 2 жыл бұрын
This does not work for me. cerebro.plot() I got this error: AttributeError: _axes How can I fix it?
@mkd_gamer0413
@mkd_gamer0413 Жыл бұрын
you find solution
@NurburgringTrack
@NurburgringTrack 4 жыл бұрын
why do I get : SELL CREATED
@ihebbibani7122
@ihebbibani7122 3 жыл бұрын
Hi again , I have here few questions.... Question 1 : BUY CREATED & BUY EXECUTED --> Why do they have a different price ? SELL CREATED & SELL EXECUTED --> Why do they have a different price ? ASSUMED ANSWER :Is it because the stock is not available immediately for both orders ? Question 2 : Why I want to grab multiple csv files from local machine but i managed with a one line code with python to put them all in one variable . How to include this variable containing all my data in Backtrader ? (again from my local machine and not yahoofinance ....) Thank you
@ahmedbadal3795
@ahmedbadal3795 7 ай бұрын
2024 this was so awesome bro thans alot wished you could explain some of the codes any way tnx
@sunday-thequant8477
@sunday-thequant8477 4 жыл бұрын
Do you prove your algo in real time?
@kannansingaravelu
@kannansingaravelu 4 жыл бұрын
Can you make a video on backtrader interactive brokers capability with some real life example of algo execution of a strategy?
@parttimelarry
@parttimelarry 4 жыл бұрын
Hi thanks, signing up for interactive brokers so I can check it out. Will do a series on it.
@zaferatakan1082
@zaferatakan1082 3 жыл бұрын
my bot doesnt enter any trades, any recommendations ? class TestStrategy3(bt.Strategy): def log(self, txt, dt=None): ''' Logging function for this strategy''' dt = dt or self.datas[0].datetime.date(0) print('%s, %s' % (dt.isoformat(), txt)) def __init__(self): # Keep a reference to the "close" line in the data[0] dataseries self.dataclose = self.datas[0].close self.order = None def notify_order(self, order): if order.status in [order.Submitted, order.Accepted]: return if order.status in [order.Completed]: if order.isbuy(): self.log('BUY EXECUTED {}'.format(order.executed.price)) elif order.issell(): self.log('SELL EXECUTED {}'.format(order.executed.price)) self.bar_executed = len(self) # Write down: no pending order self.order = None def next(self): self.log('Close, %.2f' % self.dataclose[0]) if self.order: return if not self.position: print(len(self)) print(self.order) print(self.position) if self.dataclose[0] < self.dataclose[-1]: if self.dataclose[-1] < self.dataclose[-2]: self.log('BUY CREATE, %.2f' % self.dataclose[0]) self.order = self.buy() else: if len(self) >= (self.bar_executed + 5): self.log('SELL CREATED {}'.format(self.dataclose[0])) self.order = self.sell()
@pestibotond6841
@pestibotond6841 4 жыл бұрын
I can't visualize the data, because I get an error: "RuntimeError: The current Numpy installation fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: tinyurl.com/y3dm3h86 "
@anish_19099
@anish_19099 4 жыл бұрын
Please help me solve this error: Traceback (most recent call last): File "C:\Users\Anish\AppData\Local\Programs\Python\Python37\backtrad3.py", line 3, in from srat import TestStrategy File "C:\Users\Anish\AppData\Local\Programs\Python\Python37\srat.py", line 4, in class TestStrategy(backtrader.Strategy): File "C:\Users\Anish\AppData\Local\Programs\Python\Python37\srat.py", line 58, in TestStrategy cerebro.addsizer(FixedReverser) NameError: name 'cerebro' is not defined
@dfage33
@dfage33 3 жыл бұрын
good vids but this one is not too helpful. you make it up on the fly with little discussion of why, or where the commands are coming from. a diagram to start and then discussion of where new commands are coming from is necessary. otherwise this video is only for experts and experts do not need your help.
Finding Breakout Candidates with Python and Pandas
29:33
Part Time Larry
Рет қаралды 72 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Algorithmic Trading with Python and Backtrader (Part 1)
6:02
Part Time Larry
Рет қаралды 119 М.
PyAlgoTrade Tutorial (Part 3) - Technicals, Analyzers, and Plotting
23:39
Backtrader Live Forex Trading with Interactive Brokers (Part 1)
29:35
Part Time Larry
Рет қаралды 29 М.
Candlestick Pattern Recognition with Python and TA-Lib
24:11
Part Time Larry
Рет қаралды 117 М.
Paper Trading with the Alpaca API
17:49
Part Time Larry
Рет қаралды 81 М.
Backtrader Live Trading with Interactive Brokers (Part 2)
23:54
Part Time Larry
Рет қаралды 15 М.
How To Use ChatGPT To Analyze A Stock?
2:26
InvestGlass
Рет қаралды 55 М.
Technical Analysis Library in Python Tutorial
22:24
Part Time Larry
Рет қаралды 51 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН