[ML] Daily Portfolio Statistics
Let's you have $10000, and you inverst 4 stocks. ['SPY', 'IBM', 'XOM', 'GOOG']. The allocation is [0.4, 0.4, 0.1, 0.1] separately.
The way to calculate the daily porfolio is
- Normalize the price by devide price of first day.
- Nored * allocation
- * starting value
- Sum up each row

After we can port value, the first thing we can calculate is the daily return.
The important thing to remember that the first value of daily return is alwasy zero, so we need to remove the first value.
daily_rets = daily_rets[1:]
Four statics:
1. Cumulative return:
Is a just a measure of how much the value of the portfolio has go up from the beginning to the end.
cum_ret = (port_val[-] / port_val[]) -
2. Average daily return:
The mean value of daily return
avg_daily_ret = daily_rets.mean()
3. Standard deviation of odaily return:
std_daily_ret = daily_rets.std()
4. Sharp ratio:
The idea for sharp ratio is to consider our return, or rewards in the context of risk.
All else being equal:
Lower risk is better
Higher return is better
Also considers risk free rate of return, nowadays, risk free return is almost 0. (Put menoy into the bank has very low interests)
Both stocks have similar volatility, so ABC is better due greater returns.

Here both stocks have similar returns, but XYZ has lower volatility (risk).

In this case, we actually do not have a clear picture of which stock is better!

Calculate Shape ratio:


Risk free value can be replace by:
1. LIBOR
2. 3mo T-Bill
3. 0%
Because risk free is so small, noramlly we can just drop it when calculate the sharp raito.
IF we calcualte daily shape ratio: use K = srq(252), monly then srq(12)

[ML] Daily Portfolio Statistics的更多相关文章
- 一篇文章看懂spark 1.3+各版本特性
Spark 1.6.x的新特性Spark-1.6是Spark-2.0之前的最后一个版本.主要是三个大方面的改进:性能提升,新的 Dataset API 和数据科学功能的扩展.这是社区开发非常重要的一个 ...
- Scoring and Modeling—— Underwriting and Loan Approval Process
https://www.fdic.gov/regulations/examinations/credit_card/ch8.html Types of Scoring FICO Scores V ...
- Stanford机器学习笔记-3.Bayesian statistics and Regularization
3. Bayesian statistics and Regularization Content 3. Bayesian statistics and Regularization. 3.1 Und ...
- FAQ: Automatic Statistics Collection (文档 ID 1233203.1)
In this Document Purpose Questions and Answers What kind of statistics do the Automated tasks ...
- oracle internal: VIEW: X$KCBKPFS - PreFetch Statistics - (9.0)
WebIV:View NOTE:159898.1 Note (Sure) - Note Mods - Note Refs Error ORA 600 TAR TAR-Info Bug B ...
- ML笔记_机器学习基石01
1 定义 机器学习 (Machine Learning):improving some performance measure with experience computed from data ...
- Spark ML 几种 归一化(规范化)方法总结
规范化,有关之前都是用 python写的, 偶然要用scala 进行写, 看到这位大神写的, 那个网页也不错,那个连接图做的还蛮不错的,那天也将自己的博客弄一下那个插件. 本文来源 原文地址:htt ...
- Google's Machine Learning Crash Course #01# Introducing ML & Framing & Fundamental terminology
INDEX Introducing ML Framing Fundamental machine learning terminology Introducing ML What you learn ...
- [ML] I'm back for Machine Learning
Hi, Long time no see. Briefly, I plan to step into this new area, data analysis. In the past few yea ...
随机推荐
- 更新Maven的本地库
1. 更新Maven的本地库 通常情况下,可改变默认的 .m2 目录下的默认本地存储库文件夹到其他更有意义的名称,例如, maven-repo 找到 {M2_HOME}\conf\setting.xm ...
- Springboot 应用启动分析
https://blog.csdn.net/hengyunabc/article/details/50120001#comments 一,spring boot quick start 在spring ...
- Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?
Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别? 1.什么是Set?(what) Set是Collection容器的一个子接口,它不允许出现 ...
- Fedora 17 无线网卡配置笔记
转载:http://www.psichen.com/fedora-17-wifi/ 安装并更新完F17后,在网络选项中没有出现无线网,需要自己安装无线网卡驱动.而F17中默认网卡名称从以前的”eth0 ...
- Apache shiro 笔记整理之编程式授权
下面内容是在看了涛哥的<跟我一起学shiro> 和 视频<一头扎入进shiro> 后整理出来备忘和方便自己和其它人学习. 个人主页:http://www.itit123.cn/ ...
- poj1961--Period(KMP求最小循环节)
Period Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 13511 Accepted: 6368 Descripti ...
- adt-bundle-windows加入NDK支持
近期换了个硬盘,曾经都是用eclipse安装adt插件的,如今老了,图省事就下载了adt-bundle-windows,解压缩出来就直接用.但是这个adt-bundle没有集成NDK支持,于是手动安装 ...
- node14---分层结构数据库操作
/**回调函数(函数作为参数): 0. 外层函数调用的地方,一定是外层函数体先执行,回调函数和普通函数地址一样,然后看函数体规定回调函数怎么执行. 1. 异步时候使用回调函数, 无论是否异步,回调函数 ...
- yolo源码解析(2):处理图片
首先安装ffmpeg, 参考https://blog.csdn.net/lwgkzl/article/details/77836207 然后将视频切分为图片, 参考:https://zhuanlan. ...
- Bringing up the Avnet MicroZed with Vivado
Bringing up the Avnet MicroZed with Vivado I recently received the Adam Taylor Edition of Avnet's Zy ...