用gauss軟體排名前五大淨賣超的股票 - 經濟
By Daph Bay
at 2012-11-17T13:38
at 2012-11-17T13:38
Table of Contents
假定抓出外資資料形成y陣列,
其中col1是日期,col2股票,col4股價col5交易量col6(買0賣1)col7是交易者
若有a項標的股票,b個時段
把股票轉成號碼1到a,時段轉成1到b
然後定義一個陣列
x=zeros(a,b);
for i (1,309281,1); /這邊309281看抓出幾筆自行更改
x[y[i,2],y[i,1]] = x[y[i,2],y[i,1]] + y[i,4]*y[i,5]*(1-2*y[i,6]);
endfor;
這樣就得到一個2維陣列x
再回鋪成原來形式
v=zeros(a*b,3); /col1股票,col2是時段,col3是買賣超金額(買+賣-)
k=0;
for i (1,a,1);
for j (1,b,1);
k=k+1;
v[k,1] = a;
v[k,2] = b;
v[k,3] = x[i,j];
endfor;
endfor;
然後選想要的限定來排列
v=sortc(sortc(v,3),2)
就會變成按各時段買賣超排列
以上語法還有置換問題可能閣下要自行調整
在下沒實際用過gauss,不過寫程式的觀念大致如上
--
其中col1是日期,col2股票,col4股價col5交易量col6(買0賣1)col7是交易者
若有a項標的股票,b個時段
把股票轉成號碼1到a,時段轉成1到b
然後定義一個陣列
x=zeros(a,b);
for i (1,309281,1); /這邊309281看抓出幾筆自行更改
x[y[i,2],y[i,1]] = x[y[i,2],y[i,1]] + y[i,4]*y[i,5]*(1-2*y[i,6]);
endfor;
這樣就得到一個2維陣列x
再回鋪成原來形式
v=zeros(a*b,3); /col1股票,col2是時段,col3是買賣超金額(買+賣-)
k=0;
for i (1,a,1);
for j (1,b,1);
k=k+1;
v[k,1] = a;
v[k,2] = b;
v[k,3] = x[i,j];
endfor;
endfor;
然後選想要的限定來排列
v=sortc(sortc(v,3),2)
就會變成按各時段買賣超排列
以上語法還有置換問題可能閣下要自行調整
在下沒實際用過gauss,不過寫程式的觀念大致如上
--
Tags:
經濟
All Comments
By Madame
at 2012-11-21T12:51
at 2012-11-21T12:51
By Agnes
at 2012-11-23T03:20
at 2012-11-23T03:20
By Damian
at 2012-11-25T00:31
at 2012-11-25T00:31
By Elvira
at 2012-11-26T02:50
at 2012-11-26T02:50
Related Posts
用gauss軟體排名前五大淨賣超的股票
By Belly
at 2012-11-17T11:38
at 2012-11-17T11:38
台灣的退休金制度
By Ula
at 2012-11-17T11:31
at 2012-11-17T11:31
一題公民
By Noah
at 2012-11-16T23:36
at 2012-11-16T23:36
需求彈性
By Sandy
at 2012-11-15T10:46
at 2012-11-15T10:46
需求彈性
By Una
at 2012-11-15T09:51
at 2012-11-15T09:51