Title / Description
Code %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
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code