SmartQuant Discussion

Cumulated profit and loss per market
Page 1 of 1

Author:  bill [ Fri Sep 09, 2011 4:50 pm ]
Post subject:  Cumulated profit and loss per market

My strategy holds various markets (50). I would like to create equity curves of each market individually to see which market contributed to the performance.
However I fail using the PnL methods as they are reseted when a position is closed. Cumulating the pnl in the OnBar event fails as well as the event is triggered every day the amount of markets in my portfolio. Any suggestions are most welcome. One way of doing that would be using a dictionary.

Author:  aburnettthompson [ Sat Sep 10, 2011 9:37 am ]
Post subject:  Re: Cumulated profit and loss per market

Hi Bill,

Im not sure if this is possible with OpenQuant, but what I'm doing is writing a library to interface with my strategies. One of the functions is LogTrade() - which pushes the trade details out to disk. Then I can do the PnL calculation but separately.

Possibly not so helpful, but its just a suggestion that using c# we can think "outside the box"

Author:  bill [ Tue Sep 13, 2011 4:56 pm ]
Post subject:  Re: Cumulated profit and loss per market

thank you aburnettthompson,

I did something similar to what you suggested. However in a multi market portfolio I need to make sure I get the same amount of datapoints for all markets.
In addition I need to add other stats stuff costs OQ does not support. We're building an external library that supports highwatermark and performance fee simulations;-)


Author:  Baraz Sergey [ Tue Sep 13, 2011 5:28 pm ]
Post subject:  Re: Cumulated profit and loss per market


Unfortunately there is no simple way to see Equity and other statistics per instrument in OQ. You should do it in your strategy code and developing of an external library is a good idea.

The only trick I can suggest is to use scenario.cs to see statistics per instrument (if your strategy logic doesn't use pair trading, spread trading etc.). In scenario.cs you can load all instruments your solution is using in a list, then run your project for each instrument in this list separately and print/save statistics at the end of each run if required. Please take a look at these threads to see how to use scenario.cs:


Author:  bill [ Tue Sep 27, 2011 3:53 pm ]
Post subject:  Re: Cumulated profit and loss per market

Hi Sergey

Thank you very much for the addition.
However I found a "potential" bug. When you run the strategy with the FillOnBarMode NextBarOpen you get multiple entries with the same date in the MetaPortfolio EquitySeries.
Is this supposed to be like that?

Thanks, bill

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group