Тёмный

Python for Finance: Historical Volatility & Risk-Return Ratios 

QuantPy
Подписаться 73 тыс.
Просмотров 13 тыс.
50% 1

Today explore historical volatility in python and a method to estimate volatility using the log returns distribution sample variance. We then visualise the historical volatility in terms of the log returns distributions as well as considering a rolling window to plot volatility over time.
In the financial industry, useful measures for decision making are inclusive of both expected returns and volatility. Here we explain and calculate the following risk-return metrics over a rolling time horizon: Sharpe Ratio, Sortino Ratio, M2 Ratio, Max Drawdowns and the Calmar Ratio.
00:00 Intro
01:18 Historical Volatility
07:06 Rolling Window Historical Volatility
08:40 Sharpe Ratio
10:56 Sortino Ratio
13:42 M2 Ratio
16:45 Max Drawdowns
19:50 Calmar Ratio
As a high-level programming language, Python is a great tool for financial data analysis, with quick implementation and well documented API data sources, statistical modules and other frameworks related to the financial industry. We will be using Jupyter Lab as an interactive web browser editor for this series due to ease of use and presenting code in a live notebook is ideal for this tutorial series.
This is the fourth video of many on the topic of Python for Finance. The series will include general techniques used for financial analysis and act as an introduction for more in-depth tutorials that we may explore later (such as time series modelling, building financial dashboards, machine learning ect.).
★ ★ Code Available on GitHub ★ ★
GitHub: github.com/TheQuantPy
Specific Tutorial Link: github.com/TheQuantPy/youtube...
★ ★ QuantPy GitHub ★ ★
Collection of resources used on QuantPy RU-vid channel. github.com/thequantpy
★ ★ Discord Community ★ ★
Join a small niche community of like-minded quants on discord. / discord
★ ★ Support our Patreon Community ★ ★
Get access to Jupyter Notebooks that can run in the browser without downloading python.
/ quantpy
★ ★ ThetaData API ★ ★
ThetaData's API provides both realtime and historical options data for end-of-day, and intraday trades and quotes. Use coupon 'QPY1' to receive 20% off on your first month.
www.thetadata.net/
★ ★ Online Quant Tutorials ★ ★
WEBSITE: quantpy.com.au
★ ★ Contact Us ★ ★
EMAIL: pythonforquants@gmail.com
Disclaimer: All ideas, opinions, recommendations and/or forecasts, expressed or implied in this content, are for informational and educational purposes only and should not be construed as financial product advice or an inducement or instruction to invest, trade, and/or speculate in the markets. Any action or refraining from action; investments, trades, and/or speculations made in light of the ideas, opinions, and/or forecasts, expressed or implied in this content, are committed at your own risk an consequence, financial or otherwise. As an affiliate of ThetaData, QuantPy Pty Ltd is compensated for any purchases made through the link provided in this description.

Опубликовано:

 

22 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 22   
@marjanulislam4553
@marjanulislam4553 3 года назад
One of the great Chanel I discovered for Quant. Clearly explained
@anuragbisht1200
@anuragbisht1200 2 года назад
great work ! this channel is valuable than gold+platinum combined.
@davidlia1102
@davidlia1102 Год назад
Well explained!
@QuantApplicantMattKulis
@QuantApplicantMattKulis 10 месяцев назад
great stuff thanks
@camkrik5812
@camkrik5812 2 года назад
Great channel! Much appreciated. Just wondering about your way of calculating log returns. The formula I know is log(pct_change+1). Your calcs don't seem to tally to the cumulative return with np.exp(log_returns['CBA.AX'].sum())-1
@avinashdas8272
@avinashdas8272 2 года назад
Can I ask a question - the way your initial dataset was structured, it was easy to calculate log returns and then calculate the std dev for each column since your stocks are in different columns. What if all stocks were in one column with the date index repeating from start time to end time for each stock? And also if the number of days for which you have data for each stock isn't always the same - implying you can't use a rolling window to calculate std dev? I actually do have such a dataset and unable to handle that aspect of it. I tried using pivot() to stack the unique tickers into different columns, but i'm getting an error. Any help would be appreciated
@amanmanamanman
@amanmanamanman Год назад
I think you need to multiply by np.sqrt(TRADING_DAYS) while computing the sharpe ratio and sortino ratio because volatility for a day = volatility for the rolling window/sqrt(trading days)
@konturgestalter
@konturgestalter 3 года назад
nice one
@QuantPy
@QuantPy 3 года назад
Thanks, do you have any requests for future videos?
@konturgestalter
@konturgestalter 3 года назад
@@QuantPy definitely the direction you have now. many only focus on basics like what is vola. I ld love to see more indepth quant analysis of portfolios for sure
@dennissawyers9916
@dennissawyers9916 2 года назад
Is this relevant to options as well to stocks?
@srcheekychappy
@srcheekychappy 3 года назад
I only wish I had your skills.
@_el_yeyo
@_el_yeyo 2 года назад
Is there a specific place where you would recommend learning Python? Books or courses?
@QuantPy
@QuantPy 2 года назад
Set yourself a project, and then I recommend using RU-vid / googling / stack exchange to solve all your problems. Best way to get going is to set yourself a goal of building something. Good luck
@alexanderfiner7552
@alexanderfiner7552 2 года назад
is .AX only for Australian stock? in yahoo finance
@QuantPy
@QuantPy 2 года назад
Yes, you'll have to go to Yahoo Finance and use the serach funciton to find how tickers are represented in the market you are interested in!
@aarondelarosa3146
@aarondelarosa3146 Год назад
What's the best platform to run python? What platform are you using?
@QuantApplicantMattKulis
@QuantApplicantMattKulis 10 месяцев назад
jupyter and vs code... replit too all great places to begin
@user-hk1wd1uv9p
@user-hk1wd1uv9p Год назад
Hi, I am in Brisbane. I remembered that you said you did your MFM in UQ. I am not sure whether you are in Brisbane, lol! I am currently studying PhD in finance at UQ focusing on quant finance research! What a coincidence!
@DeejayGabin
@DeejayGabin Год назад
Why did you divide your risk-free rate by 252? Is it for annualized rate? I mean, for example, US treasury bond rates or T-Bill are already annualized
@sharangkulkarni1759
@sharangkulkarni1759 Год назад
they call me chicken little, they call me bubble boy, I go long on stock which shows highest positive values on anti sortini, this is my sortini but for positive volitily, I buy them i see them down, its just like climbing steadily over mountain. ahahaha!
@sharangkulkarni1759
@sharangkulkarni1759 Год назад
they call me chicken little , they call be bubble buster, i short sell the stock which shows highest negative values in sortino all the time, i short them instantly i see them up. its just means falling like slow river, slow waterfall ahahahaha !!!!
Далее
Portfolio Beta Weighting with Python
37:22
Просмотров 8 тыс.
У тебя проблемы?
00:20
Просмотров 781 тыс.
Historical Value at Risk (VaR) with Python
23:03
Просмотров 19 тыс.
Risk, Return, and the Security Market Line
51:50
Просмотров 20 тыс.
Python For Finance Portfolio Optimization
39:17
Просмотров 141 тыс.
Risk Neutral Pricing of Weather Derivatives
27:14
Просмотров 7 тыс.
У тебя проблемы?
00:20
Просмотров 781 тыс.