Dear Jrai and others!
I have minute by minute data for the stock index futures. Variables are Date, Time, Thprice(theoretic price by model), Rprcie(real trading price), rate(interest rate), maturity, Signal(+1 stands for long arbitrage that longs futures and shorts stocks; -1 stands for short arbitrage; 0 stands for doing nothing). Every minute, when I get the +1 ( -1) singal, I can execute the long(short) arbitrage strategy instantaneously and maintain the positions till futures maturity. Next, I will calculate the profits from respective strategy. Owing to the mark-to-market settlement rule, I have to calculate loss or profit from my strategy on each day end. For example, at day t and i minute of session, the +1 signal appears, I execute long strategy instantaneously, my profit on the day t end is:
[Rprcie(t)- Rprcie(ti)]*rate*maturity----ti represents ith minute of day t. In the next trading day, my profit is: [Rprcie(t+1)- Rprcie(t)]*rate*maturity and so on till maturity. My overall profit is the sum of the above. Note if the signal appears on the last minute of the trading day, I cannot build my position. I am not able to write the sas code to calculate the overall profit. Would you mind wasting your valuable time to help me? Thanks a lot.
May you understand what I mean. My sample dataset is at the attachment.
I have minute by minute data for the stock index futures. Variables are Date, Time, Thprice(theoretic price by model), Rprcie(real trading price), rate(interest rate), maturity, Signal(+1 stands for long arbitrage that longs futures and shorts stocks; -1 stands for short arbitrage; 0 stands for doing nothing). Every minute, when I get the +1 ( -1) singal, I can execute the long(short) arbitrage strategy instantaneously and maintain the positions till futures maturity. Next, I will calculate the profits from respective strategy. Owing to the mark-to-market settlement rule, I have to calculate loss or profit from my strategy on each day end. For example, at day t and i minute of session, the +1 signal appears, I execute long strategy instantaneously, my profit on the day t end is:
[Rprcie(t)- Rprcie(ti)]*rate*maturity----ti represents ith minute of day t. In the next trading day, my profit is: [Rprcie(t+1)- Rprcie(t)]*rate*maturity and so on till maturity. My overall profit is the sum of the above. Note if the signal appears on the last minute of the trading day, I cannot build my position. I am not able to write the sas code to calculate the overall profit. Would you mind wasting your valuable time to help me? Thanks a lot.
May you understand what I mean. My sample dataset is at the attachment.