python 传不定量参数_Python中的定量金融

python 传不定量参数

The first quantitative class for vanilla finance and quantitative finance majors alike has to do with the time value of money. Essentially, it’s a semester-long course driving notions like $100 today is worth more than $100 a year from today into the heads of college students and making them work out painful word problems by hand to determine how much they need to invest today to arrive at some value in the future. This is done in tandem with the introduction to perpetuities and annuities as an application to the temporal value differential. Though I wasn’t a fan of working out the computations by hand, I’m a big fan of coding them in Python for ease of use.

吨他香草金融和计量金融专业第一定量类都与金钱的时间价值的事情。 本质上讲,这是一个学期的课程驱动概念,例如今天的100美元从今天起每年价值超过100美元,进入大学生的脑袋,并使他们手工解决痛苦的单词问题,以确定他们今天需要投入多少才能达到目标将来会有一些价值。 这是通过引入永久性和年金作为时间值微分的应用来完成的。 尽管我不喜欢手工进行计算,但我还是非常喜欢使用Python进行编码以便于使用。

金钱的时间价值 (Time Value of Money)

Risk-free interest rates — in practice proxied by U.S. treasury bills, notes, and bonds are responsible for the difference in the value of money over time. Higher-level courses covering subjects including derivatives and securities pricing always take into account the time value of money in their pricing formulae, making this topic what algebra is to calculus.

无风险利率-实际上是由美国国库券,票据和债券所代理,是货币价值随时间变化的原因。 涵盖衍生产品和证券定价等主题的高级课程始终在定价公式中考虑货币的时间价值,这使该主题成为微积分的代数。

Consider the current risk-free rate is 8% per annum. To receive $100 today means an immediate investment can be made at the risk-free rate…

考虑当前的无风险利率为每年8%。 今天要获得$ 100,意味着可以无风险的价格立即进行投资...

Image for post

After a year $100 at the risk-free rate is $108. Therefore receiving $100 today would be worth more than receiving $100 one year from today all else equal.

一年后,以无风险利率计算的100美元为108美元。 因此接受$ 100今天的价值将超过从今天一切平等接受$ 100中的一个年份。

In the previous example, compounding (reinvesting periodic interest payments throughout the year) was completely disregarded. Let’s look at another example where we take into account a compounding effect.

在前面的示例中,完全忽略了复利(全年将定期利息支出再投资)。 让我们看另一个考虑复合效应的例子。

Consider the current risk-free rate is 8% per annum, and the compounding frequency is once per month. To receive $100 today means an immediate investment with monthly compounding can be made at the risk-free rate…

考虑当前的无风险利率为8%,复利频率为每月一次。 今天要获得$ 100的收益,就可以无风险的利率进行每月复利的即时投资…

Image for post
Annual to monthly rate conversion
年率到月率转换
Image for post
First month’s interest
第一个月的利息
Image for post
Second month’s interest
第二个月的利息
Image for post
Third month’s interest
第三个月的利息

Hopefully, by now a pattern is recognized — for each month…

希望到目前为止,每个月都可以识别出一种模式。

Image for post
First month’s interest
第一个月的利息
Image for post
Second month’s interest
第二个月的利息
Image for post
Third month’s interest
第三个月的利息
Image for post
M month’s interest
M个月的利息

After a year $100 at the risk-free rate is approximately $108.34. It’s common to refer to the value in terms of “time-period dollars”. For example, $100 today is worth $108.34 in time-period 1 dollars…

一年后,按无风险利率计算,$ 100约为$ 108.34。 通常用“ 时间段美元 ”来表示值。 例如,今天$ 100在时间段内价值$ 108.34,即$ 1…

Image for post
Risk-free investment life with respect to time
关于时间的无风险投资寿命

Therefore receiving $100 today would be worth more than receiving $100 today without monthly compounding all else equal.

因此,今天获得100美元的价值将比今天获得100美元的价值要多得多,而不必按月计算其他所有等式

From the examples above a general formula can be constructed…

根据以上示例,可以构造一个通用公式…

Image for post
Time value of money formula
货币时间价值公式
  • P — initial amount or principal ($100)

    P-初始金额或本金($ 100)

  • A — resulting amount in time-period t dollars ($108 or $108.34)

    A-时间周期内的最终金额(美元)($ 108或$ 108.34)

  • r — risk-free rate of interest (8%)

    r —无风险利率(8%)

  • n — compounding frequency for time-period t (1 or 12)

    n-时间段t的复合频率(1或12)

  • t — time-periods to elapse (1)

    t —经过的时间(1)

Now let’s write this equation in Python…

现在让我们用Python编写这个方程式...

To test this function write a call using the parameters from above…

要测试此功能,请使用上面的参数编写调用…

108.29995068075098

Note: The resulting value is different and more accurate.

注意:结果值是不同的,并且更准确。

It’s worth mentioning that as the limit of the compounding frequency approaches infinity the higher the resulting amount in time-period t dollars.

值得一提的是,随着复合频率的极限接近无穷大,时间周期内的结果量也就越高。

108.29995068075098 # Compounding period of 12
108.31429591590663 # Compounding period of 24
108.31909221757883 # Compounding period of 36
108.32149310823426 # Compounding period of 48

The proof is outside the scope of this article but the result is an equation that compounds continuously. I the future I will discuss the importance of continuous compounding, trading, and time and their relation to higher-level model derivations including the Black-Scholes equation.

证明不在本文的讨论范围之内,但结果却是一个不断复杂化的方程式。 将来,我将讨论持续复利,交易和时间的重要性,以及它们与包括Black-Scholes方程在内的高级模型推导的关系。

翻译自: https://towardsdatascience.com/quantitative-finance-in-python-e8d48e6b9c23

python 传不定量参数

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388712.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

axis为amchart左右轴的参数

<axis>left</axis> <!-- [left] (left/ right) indicates which y axis should be used --> <title>流通股</title> <!-- [] (graph title) --> <…

雷军宣布红米 Redmi 品牌独立,这对小米意味着什么?

雷锋网消息&#xff0c;1 月 3 日&#xff0c;小米公司宣布&#xff0c;将在 1 月 10 日召开全新独立品牌红米 Redmi 发布会。从小米公布的海报来看&#xff0c;Redmi 品牌标识出现的倒影中&#xff0c;有 4800 的字样&#xff0c;这很容易让人联想起此前小米总裁林斌所宣布的 …

JAVA的rotate怎么用,java如何利用rotate旋转图片_如何在Java中旋转图形

I have drawn some Graphics in a JPanel, like circles, rectangles, etc.But I want to draw some Graphics rotated a specific degree amount, like a rotated ellipse. What should I do?解决方案If you are using plain Graphics, cast to Graphics2D first:Graphics2D …

贝叶斯 朴素贝叶斯_手动执行贝叶斯分析

贝叶斯 朴素贝叶斯介绍 (Introduction) Bayesian analysis offers the possibility to get more insights from your data compared to the pure frequentist approach. In this post, I will walk you through a real life example of how a Bayesian analysis can be perform…

vs2005 vc++ 生成非托管的 不需要.net运行环境的exe程序方法

在VS2005里开发的VC程序在编译的时候&#xff0c;微软默认会加入自己的 .Net Framework &#xff08;方便推广自家产品&#xff09;&#xff0c;让你的VC程序依赖它&#xff0c;这就导致程序编译后&#xff0c;无法跟往常一样直接打包&#xff0c;在别的机器就能正常运行。如果…

西工大java实验报告给,西工大数字集成电路实验 实验课6 加法器的设计

西工大数字集成电路实验练习六 加法器的设计一、使用与非门(NAND)、或非门(NOR)、非门(INV)等布尔逻辑器件实现下面的设计。1、仿照下图的全加器&#xff0c;实现一个N位的减法器。要求仿照图1画出N位减法器的结构。ABABABAB0123图1 四位逐位进位加法器的结构2、根据自己构造的…

DS二叉树--二叉树之数组存储

二叉树可以采用数组的方法进行存储&#xff0c;把数组中的数据依次自上而下,自左至右存储到二叉树结点中&#xff0c;一般二叉树与完全二叉树对比&#xff0c;比完全二叉树缺少的结点就在数组中用0来表示。&#xff0c;如下图所示 从上图可以看出&#xff0c;右边的是一颗普通的…

VS IIS Express 支持局域网访问

使用Visual Studio开发Web网页的时候有这样的情况&#xff1a;想要在调试模式下让局域网的其他设备进行访问&#xff0c;以便进行测试。虽然可以部署到服务器中&#xff0c;但是却无法进行调试&#xff0c;就算是注入进程进行调试也是无法达到自己的需求&#xff1b;所以只能在…

前复权后复权程序C# .net

if (win32apitest.MDIMain.SFSDA.FuQuan "前复权") { if (mytime DateTime.Parse("2009-04-29")) { //if (svalue 34.89) …

一天一个js知识

原型继承和class继承 class&#xff1a;js中并不存在类的概念&#xff0c;class只是语法糖&#xff0c;本质还是函数&#xff1b; 提升&暂时性死区 console.log(a)// ƒ a() {} var a8 function a(){} 复制代码 1、这里说明函数的提升要优先于变量的提升&#xff1b;函数提…

构建图像金字塔_我们如何通过转移学习构建易于使用的图像分割工具

构建图像金字塔Authors: Jenny Huang, Ian Hunt-Isaak, William Palmer作者&#xff1a; 黄珍妮 &#xff0c; 伊恩亨特伊萨克 &#xff0c; 威廉帕尔默 GitHub RepoGitHub回购 介绍 (Introduction) Training an image segmentation model on new images can be daunting, es…

PHP mongodb运用,MongoDB在PHP下的应用学习笔记

1、连接mongodb默认端口是&#xff1a;27017&#xff0c;因此我们连接mongodb&#xff1a;$mongodb new Mongo(localhost) 或者指定IP与端口 $mongodb new Mongo(192.168.127.1:27017) 端口可改变若mongodb开启认证&#xff0c;即--auth,则连接为&#xff1a; $mongodb new …

a标签

a标签定义超链接&#xff0c;用于从一张页面链接到另一张页面&#xff0c;它最重要的属性是 href 属性&#xff0c;它指示链接的目标。 <a href"http://www.w3school.com.cn">W3School</a> 最常用的就像这样添加一个链接&#xff0c;如果是点击事件的话&…

MFC程序执行过程剖析

一 MFC程序执行过程剖析 1&#xff09;我们知道在WIN32API程序当中&#xff0c;程序的入口为WinMain函数&#xff0c;在这个函数当中我们完成注册窗口类&#xff0c;创建窗口&#xff0c;进入消息循环&#xff0c;最后由操作系统根据发送到程序窗口的消息调用程序的窗口函数。而…

CF888E Maximum Subsequence(meet in the middle)

给一个数列和m&#xff0c;在数列任选若干个数&#xff0c;使得他们的和对m取模后最大&#xff08; \(1<n<35\) , \(1<m<10^{9}\)&#xff09; 考虑把数列分成两份&#xff0c;两边分别暴力求出所有的可能&#xff0c;那么对于一个数列中每一个数字\(x\)&#xff0…

virtualbox php mac,详解mac下通过docker搭建LEMP环境

在mac下通过docker搭建LEMP环境境1.安装virtualbox。由于docker是在lxc环境的容器2.安装boot2docker&#xff0c;用于与docker客户端通讯> brew update> brew install docker> brew install boot2docker3.初始化boot2docker&#xff0c;也就是在virtualbox上安装一个d…

SpringBoot项目打war包部署Tomcat教程

一、简介 正常来说SpringBoot项目就直接用jar包来启动&#xff0c;使用它内部的tomcat实现微服务&#xff0c;但有些时候可能有部署到外部tomcat的需求&#xff0c;本教程就讲解一下如何操作 二、修改pom.xml 将要部署的module的pom.xml文件<packaging>节点设置为war <…

在VS2005中使用添加变量向导十分的

在VS2005中使用添加变量向导十分的方便&#xff0c;但是如何手动添加呢。可以分为2步&#xff1a; 1. 在控件对应的类的头文件中添加相应的变量声明&#xff08;如&#xff1a;CString m_strResult&#xff09; 2. 在类的实现文件中的DoDataExchange(CDataExchange* pDX)函数…

关于如何使用xposed来hook微信软件

安卓端 难点有两个 收款码的生成和到帐监听需要源码加 2442982910转载于:https://www.cnblogs.com/ganchuanpu/p/10220705.html

GitHub动作简介

GitHub Actions can be a little confusing if you’re new to DevOps and the CI/CD world, so in this article, we’re going to explore some features and see what we can do using the tool.如果您是DevOps和CI / CD领域的新手&#xff0c;那么GitHub Actions可能会使您…