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. 炫酷 CSS 背景效果的 10 个代码片段

    在现代网页设计中,大背景图设计非常流行.随着高清(现在是4K)显示器的出现,越来越多的网页设计师使用大背景图来填充屏幕. 因为这样可以造成很大的视觉冲击力,并有助于更好的传递所要表现的内容. 但是,如 ...

  2. Nodejs RESTFul架构实践之api篇(转)

    why token based auth? 此段摘自 http://zhuanlan.zhihu.com/FrontendMagazine/19920223 英文原文 http://code.tuts ...

  3. WinServer-IIS-woff字体不显示问题

    ASP.NET mvc发布到IIS之后,访问网站的时候,发现woff字体没有加载 百度发现很多博客上的教程是这样的,在IIS管理器中的MIME选项中添加类型 但是重新使用IIS发布后,新添加的字体就会 ...

  4. Springmvc Get请求Tomcat、WebLogic中文乱码问题

    Springmvc Get请求Tomcat.WebLogic中文乱码问题 学习了:http://www.cnblogs.com/qingdaofu/p/5633225.html http://www. ...

  5. java基础——static keyword小节

    static 用于修饰成员 修饰成员变量和成员函数 被修饰过的成员的特点:   1.随着类的载入而载入   2.优先于对象而存在   3.被全部对象所共享   4.能够直接被类名调用

  6. 接口、索引器、Foreach的本质(学习笔记)

    接口 什么是接口? 接口代表一种能力,和抽象类类似但比抽象类的抽象程度更高! 接口的定义: public interface IEat//定义一个接口 { void Eat(string food); ...

  7. SpringCloud学习笔记(10)----Spring Cloud Netflix之声明式 REST客户端 -Feign的高级特性

    1. Feign的默认配置 Feign 的默认配置 Spring Cloud Netflix 提供的默认实现类:FeignClientsConfiguration 解码器:Decoder feignD ...

  8. C# 打开文件 保存文件

    string path = @"C: \Users\users\Desktop\xxxx.txt";// 文件路径 FileStream filestream = new File ...

  9. li自定义图标

    /*自定义list的图标*/ li{ list-style-image: url(../img/21.JPG); }

  10. Manacher笔记

    (其实还是回文自动机好用,毛子真是牛逼) Manacher #include<iostream> #include<cstring> #include<cstdio> ...