How to pass an fix length array to a c function
Parameters including : Total balance , Attach point, mortgage rate , Tranche Rate, Payment term and Prepayment CPR .
Cash Flow Chart result:
Full code(2 functions):
Label( self.update_frame, text="CPR" ).grid( row = 0, column= 0 )
w = Scale( self.update_frame, from_=0.01, to=0.20, resolution = 0.005, orient=HORIZONTAL, variable=self.rmbs_cpr, showvalue = True )
w.grid(row = Read more [...]
Modeling on MBS/Tranche involves 3 entities . Mortgages , Mortgage Pool and Tranches . Mortgage Pool is key in this relationship . Mortgage Pool collects cash flows from Mortgages and redistribute into different Tranches.
One Mortgage Pool has many Mortgages and One Mortgage Pool has many Tranches. So , the class of Mortgage Pool may like this :
public ArrayList tranches = new ArrayList();
public ArrayList mortgages = new ArrayList();
// add a Read more [...]
I've been read a tutorial about C# in last 2 days . Before that, I haven't read a single line of C# code in since I started to programming. C# syntax is very similar to C++ and Java . But develop in C# is not easy as its syntax seems. I've wrote some trivial codes about some financial calculation of a bond, it's quite similar to the code I've written before in Python, but this one focus more in a risk neutral perspective.
Basic Bond Class with No Coupon
protected float Read more [...]
When story begins
In Python , there is a shortcut in conditional checking, I didn't take much care about the difference of below form of conditional syntax :
if var :
if var is not None :
if var != None:
Explanation behind the scene is an analogy to difference of an empty string "" and NULL in a database . "" is an empty string but means something, NULL is nothing means nothing . In Python world , None equals NULL in Database , that's why "" == Read more [...]
When Dynamic Type comes to Trouble
As a dynamic programming languages , Python don't have a type on variables , as well as a arguments . This feature save us a lot workload and it enable us to focus on logical of program .
def add(x, y):
print add(5.0, 6)
Above function is straightforward and works fine if x and y are passed with int/ float/ string .
But things may Read more [...]
I've written a perl script to fetch Balance Sheet data and export them into a Excel spreadsheet .
use LWP::Simple -> this pacake is for scap data from web
use Excel::Writer::XLSX -> for writing excel file
perl hx.pl [Stock ID sperated by comma] [start year] [end year] [name of output excel spreadsheet]
Read more [...]
Original blog post wrote by Brian Holdefehr. This is a Chinese version of original post .
本文原文作者 Brian Holdefehr。若有不足，敬请斧正。
装饰器(Decorators) 是Python众多强大特性之一。装饰器除了本身编程语法上的作用之外，另外提供了一种有趣思维方式——"函数化"思维(a functional way)
我会从头开始介绍介绍装饰器的工作原理，接着会介绍几个必须了解的基本概念。之后，我们会详细深入探索一些装饰器实例以及其工作方式。最后我们会讨论一些装饰器的高阶应用，例如参数化装饰器(optional Read more [...]
Difference against Google Finance / Sina.com
Yahoo provide more rich function regarding to the Stock API than Google / Sina.com does. particular ,it provide customize return format which customized by supply a parameter in calling URL . Full parameter specification pls refer to this link .(credit to Kelly Elias ) .
200 calls per second , you will be warned if you exceed this limits
csv file returned
No market depth as SIna.com provide
Provide stock indication such as " Earnings Read more [...]
Google has officially announce that it won't sustain ongoing of Finance API, but there still a available API via URL API . Return data from web server is xml format . We need to parse the return text in Python and extract data .
Get the Stock Data
Google Web API format ( http://www.google.com/ig/api?stock=C ) , this will request market data for security code "C" ( Citigroup :) ) xml return result:
<finance module_id="0" Read more [...]