python 传不定量参数_Python中的定量金融
python 傳不定量參數(shù)
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.
噸他香草金融和計量金融專業(yè)第一定量類都與金錢的時間價值的事情。 本質(zhì)上講,這是一個學期的課程驅動概念,例如今天的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.
無風險利率-實際上是由美國國庫券,票據(jù)和債券所代理,是貨幣價值隨時間變化的原因。 涵蓋衍生產(chǎn)品和證券定價等主題的高級課程始終在定價公式中考慮貨幣的時間價值,這使該主題成為微積分的代數(shù)。
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的收益,就可以無風險的利率進行每月復利的即時投資…
Annual to monthly rate conversion年率到月率轉換 First month’s interest第一個月的利息 Second month’s interest第二個月的利息 Third month’s interest第三個月的利息Hopefully, by now a pattern is recognized — for each month…
希望到目前為止,每個月都可以識別出一種模式。
First month’s interest第一個月的利息 Second month’s interest第二個月的利息 Third month’s interest第三個月的利息 M month’s interestM個月的利息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在時間段內(nèi)價值$ 108.34,即$ 1…
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…
根據(jù)以上示例,可以構造一個通用公式…
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-時間周期內(nèi)的最終金額(美元)($ 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 —經(jīng)過的時間(1)
Now let’s write this equation in Python…
現(xiàn)在讓我們用Python編寫這個方程式...
To test this function write a call using the parameters from above…
要測試此功能,請使用上面的參數(shù)編寫調(diào)用…
108.29995068075098Note: 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.
值得一提的是,隨著復合頻率的極限接近無窮大,時間周期內(nèi)的結果量也就越高。
108.29995068075098 # Compounding period of 12108.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.
證明不在本文的討論范圍之內(nèi),但結果卻是一個不斷復雜化的方程式。 將來,我將討論持續(xù)復利,交易和時間的重要性,以及它們與包括Black-Scholes方程在內(nèi)的高級模型推導的關系。
翻譯自: https://towardsdatascience.com/quantitative-finance-in-python-e8d48e6b9c23
python 傳不定量參數(shù)
總結
以上是生活随笔為你收集整理的python 传不定量参数_Python中的定量金融的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到青萝卜什么意思
- 下一篇: 贝叶斯 朴素贝叶斯_手动执行贝叶斯分析