[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 ...
随机推荐
- 常用js方法封装
常用js方法封装 var myJs = { /* * 格式化日期 * @param dt 日期对象 * @returns {string} 返回值是格式化的字符串日期 */ getDates: fun ...
- HDU——T The King’s Problem
http://acm.hdu.edu.cn/showproblem.php?pid=3861 Time Limit: 2000/1000 MS (Java/Others) Memory Limi ...
- Android 中模仿 Twitter 实现 Toolbar Indicator
项目地址:https://github.com/nekocode/ToolbarIndicator
- sqlplus登录提示:ORA-12162:TNS:net service name is incorrectly specified错误
[root@localhost ~]# su - oracle [oracle@localhost ~]$ sqlplus '/as sysdba' SQL*Plus: Release 11.2.0. ...
- CCFlow的excel数据源导入Dtl明细表的操作方法以及模版demo
CCBPM支持通过excel向Dtl明细表(从表)导入数据. 以下,我们以cc的財务报销单demo流程解说详细的操作步骤和模版设计. 导入的操纵步骤: 1.流程发起后,在開始节点导入数据源,点击明细表 ...
- bzoj3275: Number(最小割)
3275: Number 题目:传送门 题解: 双倍经验@bzoj3158 代码: #include<cstdio> #include<cstring> #include< ...
- nyoj--138--找球号(二)(hash+邻接表)
找球号(二) 时间限制:1000 ms | 内存限制:65535 KB 难度:5 描述 在某一国度里流行着一种游戏.游戏规则为:现有一堆球中,每个球上都有一个整数编号i(0<=i<=1 ...
- zookeeper的节点类型
Znode有两种类型: 短暂(ephemeral):客户端和服务器端断开连接后,创建的节点自己删除 持久(persistent):客户端和服务器端断开连接后,创建的节点不删除 2)Znode有四种形式 ...
- WPF XAML
xmlns 在xml中专门用于声明名字控件, xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 是 ...
- 终于意识到BIM确实火了
碰巧遇到一个BIM会议.一大帮国内的老师桠桠叉叉坐了一大屋.听了半天感觉都是在吹BIM如何火.第一次听到这个概念感觉这个能火吗. 昨天雄安新区用BIM建设的新闻出来后,一下子惊了.看来BIM进入计算机 ...