| Author |
Message |
![[Post New]](/community/templates/default/images/icon_minipost_new.gif) 11/10/2009 21:48:48
|
ildefons.magrans@cern.ch
Joined: 21/02/2009 18:20:32
Messages: 22
Offline
|
I would like to use the chart open lab module to plot information from my strategies. To do that, my strategy should send a Map with String keys and numeric values because this is a type understood by the chart module. My question is how can I send this map? If this is not possible, how else can I plot information generated by my strategy using the chart module?
|
|
|
 |
![[Post New]](/community/templates/default/images/icon_minipost_new.gif) 12/10/2009 07:36:05
|
nnidhi3
Joined: 10/09/2009 07:17:23
Messages: 12
Offline
|
I am using jfreechart package to plot my charts from the data given by the strategy. However, I am running into trouble.
I have designed my classes, so that the GraphicsPlotter class is entirely separate from the MyStrategy class. I need to create an object of the GraphicsPlotter class in the MyStrategy class and send the data to be plotted to one of the methods of the GraphicsPlotter class.
Code Snippet (MyStrategy.java):
91 GraphicsPlotter graph = new GraphicsPlotter("Plot Graph" ;
92 graph.CreateGraph(data);
I compiled GraphicsPlotter.java and placed its .class file in D:\MarketCetera_Source\source\strategyagent\src\test\sample_data\modules\jars. Now, when I run the following command,
D:\MarketCetera_Source\source\strategyagent > mvn -Pexecute exec:java -DsampleName=MyStrategy.txt
I get this error:
ERROR event JAVA Strategy MyStrategy(metc:strategy:system:myStrategy) could not be compiled:
ERROR: MyStrategy.java:91: cannot find symbol
symbol : class GraphicsPlotter
location: class MyStrategy
It is not able to load the GraphicsPlotter class. Can we not create object of any other class in the MyStrategy class or is there a different way to do so? Do we need to modify MyStrategy.txt too.
Please help.
P.S.: I hav emodified source\strategyagent\pom.xml file so that I can run the above command
This message was edited 2 times. Last update was at 12/10/2009 07:37:46
|
|
|
 |
![[Post New]](/community/templates/default/images/icon_minipost_new.gif) 12/10/2009 08:34:33
|
ildefons.magrans@cern.ch
Joined: 21/02/2009 18:20:32
Messages: 22
Offline
|
Hi nnidhi3,
You answered my question with a question. Maybe you should have opened a new thread...
Ildefons
|
|
|
 |
![[Post New]](/community/templates/default/images/icon_minipost_new.gif) 13/10/2009 17:37:57
|
anshul
Joined: 26/02/2009 01:29:29
Messages: 34
Offline
|
You are right in pointing out that the 1.5.0 Strategy Module API doesn't provide means to emit Map objects. This limitation has been addressed in the trunk. In the next release, not only will you be able to emit arbitrary object types from a Strategy, you will also be able to create data flows using the strategy module API.
In 1.5.0 the Strategy API only allows you to emit Events, Orders, Suggestions, Notifications & Log Events. The chart module is capable of handling SymbolExchangeEvents (to display the price on the bid/ask/trade events) and MarketstatEvents (to display the OHLC chart) as well. So if the data that you're wanting to plot can be displayed as either of these two charts, you can emit either of these two events with appropriate price or ohlc values directly into the chart module.
A workaround to emit map objects from the strategy is to emit objects of one of the types that Strategy API supports, say MarketstatEvent, to a CEP module and use a CEP query to emit certain attributes of that object in a map. For example, if you wanted to emit the values in open,high,low,close attributes of Marketstat event in a map with the keys axis1, axis2, axis3, axis4 you can create the following data flow from the strategy to the cep module to the chart module.
The strategy will emit MarketstatEvent objects with axis1, axis2, axis3, axis4 values in the open, high, low, close attributes of the event object. The CEP query will extract those attributes into a Map object which the chart module will be able to plot.
I haven't tested this so if you face problems in getting this to work, do post back.
This message was edited 1 time. Last update was at 13/10/2009 17:38:28
|
|
|
 |
|
|