does anyone know why my trades shown on the picture below have negative profit? I bought 2 contracts at 20.00$ and 20.05$, then sold at 20.5301 and logs show that I lost...
2013-02-02 Buy $20.00
2013-02-02 Buy $20.05
Then later that day after you bought, clearing was $20.7095, so on the two positions you were paid variation margin due to the clearing price of $20.7095. Then on 2013-02-03 the clearing was $21.0750 and you earned even more.
Then each day the clearing price was lower so your variation margin was negative. Then you sold at $20.5301 which was lesss than the most recent previous clearing price -- $20.8101. The very last transaction in the log is the 0.5% trading fee.
So your trade resulted in half a percent trading fee when you bought (the two 0.005 BTC trading fee) plus the half a percent trading fee when you sold (the combined 0.01 BTC trading fee entry) and the sum of the margin variances. Now remember, the variation margin is calculated as:
VM = -(1/PriceClose - 1/PriceOpen) * S;
(-(1/PriceClose - 1/PriceOpen) * 10) * N contracts
For instance, the last variation margin had a clearing price of $20.8101 and you sold at $20.5301. So the variation margin was:
VM = (-(1/$20.5301 - 1/$20.8101) * 10) * 2 contracts
VM = (-(0.0487089687 - 0.0480535893) * 10) * 2 contracts
VM = (-(0.0006553794) * 10) * 2 contracts
VM = (-0.0065537940) * 2 contracts
VM = -0.01310758 BTC
(somewhere the calculation must be getting precision issues, as my rounding at 8 decimals is off by a really small amount from the 0.01310526 reported in your pic.)