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

  1. Normalize the price by devide price of first day.
  2. Nored * allocation
  3. * starting value
  4. 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的更多相关文章

  1. 一篇文章看懂spark 1.3+各版本特性

    Spark 1.6.x的新特性Spark-1.6是Spark-2.0之前的最后一个版本.主要是三个大方面的改进:性能提升,新的 Dataset API 和数据科学功能的扩展.这是社区开发非常重要的一个 ...

  2. Scoring and Modeling—— Underwriting and Loan Approval Process

    https://www.fdic.gov/regulations/examinations/credit_card/ch8.html Types of Scoring FICO Scores    V ...

  3. Stanford机器学习笔记-3.Bayesian statistics and Regularization

    3. Bayesian statistics and Regularization Content 3. Bayesian statistics and Regularization. 3.1 Und ...

  4. FAQ: Automatic Statistics Collection (文档 ID 1233203.1)

    In this Document   Purpose   Questions and Answers   What kind of statistics do the Automated tasks ...

  5. 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 ...

  6. ML笔记_机器学习基石01

    1  定义 机器学习 (Machine Learning):improving some performance measure with experience computed from data ...

  7. Spark ML 几种 归一化(规范化)方法总结

    规范化,有关之前都是用 python写的,  偶然要用scala 进行写, 看到这位大神写的, 那个网页也不错,那个连接图做的还蛮不错的,那天也将自己的博客弄一下那个插件. 本文来源 原文地址:htt ...

  8. 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 ...

  9. [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 ...

随机推荐

  1. 2019-03-25 Python Pandas 基本操作

    新建表 data1 = { "name": ["Tom", "Bob", "Mary", "James&quo ...

  2. Maven下Flex国际化配置

    之前写了flashbulid.initellij下的flex国际化配置,它们都是在本地打包发布的,那么我们的工程用maven管理了,需要自动发布.这时候如何修改flex的pom文件,来让它build的 ...

  3. 【codeforces 812B】Sagheer, the Hausmeister

    [题目链接]:http://codeforces.com/contest/812/problem/B [题意] 一个老大爷在一楼; 然后他有n楼的灯要关(最多n楼); 每楼有m个房间; 给出每个房间的 ...

  4. hbase的几种访问方式

    Hbase的访问方式 1.Native Java API:最常规和高效的访问方式: 2.HBase Shell:HBase的命令行工具,最简单的接口,适合HBase管理使用: 3.Thrift Gat ...

  5. 洛谷 P1461 海明码 Hamming Codes

    P1461 海明码 Hamming Codes 题目描述 给出 N,B 和 D,要求找出 N 个由0或1组成的编码(1 <= N <= 64),每个编码有 B 位(1 <= B &l ...

  6. Qt之二维码扫描

    简述 二维码(QR Code)是用某种特定的几何图形按一定规律在平面(二维方向)分布的黑白相间的图形记录数据符号信息的.是所有信息数据的一把钥匙.应用十分广泛,如:产品防伪/溯源.广告推送.网站链接. ...

  7. hdu5351

    题目名称:MZL's Border 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5351 题意:给出fib 1 = b,fib2 = a ; fib  ...

  8. 仿hibernate,spring框架手动写

    近期学习了hibernate底层技术和spring 的底层技术,认为非常不错,所以想分享下,要是说的不够具体.能够去下载资源自己查看下载链接 技术的体现是在实际中的.如今大体介绍一下吧 首先介绍hib ...

  9. 手势跟踪论文学习:Realtime and Robust Hand Tracking from Depth(三)Cost Function

    iker原创.转载请标明出处:http://blog.csdn.net/ikerpeng/article/details/39050619 Realtime and Robust Hand Track ...

  10. Spring中@Transactional事务回滚(含实例具体解说,附源代码)

    一.使用场景举例 在了解@Transactional怎么用之前我们必须要先知道@Transactional有什么用. 以下举个栗子:比方一个部门里面有非常多成员,这两者分别保存在部门表和成员表里面,在 ...