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,意味著可以無風險的價格立即進行投資...

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的收益,就可以無風險的利率進行每月復利的即時投資…




Hopefully, by now a pattern is recognized — for each month…
希望到目前為止,每個月都可以識別出一種模式。




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…

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…
根據以上示例,可以構造一個通用公式…

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,一經查實,立即刪除!