QuantStats: Portfolio Analytics with Python Tutorial

  Рет қаралды 29,636

Part Time Larry

Part Time Larry

Күн бұрын

Пікірлер
@parttimelarry
@parttimelarry 3 жыл бұрын
If you like this video and want to support the channel: Buy Me a Drink: www.buymeacoffee.com/parttimelarry Also, I will be starting a spinoff channel on AI in music, art, and gaming in 2023. Subscribe at: youtube.com/@parttimeai Source Code: github.com/hackingthemarkets/quantstats-demo Buy Me a Coffee: buymeacoffee.com/parttimelarry Follow Me: twitter.com/parttimelarry
@brightosisiogu2626
@brightosisiogu2626 3 жыл бұрын
Wow! Larry! You are aging backwards! So much fresher and younger! Thanks for yet another amazingly educative content.
@rajpillai865
@rajpillai865 18 күн бұрын
Thanks!
@Caminovic
@Caminovic 3 жыл бұрын
Hi Larry, nice to see you back!!
@Patiencelad
@Patiencelad 2 жыл бұрын
Great stuff! Thanks for putting this together. I actually needed to use this with a custom return stream, and although you didn't go into it, seeing you delve into the code helped me find what I needed.
@alihobballah
@alihobballah Жыл бұрын
This is amazing content !!! quality presentation ! Thank you for making this video.. It's so useful !!!!
@idevbrandon
@idevbrandon 3 ай бұрын
I love it and learnt so much from you. Thank you! Have a good day, bro :)
@PavelSumik
@PavelSumik 3 жыл бұрын
Larry is just a leader in programming, my incredible admiration, I send greetings
@FRANKWHITE1996
@FRANKWHITE1996 3 жыл бұрын
Thanks for sharing! 👍
@javadvahedi6278
@javadvahedi6278 3 жыл бұрын
Many thanks for your great channel. The video on quantstat was great. A suggestion for next video, would you please have a video about amix strategy based on two indicators, SSL and QQE.
@revenge9431
@revenge9431 3 жыл бұрын
Special thanks to Ran Aroussi and PTL as well!
@rithirongk
@rithirongk 2 жыл бұрын
very informative, thx.
@richardchu1593
@richardchu1593 3 жыл бұрын
Hi Larry, unrelated to this video, but I would like to suggest some potential ideas for future video series/topic: (1) News to Penny Stock Day-Trading: A SQLite database to fetch and store a list of penny stock news for the day during pre-market from TD Ameritrade, than maybe quickly run a NLP against the news articles to return 1 to trade, 0 to pass. Same concept can be applied to Crypto/Binance?
@NoToBusinessCasual
@NoToBusinessCasual 3 жыл бұрын
Great topic.
@DevAtul
@DevAtul 3 жыл бұрын
Hi Larry, Thank you for such a good content on Python and finance. I am binge watching your videos. I have a request. There is a paper by Jegadeesh and Titman where they are showing the efficacy of Price momentum and somewhat disproves "Efficient Market Hypothesis." Can you create that portfolio and backtest using Python? Thanks.
@Ro1andDesign
@Ro1andDesign 3 жыл бұрын
Hi Larry, interesting video yet again! Can this library also plot dynamic portfolios and strategies, so non buy-and-hold? E.g. combine this with the ARK invest etfs, but through time based on changing holdings within the etf/portfolio Would love to see it!
@samueltamayogaviria3377
@samueltamayogaviria3377 2 жыл бұрын
hello, is there any way to import a csv with the returns of a personal trading strategy?
@vdzneladze1
@vdzneladze1 3 жыл бұрын
Larry thank you for great tutorial. I began to worry about 3 weeks pause.
@insected83
@insected83 3 жыл бұрын
hot off the press!
@franky12
@franky12 2 жыл бұрын
Great tutorial. I would be interested to know if and how quantstats can also be used for dynamic portfolios, e.g. to analyze trading strategies in backtesting.
@thomas2004ch
@thomas2004ch 3 жыл бұрын
Interesting! But it seems the portfolio is simply buy and hold. How about if I simply use the SMA cross over strategy? It would be very nice if you could give such an example.
@illsdom6055
@illsdom6055 2 жыл бұрын
Is it possible to do a portfolio backtest on the asset allocation of the stocks?
@franky12
@franky12 2 жыл бұрын
Do you know the *PyPortfolioOpt* python library that implements portfolio optimization methods?
@moeunit676767
@moeunit676767 Жыл бұрын
What did you do at 8:31 to highlight and change everything green. Sorry I am a novice. Thank you
@parttimelarry
@parttimelarry Жыл бұрын
I commented out all the selected lines by pressing command and /
@moeunit676767
@moeunit676767 Жыл бұрын
@@parttimelarry thank you so much for answering. Subscribed and cant wait to watch more content. I am going to do a little more walking before i run after this but I want to complete it so I apologize for another question. I copy and pasted your code for charting GLD and got this error " File "C:\Users\willi\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\ops\invalid.py", line 36, in invalid_comparison raise TypeError(f"Invalid comparison between dtype={left.dtype} and {typ}") TypeError: Invalid comparison between dtype=datetime64[ns, America/New_York] and datetime"
@saviocoelho6229
@saviocoelho6229 7 ай бұрын
Is your portfolio analysis code still running? I tried to make one, but the .utils.make_index function is giving the TypeError: unsupported operand type(s) for +: 'float' and 'str'. This is my code that caused the error: import quantstats as qs qs.extend_pandas() IAC = {"SPY": 1.3, "AGG": -.3} portfolio = qs.utils.make_index(IAC) I even tested with other ticker combinations and directly entering the ticker and weights in make_index and the error repeats in the same way. I also tested in previous versions and the error repeats again. Does anyone know if there is an error in the package or is it my code?
@darshitsarda9632
@darshitsarda9632 7 ай бұрын
same error
@davidreeves8382
@davidreeves8382 3 ай бұрын
@@darshitsarda9632 - i reproduced the same error
@theodorelee4383
@theodorelee4383 3 жыл бұрын
I was getting this error "Expecting value: line 1 column 1 (char 0)" when running the FB returns query. This is due to having an antiquated version of yfinance, if you're getting the same error just update yfinance using "pip install yfinance --upgrade" love the channel!
@AlexeyZubkov
@AlexeyZubkov 3 жыл бұрын
can you pull data of standard % move prior earnings of company?
@kuatroka
@kuatroka 2 жыл бұрын
Hi, Thanks for the video. A slightly tangential question, but I’m asking since you’re very versed in the Python trading topic. Can you recommend a Python module that analyses the actual transactions? Not the forecasted portfolio earnings based on the past stock price, but something like where I can give it a parquet/csv file with a list of transactions( ticker, entry date, entry quantity, entry price, exit date, exit price) and the Python module would analyse and spit out the profit / loss data. Even for cases where I’m adding or reducing a position with the same ticker or enter and exit the same ticket multiple times for different time periods ( month, quarter, year) So I could see what was my best, worst transaction, etc. Thanks
@parttimelarry
@parttimelarry 2 жыл бұрын
I'm planning to do a trading journal project where we build something like this, but am working on the machine learning content now. I'm not sure about existing modules for this, I would just write some Python that loads your CSV into a pandas dataframe and do calculations on it there. Or if you don't want to code it yourself there are some existing journal SaaS apps that are free if you make your trades public.
@kuatroka
@kuatroka 2 жыл бұрын
@@parttimelarry Thanks Larry. It's surprising though that there aren't any big name module for this. Tracking transactions seems like a pretty typical and extremely important investment/trading activity. I think I just need to scout github more conscientiously. Thanks
@orafaelgf
@orafaelgf 2 жыл бұрын
Great a video. Normally you share the code in anywhere? Or another doubt, is possible to show in chart the lines each tickers separated?
@emskiphoto
@emskiphoto 3 жыл бұрын
Thanks to Larry and Ran Aroussi
@NoToBusinessCasual
@NoToBusinessCasual 3 жыл бұрын
Are we bound to get price history from QS? Can we loop through our own set of Ticker files?
@nima8830
@nima8830 3 жыл бұрын
Well done Larry. Are these concepts applicable to intraday algorithmic strategies?
@parttimelarry
@parttimelarry 3 жыл бұрын
This is a long term portfolio analysis library, so not for short term trading
@karthickb1973
@karthickb1973 Жыл бұрын
i am trying to workaround simply by cumulating intraday returns to daily returns
@davidreeves8382
@davidreeves8382 3 ай бұрын
i tried the index - using META instead of FB and I get the error message: TypeError: unsupported operand type(s) for +: 'float' and 'str'. Any ideas?
@thomasforsythe9951
@thomasforsythe9951 3 жыл бұрын
How do I use a specific date for benchmarking?
@jessojohn9226
@jessojohn9226 3 жыл бұрын
can you do a video on integrating backtrader with quant stats to produce performance report?
@safishajjouz166
@safishajjouz166 2 жыл бұрын
There is a caveat. The library does not download adjusted close prices. So, you should be careful of what returns we are talking about.
@alexanderfiner7552
@alexanderfiner7552 3 жыл бұрын
Awesome work Larry - the only thing is I don't see the code on github :(
@parttimelarry
@parttimelarry 3 жыл бұрын
Hey thanks! Oops, just pushed it: github.com/hackingthemarkets/quantstats-demo
@alexanderfiner7552
@alexanderfiner7552 3 жыл бұрын
@@parttimelarry Thanks man very much appreciate it. I work as an assistant investment analyst, I love the bit about even managers can understand the code, it's actually a very accurate statement haha. These tear sheets or known as factsheets, are valued by highly clients, but often it's necessary to explain each aspect of the metrics used etc. I've run the code you've uploaded, the only error I get is ---- FileNotFoundError: [Errno 2] No such file or directory: 'output/gld.html' / No such file or directory: 'output/fb_earnings.png' - maybe I need to change a directory somewhere?
@parttimelarry
@parttimelarry 3 жыл бұрын
​@@alexanderfiner7552 hey, if you copied down individual scripts, I would create a directory called "output" in the same directory where you are running the script. or you can remove the "output/" part of the path and it will write the files to the same directory.
@alexanderfiner7552
@alexanderfiner7552 3 жыл бұрын
@@parttimelarry Thanks soo much mate
@patite3103
@patite3103 3 жыл бұрын
Thank you for the video! For the code "fmaga = portfolio = qs.utils.make_index(tickers)" I get an error: module 'quantstats.utils' has no attribute 'make_index' Could someone solve this problem? Thanks
@danielrv1325
@danielrv1325 3 жыл бұрын
How do you change the date to download the data? I tried to change period to a data and it is not working
@XeitoX506
@XeitoX506 3 жыл бұрын
Hi Larry, could you please explain how to configure a strategy with technical analysis indicator combine with this tool? Great video 👍🏻
@xxmrfreexx
@xxmrfreexx 3 жыл бұрын
Is there anyway to accept work as lancer ?
@mr.gk5
@mr.gk5 2 жыл бұрын
Does this work with foreign stocks?
@corteman
@corteman 3 жыл бұрын
I wonder if it works with futures/micro futures...
@AirForceA7x
@AirForceA7x 3 жыл бұрын
What Reddit chat did you find this package?
@andala-r4v
@andala-r4v 22 күн бұрын
Is this code still running? I keep getting errors.
@rancholaflorida1168
@rancholaflorida1168 3 жыл бұрын
Your fundamental analysis it's sucks , but your code it's clean and powerful
@Sam-lx1lu
@Sam-lx1lu Жыл бұрын
Getting this error for some of the code snippets: from : qs.reports.html(stock, title='Test', output='output/TSLA.html') Exception has occurred: TypeError DataFrame.pivot() takes 1 positional argument but 4 were given File "C:\Users\Samue\Desktop\Python\PY.py", line 10, in qs.reports.html(stock, title='Test', output='output/TSLA.html') TypeError: DataFrame.pivot() takes 1 positional argument but 4 were given
Walk Forward Optimization with VectorBT and Alpaca
36:06
Part Time Larry
Рет қаралды 19 М.
Python In Excel: Microsoft Changed EVERYTHING
14:37
Luke Barousse
Рет қаралды 450 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Finding Breakout Candidates with Python and Pandas
29:33
Part Time Larry
Рет қаралды 71 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 819 М.
Modern Python logging
21:32
mCoding
Рет қаралды 209 М.
Introduction to Dash Plotly - Data Visualization in Python
29:21
Charming Data
Рет қаралды 806 М.
How Financial Firms Actually Make Money
22:40
QuantPy
Рет қаралды 369 М.
Matplotlib Widgets Make Your Graphs Interactive
16:09
NeuralNine
Рет қаралды 15 М.
Protocols vs ABCs in Python - When to Use Which One?
15:31
ArjanCodes
Рет қаралды 43 М.
How to Create a Beautiful Python Visualization Dashboard With Panel/Hvplot
10:57
Thu Vu data analytics
Рет қаралды 556 М.