asdasd
Delphi
code posted
by
asdasd
created at 14 Mar 15:28
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
%0\ Clear parameters tmp.signal=NaN; results.ec(i)=results.ec(i-1); %1\ compute hedge ratio here if ((data.timestamp(i,1)-tmp.last_hedge>=params.hedge_time) || min(tmp.exposure)==0) tmp.last_hedge=data.timestamp(i,1); computing_linear_spread; if sum(tmp.beta)~=0 tmp.exposure=[1 tmp.beta(1,1)]; %fprintf('New hedge ratio: %6.2f, At: %s \n', tmp.exposure(1,2), datestr(data.timestamp(i,1))); end end %2\ check for age and update prices if (isnan(data.bid0(i))==0)||(data.timestamp(i)-tmp.updated0>params.age) tmp.bid0=data.bid0(i); tmp.ask0=data.ask0(i); tmp.updated0=data.timestamp(i); end; if (isnan(data.bid1(i))==0)||(data.timestamp(i)-tmp.updated1>params.age) tmp.bid1=data.bid1(i); tmp.ask1=data.ask1(i); tmp.updated1=data.timestamp(i); end; %3\ do actions only if both prices exist if (isnan(tmp.bid0) || isnan(tmp.bid1)) else %======================================== % RISK SYSTEM if tmp.ans1=='1' simple_spread_signal; elseif tmp.ans1=='2' linear_spread_signal; end |
1.21 KB in 3 ms with coderay