Giter VIP home page Giter VIP logo

Comments (3)

refraction-ray avatar refraction-ray commented on June 29, 2024

这两个量这么算是我觉得会合理些,基本是我编的公式==

投资收益率本身不像 xirr,是个有点 ill defined 的量。如果有持有成本做分母的话,如果收益比较高,会出现很极端的数字。考虑下面具体极端的例子

  1. 买入 100,涨到 200,卖出 190,持有 10。这一系列交易对应的在该标的上的投资收益率是多少呢。收益是 100,除以持有成本 -90,收益率会是 -110%。 除以最大占用 100 更合理。也许会有人说,除以总买入也很合理,那就在考虑下面这个极端例子。

  2. 买入 100,涨到 200,全部卖出。买入 100,涨到 200,全部卖出。买入 100,涨到 200,全部卖出。总收益 300,应该除以总买入 300 更合适呢,还是除以最大占用 100 更合适呢,其实就见仁见智了。本质上讲,最大占用指的是整体时间上,你需要最多拿出多少钱参与这笔投资,那么作为收益率的分母,可能还是比较合理的。

至于换手率,就是个更随意的量,基本上只有定性(大还是小)的意义,具体数值的意义可能不大。我这里的处理大概就是算日均买入卖出的金额。为了抵消基底金额大小对换手率的影响,又除了最大占用归一化一下。

from xalpha.

kaharjan avatar kaharjan commented on June 29, 2024

谢谢! 我大概明白了。
我研究了一下支付宝的收益率计算方法,它是按照这种方式计算的:

T日投资总成本=T日加仓金额+(T-1)日投资总成本-T日减仓份额*T日成本单价
T日持有收益 = T日持仓市值 - T日投资总成本

T日持有收益率 = T日持有收益/T日投资总成本

持有单价 = 持有成本/持有份额

持有成本 = 持有份额 * 持有单价

支付宝的这种方式好像也能克服你上面所述的两个极端例子。支付宝的累计收益对应于xalpha的收益,支付宝的T日收益中相当于没有计算减持的收益。

from xalpha.

refraction-ray avatar refraction-ray commented on June 29, 2024

#53 之前可能相关的一个讨论,那时就有想法说,能不能软件同时支持几种不同模式的成本和收益计算

from xalpha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.