onMarketChange()

101 views
Skip to first unread message

Ali

unread,
Jul 16, 2012, 12:22:36 AM7/16/12
to jbook...@googlegroups.com
Greetings,
Is there an onMarketChange() method (in Strategy) in JBookTrader similar to the one in JSystemTrader? I am trying to use the the price of the last market trade to calculate the profit/loss for my current position in real time.

Is onBookSnapshot() the equivalent in JBT? With something like:
price = marketbook.getSnapshot().getPrice();

Thanks.


Eugene Kononov

unread,
Jul 16, 2012, 7:13:23 AM7/16/12
to jbook...@googlegroups.com
Yes, the equivalent in JBT is onBookSnapshot(). It is called every second.
> --
> You received this message because you are subscribed to the Google Groups
> "JBookTrader" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jbooktrader/-/gFWK2vKwl_cJ.
> To post to this group, send email to jbook...@googlegroups.com.
> To unsubscribe from this group, send email to
> jbooktrader...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jbooktrader?hl=en.
>
>

Ali

unread,
Jul 16, 2012, 9:40:57 AM7/16/12
to jbook...@googlegroups.com
Thank you.


On Monday, July 16, 2012 4:13:23 AM UTC-7, nonlinear wrote:
Yes, the equivalent in JBT is onBookSnapshot(). It is called every second.

Ali

unread,
Jul 17, 2012, 11:06:18 PM7/17/12
to jbook...@googlegroups.com
One more question. I noticed that onBookSnapshot() is not called immediately upon the launching of a strategy. I found the following reference in an earlier post:

"The strategy must run an hour before onBookSnapshot() is called for the first time." ... "That is correct. The intent of this is to allow the indicators (such as EMA and SMA based indicators) to settle in. This is a feature, not a problem."

Is this still the case?

Thank you in advance.

Eugene Kononov

unread,
Jul 18, 2012, 8:48:50 AM7/18/12
to jbook...@googlegroups.com
Yes, that's correct. Some of the indicators in JBT are exponential moving averages, so there is a configurable waiting period in JBT (set to 1 hour) to allow all indicators to settle before onBookSnapshot() is called for the first time.

--
You received this message because you are subscribed to the Google Groups "JBookTrader" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jbooktrader/-/DRLCfHVJUcAJ.

Ali

unread,
Jul 18, 2012, 2:00:46 PM7/18/12
to jbook...@googlegroups.com
Thanks. Is this configuration done through the PERIOD parameter of the Strategy SetParams()?

Ali

unread,
Jul 18, 2012, 7:08:37 PM7/18/12
to jbook...@googlegroups.com
MIN_SAMPLE_SIZE in IndicatorManager drives the 1 hour?

Eugene Kononov

unread,
Jul 18, 2012, 7:56:57 PM7/18/12
to jbook...@googlegroups.com
That's correct.

On 7/18/12, Ali <ali...@gmail.com> wrote:
> MIN_SAMPLE_SIZE in IndicatorManager drives the 1 hour?
>
> --
> You received this message because you are subscribed to the Google Groups
> "JBookTrader" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jbooktrader/-/uZ3N-Tf52O4J.
Reply all
Reply to author
Forward
0 new messages