|
The following was implemented in Maple by Marcus Davidsson (2013)
davidsson_marcus@hotmail.com
with significant help from Axel Vogt (GetCSV)
|
|
|
1) Copy the two files (.mla and .hdb) to maple's lib folder ie in my case C:\Program Files (x86)\Maple 16\lib
2) Exit Maple, and then relaunch Maple.
3) You are set to go!
* Note one of the procedures uses C:\\WINDOWS\\SYSTEM32
However I have a 64 bit computer and it still seems to works for me :-)
1) PC = Percentage Changes for a row or column ordered price matrix
If time in the price matrix is increasing to the right or left then use the option row=true
If time in the price matrix is increasing up or down then use the option row=false
The return matrix always returns a percentage decimal form ie 0.02= 20%
2) GetCSV=Get a CSV file from a web url. Works with both http and https url's
GetCSV( url to csv file as a string)
Since the largest matrix the matrix browser in Maple can display is a 10001 x10001 matrix
Assign the datamatrix to a data table component to view the complete dataset
GetCSV uses C:\\WINDOWS\\SYSTEM32
3) CleanData=Remove extreme observations from the return matrix and substitute 0 for missing observations
If you want to nullify all abs(returns) > threshold ie 50% then type CleanData(datamatrix,50)
The cleaned return matrix is always expressed in percentage form ie 20%

![restart; with(MyFinance); A := Matrix([[100, 100, 100], [120, 130, 95]]); PC(A, row = true); PC(A, row = false); evalf((1/120)*(130-120), 4); evalf((1/130)*(95-130), 4); evalf((1/100)*(120-100)); evalf((1/100)*(130-100)); evalf((1/100)*(95-100))](http://www.maplesoft.com/view.aspx?SI=146473/62b3e8b24c9019fad56bc57a9e2a0ead.gif)
| (1) |
Works for both http and https urls. (Maples HTTP[Get] only works for http not https)

| (2) |
![restart; with(MyFinance); z1 := GetCSV("http://www.quandl.com/api/v1/datasets/USER_18Q/18R.csv?&auth_token=BXckVSG3twWkV272c9Q4&trim_start=1968-04-01&trim_end=2013-04-12&collapse=daily&transformation=rdiff&sort_order=desc"); CleanData(z1, 10); [max(z1[2 .. (), 2]), min(z1[2 .. (), 2])]; [max(z1[2 .. (), 3]), min(z1[2 .. (), 3])]; [max(z1[2 .. (), 4]), min(z1[2 .. (), 4])]](http://www.maplesoft.com/view.aspx?SI=146473/4ba61036ebdefd32b9a295447f972588.gif)
| (3) |
|