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,一经查实,立即删除!

相关文章

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

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

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…

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

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

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

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

VS IIS Express 支持局域网访问

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

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

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

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

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

SpringBoot项目打war包部署Tomcat教程

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

关于如何使用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可能会使您…

java returnaddress,JVM之数据类型

《Java虚拟机规范》阅读笔记-数据类型1.概述Java虚拟机的数据类型可分为两大类&#xff1a;原始类型(Primitive Types&#xff0c;也称为基本类型)和引用类型(Reference Types)。Java虚拟机用不同的字节码指令来操作不同的数据类型[1] 。2.原始类型原始类型是最基本的元素&…

C# matlab

编译环境&#xff1a;Microsoft Visual Studio 2008版本 9.0.21022.8 RTMMicrosoft .NET Framework版本 3.5已安装的版本: ProfessionalMicrosoft Visual Basic 2008 91986-031-5000002-60050Microsoft Visual Basic 2008Microsoft Visual C# 2008 91986-031-5000002-60050…

基于容器制作镜像

一。镜像基础 一。基于容器制作镜像 1. 查看并关联运行的容器 [ghlocalhost ~]$ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4da438fc9a8e busybox …

认识数据分析_认识您的最佳探索数据分析新朋友

认识数据分析Visualization often plays a minimal role in the data science and model-building process, yet Tukey, the creator of Exploratory Data Analysis, specifically advocated for the heavy use of visualization to address the limitations of numerical indi…

架构探险笔记10-框架优化之文件上传

确定文件上传使用场景 通常情况下&#xff0c;我们可以通过一个form&#xff08;表单&#xff09;来上传文件&#xff0c;就以下面的“创建客户”为例来说明&#xff08;对应的文件名是customer_create.jsp&#xff09;&#xff0c;需要提供一个form&#xff0c;并将其enctype属…

Windows Server 2003 DNS服务安装篇

导读-- DNS(Domain Name System&#xff0c;域名系统)是一种组织成层次结构的分布式数据库&#xff0c;里面包含有从DNS域名到各种数据类型(如IP地址)的映射“贵有恒&#xff0c;何必三更起五更勤;最无益&#xff0c;只怕一日曝十日寒。”前一段时间巴哥因为一些生活琐事而中止…

arima模型怎么拟合_7个统计测试,用于验证和帮助拟合ARIMA模型

arima模型怎么拟合什么是ARIMA&#xff1f; (What is ARIMA?) ARIMA models are one of the most classic and most widely used statistical forecasting techniques when dealing with univariate time series. It basically uses the lag values and lagged forecast error…

[WPF]ListView点击列头排序功能实现

[WPF]ListView点击列头排序功能实现 这是一个非常常见的功能&#xff0c;要求也很简单&#xff0c;在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了。微软的MSDN也已经提供了实现方式。微软的方法中&#xff0c;是通过ColumnHeader Templ…

天池幸福感的数据处理_了解幸福感与数据(第1部分)

天池幸福感的数据处理In these exceptional times, the lockdown left many of us with a lot of time to think. Think about the past and the future. Think about our way of life and our achievements. But most importantly, think about what has been and would be ou…