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.pswp.cn/news/388712.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388712.shtml
英文地址,請注明出處:http://en.pswp.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可能會使您…