input dates are out-of-order Exception

View: New views
20 Messages — Rating Filter:   Alert me  

input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am running some back tests right now that loop optimization code. It
seems like I cannot complete a single pass without the following exception:

I am streaming everything from a database.

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order
    at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
Source)2008-03-05 15:55:22,906 [main] INFO
[org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
40.38 V : 1.08971E7 generated 61 trade indications

    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
...

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK...so I might have an explanation for this....

The PaperBroker maintains state of the last candle date so that it can correctly insert the order execution date. This date should not be the present date/time since in back testing, orders are placed in the "past". So, the helper class the PaperBroker uses stores that last millisecond time to ensure that the next date/time generated is later than the previous one...or so I understand from the code.

Now, when I do my back testing, I loop over different time windows, for a particular instrument, I start from the very beginning and move towards "now". Then, i take another instrument, and start from the beginning and move to "now". Between the two runs, the Paper brokers state is not reset nor is the helper class reset. So, when I am done with testing year 2007 for instrument A, and start testing from 1988 for instrument B, it looks to the Paper broker as if the ordering of the candles is all messed up since it does not key on instrument type...or so I think.

Could someone please validate my logic here? So...if this is the case, what can I do to resolve this? I would rather not re-initialize every piece if the infrastructure for each loop...

Does the Paper broker have to keep track of when the last candle was?

HC


H. Canterburry wrote:
I am running some back tests right now that loop optimization code. It
seems like I cannot complete a single pass without the following exception:

I am streaming everything from a database.

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order
    at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
Source)2008-03-05 15:55:22,906 [main] INFO
[org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
40.38 V : 1.08971E7 generated 61 trade indications

    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
...

_______________________________________________
ccapi mailing list
ccapi@activestocks.de
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Henry,

see below

On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry <canterburry@...> wrote:

OK...so I might have an explanation for this....

The PaperBroker maintains state of the last candle date so that it can
correctly insert the order execution date. This date should not be the
present date/time since in back testing, orders are placed in the "past".
So, the helper class the PaperBroker uses stores that last millisecond time
to ensure that the next date/time generated is later than the previous
one...or so I understand from the code.

Yes, its correctly describes the logic and intentions.
 


Now, when I do my back testing, I loop over different time windows, for a
particular instrument, I start from the very beginning and move towards
"now". Then, i take another instrument, and start from the beginning and
move to "now". Between the two runs, the Paper brokers state is not reset
nor is the helper class reset. So, when I am done with testing year 2007 for
instrument A, and start testing from 1988 for instrument B, it looks to the
Paper broker as if the ordering of the candles is all messed up since it
does not key on instrument type...or so I think.

Interesting... You are right, backtest context is not supposed to be "rewind" (or at least not yet). So after it reaches the end date/time it supposed to be discarded. I have two suggestions:

1. why do not you just re-load spring configuration before starting on the next instrument?

2. maybe you can backtest multiple instruments in one run (instead of doing one-run-per-instrument)?

A cleaner solution would be to make PaperBroker use TimeStampService of ReplayService (instead of implementing same functionality locally), move disambiguation code there, and reset ReplayService at the every rerun. I'll look at this later (sorry, very busy presently).

Meanwhile, I think you can just remove use of currentTime() in PaperBroker, and assign timestamp in fireExecution just from currentTimeStamp.get() directly (the disambiguation there seem not important)

-Mike

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

Thanks for the input. I'll try your last suggestion for now. I presume
this issue would be addressed in some future version. I think
"rebooting" AQ (i.e. reload the spring configuration) seems like a very
heavy handed approach...sure, it would work but it seems to me my
scenario is something that a framework such as AQ should be able to
handle. I understand that this is the state for now and it's just a
matter of someone having the time to look at it.

My test strategy so far is in its infancy and I am putting in place all
the infrastructure to backtest. I'll eventually evolve my test strategy
to handle multiple symbols simultaneously but I am taking baby steps for
now. Either way, "rewinding" the replay service seems a fairly basic
requirement.

Thanks
HC


Mike Kroutikov wrote:

> Hi Henry,
>
> see below
>
> On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry <canterburry@...
> <mailto:canterburry@...>> wrote:
>
>
>     OK...so I might have an explanation for this....
>
>     The PaperBroker maintains state of the last candle date so that it can
>     correctly insert the order execution date. This date should not be the
>     present date/time since in back testing, orders are placed in the
>     "past".
>     So, the helper class the PaperBroker uses stores that last
>     millisecond time
>     to ensure that the next date/time generated is later than the previous
>     one...or so I understand from the code.
>
>
> Yes, its correctly describes the logic and intentions.
>  
>
>
>
>     Now, when I do my back testing, I loop over different time
>     windows, for a
>     particular instrument, I start from the very beginning and move
>     towards
>     "now". Then, i take another instrument, and start from the
>     beginning and
>     move to "now". Between the two runs, the Paper brokers state is
>     not reset
>     nor is the helper class reset. So, when I am done with testing
>     year 2007 for
>     instrument A, and start testing from 1988 for instrument B, it
>     looks to the
>     Paper broker as if the ordering of the candles is all messed up
>     since it
>     does not key on instrument type...or so I think.
>
>
> Interesting... You are right, backtest context is not supposed to be
> "rewind" (or at least not yet). So after it reaches the end date/time
> it supposed to be discarded. I have two suggestions:
>
> 1. why do not you just re-load spring configuration before starting on
> the next instrument?
>
> 2. maybe you can backtest multiple instruments in one run (instead of
> doing one-run-per-instrument)?
>
> A cleaner solution would be to make PaperBroker use TimeStampService
> of ReplayService (instead of implementing same functionality locally),
> move disambiguation code there, and reset ReplayService at the every
> rerun. I'll look at this later (sorry, very busy presently).
>
> Meanwhile, I think you can just remove use of currentTime() in
> PaperBroker, and assign timestamp in fireExecution just from
> currentTimeStamp.get() directly (the disambiguation there seem not
> important)
>
> -Mike
> ------------------------------------------------------------------------
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>  

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

currentTimeStamp.get() did do the trick so now at least the exception is
gone. However, I have been looking at the MarketDataReplay service and
am trying to figure out how to get it to "rewind". Since the entire
thing implements iterable and mergeSort does not have any way of going
back to the first element etc...this one might be tricky. Any ideas anyone?

HC



Mike Kroutikov wrote:

> Hi Henry,
>
> see below
>
> On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry <canterburry@...
> <mailto:canterburry@...>> wrote:
>
>
>     OK...so I might have an explanation for this....
>
>     The PaperBroker maintains state of the last candle date so that it can
>     correctly insert the order execution date. This date should not be the
>     present date/time since in back testing, orders are placed in the
>     "past".
>     So, the helper class the PaperBroker uses stores that last
>     millisecond time
>     to ensure that the next date/time generated is later than the previous
>     one...or so I understand from the code.
>
>
> Yes, its correctly describes the logic and intentions.
>  
>
>
>
>     Now, when I do my back testing, I loop over different time
>     windows, for a
>     particular instrument, I start from the very beginning and move
>     towards
>     "now". Then, i take another instrument, and start from the
>     beginning and
>     move to "now". Between the two runs, the Paper brokers state is
>     not reset
>     nor is the helper class reset. So, when I am done with testing
>     year 2007 for
>     instrument A, and start testing from 1988 for instrument B, it
>     looks to the
>     Paper broker as if the ordering of the candles is all messed up
>     since it
>     does not key on instrument type...or so I think.
>
>
> Interesting... You are right, backtest context is not supposed to be
> "rewind" (or at least not yet). So after it reaches the end date/time
> it supposed to be discarded. I have two suggestions:
>
> 1. why do not you just re-load spring configuration before starting on
> the next instrument?
>
> 2. maybe you can backtest multiple instruments in one run (instead of
> doing one-run-per-instrument)?
>
> A cleaner solution would be to make PaperBroker use TimeStampService
> of ReplayService (instead of implementing same functionality locally),
> move disambiguation code there, and reset ReplayService at the every
> rerun. I'll look at this later (sorry, very busy presently).
>
> Meanwhile, I think you can just remove use of currentTime() in
> PaperBroker, and assign timestamp in fireExecution just from
> currentTimeStamp.get() directly (the disambiguation there seem not
> important)
>
> -Mike
> ------------------------------------------------------------------------
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>  

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One way would be to implement a "wrapper" on top of IReplayService that will have the rewind method. But internally it will re-instantiate MarketDataReplay at every rewind, then delegate functionality to it.
 
What do you plan to do with the subscriptions? Make TS to cancel and re-subscribe? Urrgh.. that would require a rewind method on TS.
 
-Mike

On Fri, Mar 7, 2008 at 10:53 AM, Henry Canterburry <canterburry@...> wrote:
Mike,

currentTimeStamp.get() did do the trick so now at least the exception is
gone. However, I have been looking at the MarketDataReplay service and
am trying to figure out how to get it to "rewind". Since the entire
thing implements iterable and mergeSort does not have any way of going
back to the first element etc...this one might be tricky. Any ideas anyone?

HC



Mike Kroutikov wrote:
> Hi Henry,
>
> see below
>
> On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry <canterburry@...
> <mailto:canterburry@...>> wrote:
>
>
>     OK...so I might have an explanation for this....
>
>     The PaperBroker maintains state of the last candle date so that it can
>     correctly insert the order execution date. This date should not be the
>     present date/time since in back testing, orders are placed in the
>     "past".
>     So, the helper class the PaperBroker uses stores that last
>     millisecond time
>     to ensure that the next date/time generated is later than the previous
>     one...or so I understand from the code.
>
>
> Yes, its correctly describes the logic and intentions.
>
>
>
>
>     Now, when I do my back testing, I loop over different time
>     windows, for a
>     particular instrument, I start from the very beginning and move
>     towards
>     "now". Then, i take another instrument, and start from the
>     beginning and
>     move to "now". Between the two runs, the Paper brokers state is
>     not reset
>     nor is the helper class reset. So, when I am done with testing
>     year 2007 for
>     instrument A, and start testing from 1988 for instrument B, it
>     looks to the
>     Paper broker as if the ordering of the candles is all messed up
>     since it
>     does not key on instrument type...or so I think.
>
>
> Interesting... You are right, backtest context is not supposed to be
> "rewind" (or at least not yet). So after it reaches the end date/time
> it supposed to be discarded. I have two suggestions:
>
> 1. why do not you just re-load spring configuration before starting on
> the next instrument?
>
> 2. maybe you can backtest multiple instruments in one run (instead of
> doing one-run-per-instrument)?
>
> A cleaner solution would be to make PaperBroker use TimeStampService
> of ReplayService (instead of implementing same functionality locally),
> move disambiguation code there, and reset ReplayService at the every
> rerun. I'll look at this later (sorry, very busy presently).
>
> Meanwhile, I think you can just remove use of currentTime() in
> PaperBroker, and assign timestamp in fireExecution just from
> currentTimeStamp.get() directly (the disambiguation there seem not
> important)
>
> -Mike
> ------------------------------------------------------------------------
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have made the subscribe and unsubscribe methods public on the TS, from
my optimization strategy, I make sure the TS subscribes to the correct
instrument when I am ready to test, and then unsubscribe the TS when the
testing is done.

I'll try the wrapper idea, I was also experimenting with the
scope="prototype" setting in Spring but since I internally hold a handle
to the replay service, that strategy does not seem to be working...also,
I am getting some instantiation exceptions from Spring due to some
objects the replay service depends on not being available at the right
time. Probably a matter of specifying bean dependencies.

For now, I'll write a wrapper, see how it works out...

HC

Mike Kroutikov wrote:

> One way would be to implement a "wrapper" on top of IReplayService
> that will have the rewind method. But internally it will
> re-instantiate MarketDataReplay at every rewind, then delegate
> functionality to it.
>  
> What do you plan to do with the subscriptions? Make TS to cancel and
> re-subscribe? Urrgh.. that would require a rewind method on TS.
>  
> -Mike
>
> On Fri, Mar 7, 2008 at 10:53 AM, Henry Canterburry
> <canterburry@... <mailto:canterburry@...>> wrote:
>
>     Mike,
>
>     currentTimeStamp.get() did do the trick so now at least the
>     exception is
>     gone. However, I have been looking at the MarketDataReplay service and
>     am trying to figure out how to get it to "rewind". Since the entire
>     thing implements iterable and mergeSort does not have any way of going
>     back to the first element etc...this one might be tricky. Any
>     ideas anyone?
>
>     HC
>
>
>
>     Mike Kroutikov wrote:
>     > Hi Henry,
>     >
>     > see below
>     >
>     > On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry
>     <canterburry@... <mailto:canterburry@...>
>     > <mailto:canterburry@... <mailto:canterburry@...>>>
>     wrote:
>     >
>     >
>     >     OK...so I might have an explanation for this....
>     >
>     >     The PaperBroker maintains state of the last candle date so
>     that it can
>     >     correctly insert the order execution date. This date should
>     not be the
>     >     present date/time since in back testing, orders are placed
>     in the
>     >     "past".
>     >     So, the helper class the PaperBroker uses stores that last
>     >     millisecond time
>     >     to ensure that the next date/time generated is later than
>     the previous
>     >     one...or so I understand from the code.
>     >
>     >
>     > Yes, its correctly describes the logic and intentions.
>     >
>     >
>     >
>     >
>     >     Now, when I do my back testing, I loop over different time
>     >     windows, for a
>     >     particular instrument, I start from the very beginning and move
>     >     towards
>     >     "now". Then, i take another instrument, and start from the
>     >     beginning and
>     >     move to "now". Between the two runs, the Paper brokers state is
>     >     not reset
>     >     nor is the helper class reset. So, when I am done with testing
>     >     year 2007 for
>     >     instrument A, and start testing from 1988 for instrument B, it
>     >     looks to the
>     >     Paper broker as if the ordering of the candles is all messed up
>     >     since it
>     >     does not key on instrument type...or so I think.
>     >
>     >
>     > Interesting... You are right, backtest context is not supposed to be
>     > "rewind" (or at least not yet). So after it reaches the end
>     date/time
>     > it supposed to be discarded. I have two suggestions:
>     >
>     > 1. why do not you just re-load spring configuration before
>     starting on
>     > the next instrument?
>     >
>     > 2. maybe you can backtest multiple instruments in one run
>     (instead of
>     > doing one-run-per-instrument)?
>     >
>     > A cleaner solution would be to make PaperBroker use TimeStampService
>     > of ReplayService (instead of implementing same functionality
>     locally),
>     > move disambiguation code there, and reset ReplayService at the every
>     > rerun. I'll look at this later (sorry, very busy presently).
>     >
>     > Meanwhile, I think you can just remove use of currentTime() in
>     > PaperBroker, and assign timestamp in fireExecution just from
>     > currentTimeStamp.get() directly (the disambiguation there seem not
>     > important)
>     >
>     > -Mike
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > ccapi mailing list
>     > ccapi@... <mailto:ccapi@...>
>     > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>     >
>
>     _______________________________________________
>     ccapi mailing list
>     ccapi@... <mailto:ccapi@...>
>     http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by H. Canterburry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

I might be understanding better now your question around the
subscriptions. Looks like the MarketDataReplayService must be
instantiated before the subscriptions are placed and but the iterator
method is must be called after the subscriptions have been placed.
Obviously, if I am creating a new MarketDataReplayService as part of the
iterator call to my wrapper, then the subscriptions are lost since I am
creating a new replay service which does not hold the handles to the TSs
that subscribe to it?

Is that what you meant?

Either way, the above seems to be happening in my wrapper class.

HC

Mike Kroutikov wrote:

> One way would be to implement a "wrapper" on top of IReplayService
> that will have the rewind method. But internally it will
> re-instantiate MarketDataReplay at every rewind, then delegate
> functionality to it.
>  
> What do you plan to do with the subscriptions? Make TS to cancel and
> re-subscribe? Urrgh.. that would require a rewind method on TS.
>  
> -Mike
>
> On Fri, Mar 7, 2008 at 10:53 AM, Henry Canterburry
> <canterburry@... <mailto:canterburry@...>> wrote:
>
>     Mike,
>
>     currentTimeStamp.get() did do the trick so now at least the
>     exception is
>     gone. However, I have been looking at the MarketDataReplay service and
>     am trying to figure out how to get it to "rewind". Since the entire
>     thing implements iterable and mergeSort does not have any way of going
>     back to the first element etc...this one might be tricky. Any
>     ideas anyone?
>
>     HC
>
>
>
>     Mike Kroutikov wrote:
>     > Hi Henry,
>     >
>     > see below
>     >
>     > On Wed, Mar 5, 2008 at 5:46 PM, H. Canterburry
>     <canterburry@... <mailto:canterburry@...>
>     > <mailto:canterburry@... <mailto:canterburry@...>>>
>     wrote:
>     >
>     >
>     >     OK...so I might have an explanation for this....
>     >
>     >     The PaperBroker maintains state of the last candle date so
>     that it can
>     >     correctly insert the order execution date. This date should
>     not be the
>     >     present date/time since in back testing, orders are placed
>     in the
>     >     "past".
>     >     So, the helper class the PaperBroker uses stores that last
>     >     millisecond time
>     >     to ensure that the next date/time generated is later than
>     the previous
>     >     one...or so I understand from the code.
>     >
>     >
>     > Yes, its correctly describes the logic and intentions.
>     >
>     >
>     >
>     >
>     >     Now, when I do my back testing, I loop over different time
>     >     windows, for a
>     >     particular instrument, I start from the very beginning and move
>     >     towards
>     >     "now". Then, i take another instrument, and start from the
>     >     beginning and
>     >     move to "now". Between the two runs, the Paper brokers state is
>     >     not reset
>     >     nor is the helper class reset. So, when I am done with testing
>     >     year 2007 for
>     >     instrument A, and start testing from 1988 for instrument B, it
>     >     looks to the
>     >     Paper broker as if the ordering of the candles is all messed up
>     >     since it
>     >     does not key on instrument type...or so I think.
>     >
>     >
>     > Interesting... You are right, backtest context is not supposed to be
>     > "rewind" (or at least not yet). So after it reaches the end
>     date/time
>     > it supposed to be discarded. I have two suggestions:
>     >
>     > 1. why do not you just re-load spring configuration before
>     starting on
>     > the next instrument?
>     >
>     > 2. maybe you can backtest multiple instruments in one run
>     (instead of
>     > doing one-run-per-instrument)?
>     >
>     > A cleaner solution would be to make PaperBroker use TimeStampService
>     > of ReplayService (instead of implementing same functionality
>     locally),
>     > move disambiguation code there, and reset ReplayService at the every
>     > rerun. I'll look at this later (sorry, very busy presently).
>     >
>     > Meanwhile, I think you can just remove use of currentTime() in
>     > PaperBroker, and assign timestamp in fireExecution just from
>     > currentTimeStamp.get() directly (the disambiguation there seem not
>     > important)
>     >
>     > -Mike
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > ccapi mailing list
>     > ccapi@... <mailto:ccapi@...>
>     > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>     >
>
>     _______________________________________________
>     ccapi mailing list
>     ccapi@... <mailto:ccapi@...>
>     http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
-HC

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am also facing this error. Since this message is from 2008, I think it has been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein

H. Canterburry wrote:
I am running some back tests right now that loop optimization code. It
seems like I cannot complete a single pass without the following exception:

I am streaming everything from a database.

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order
    at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown Source)
    at
org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
Source)2008-03-05 15:55:22,906 [main] INFO
[org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
40.38 V : 1.08971E7 generated 61 trade indications

    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at
org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
Source)
    at org.activequant.util.pattern.events.Event.fire(Unknown Source)
    at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
Source)
    at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
    at org.activequant.data.util.MarketDataReplayService.fire(Unknown
Source)
...

_______________________________________________
ccapi mailing list
ccapi@activestocks.de
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


-----
-HC

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike

On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein


On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein


On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes, sources would help

On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein


On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi




_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

aqt-example.zip (7K) Download Attachment

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What is the exception stack? 

Can you also add a link to the "Mike's sample posted here in the mailing list"?

-Mike

On Wed, Oct 21, 2009 at 10:14 AM, Franklin S. Dattein <franklin@...> wrote:
Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein



On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,

the exception is the one in the beggining of this email thread:
Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order at org.activequant.util.tools.UniqueDateGenerator.generate(UnknownSource)

I could not found the example on Nabble and I don't remember if the author was you. I still have the code here, it is composed by 4 classes:
MainBacktest
TradeSystemConfig
TradeSystemLogic
YahooBacktestContextConfig.

Do you recognize it?

Thanks,
Franklin Samir Dattein


On Thu, Oct 22, 2009 at 11:09 AM, Mike Kroutikov <pgmmpk@...> wrote:
What is the exception stack? 

Can you also add a link to the "Mike's sample posted here in the mailing list"?

-Mike


On Wed, Oct 21, 2009 at 10:14 AM, Franklin S. Dattein <franklin@...> wrote:
Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein



On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Franklin, I am somewhat puzzled by your code.
It seems to me that Henry's problem was quite different (and he did not post his code, btw).

Yes, MainBacktest, etc classes are familiar. I believe they were submitted by CriC as an example for some bug research.

Yet your code is VERY different. I see that you extend MarketTradeSystemBase, use @Optimize annotations, etc. And apparently expect something to happen in "onMarket" method. Shortly, I do not believe your code has anything to do with aq examples or CriC's sample. Therefore, its incorrect to suggest that aq has a bug. Most likely there is a problem in your code. I suggest starting from existing example (with possible minor changes) and move step-by-step toward the functionality that you need. This way I and others on the list will have a chance to be more helpful.

Regards,

-Mike


On Thu, Oct 22, 2009 at 11:50 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,

the exception is the one in the beggining of this email thread:

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order at org.activequant.util.tools.UniqueDateGenerator.generate(UnknownSource)

I could not found the example on Nabble and I don't remember if the author was you. I still have the code here, it is composed by 4 classes:
MainBacktest
TradeSystemConfig
TradeSystemLogic
YahooBacktestContextConfig.

Do you recognize it?

Thanks,
Franklin Samir Dattein



On Thu, Oct 22, 2009 at 11:09 AM, Mike Kroutikov <pgmmpk@...> wrote:
What is the exception stack? 

Can you also add a link to the "Mike's sample posted here in the mailing list"?

-Mike


On Wed, Oct 21, 2009 at 10:14 AM, Franklin S. Dattein <franklin@...> wrote:
Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein



On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

Re: input dates are out-of-order Exception

by Franklin Dattein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,

thanks for the advice.
I have made some changes on that example, to be more similar to the Cric's example, in the attachment.


After this changes the problem noticed in the beginning of this thread has gone, probably because that exceptions was happening on a SeriesSpecification and the Cric's sampel doesn't not use series.

However, it brings me a few questions:
The examples under tradesystem.systems derives from MarketTradeSystemBase, which fires onMarket and deal with CandleSries
Cric's sample and some other examples do not derives from MarketTradeSystemBase, consequently they fire onCandle instead of onMarket, and they deal with InstrumentSpecification instead of SeriesSpecification.

I don't quite understand the differences between these two approaches and when to use one or another.  Could you give me an overview or point some documentation, please?

Thanks in advance,
Franklin Samir Dattein


On Thu, Oct 22, 2009 at 7:58 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, I am somewhat puzzled by your code.
It seems to me that Henry's problem was quite different (and he did not post his code, btw).

Yes, MainBacktest, etc classes are familiar. I believe they were submitted by CriC as an example for some bug research.

Yet your code is VERY different. I see that you extend MarketTradeSystemBase, use @Optimize annotations, etc. And apparently expect something to happen in "onMarket" method. Shortly, I do not believe your code has anything to do with aq examples or CriC's sample. Therefore, its incorrect to suggest that aq has a bug. Most likely there is a problem in your code. I suggest starting from existing example (with possible minor changes) and move step-by-step toward the functionality that you need. This way I and others on the list will have a chance to be more helpful.

Regards,

-Mike


On Thu, Oct 22, 2009 at 11:50 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,

the exception is the one in the beggining of this email thread:

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order at org.activequant.util.tools.UniqueDateGenerator.generate(UnknownSource)

I could not found the example on Nabble and I don't remember if the author was you. I still have the code here, it is composed by 4 classes:
MainBacktest
TradeSystemConfig
TradeSystemLogic
YahooBacktestContextConfig.

Do you recognize it?

Thanks,
Franklin Samir Dattein



On Thu, Oct 22, 2009 at 11:09 AM, Mike Kroutikov <pgmmpk@...> wrote:
What is the exception stack? 

Can you also add a link to the "Mike's sample posted here in the mailing list"?

-Mike


On Wed, Oct 21, 2009 at 10:14 AM, Franklin S. Dattein <franklin@...> wrote:
Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein



On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi




_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi

aqt-example.zip (7K) Download Attachment

Re: input dates are out-of-order Exception

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

These are two different (mutually exclusive) approaches.

With MarketTradeSystemBase style ("old style"), on every new candle system used to update "market" (which contains the whole history: all candles for all series up to and including current time) and pass this market object to the trading system.

With ReplayService style ("new backtester style"), trading system is in charge of keeping history (if it needs it). Backtester only distributes candles (trading system gets onCandle notification). New style is more scalable, but requires TS to configure data subscriptions (in onStart() method).

Hope this helps.

Cheers,
-Mike

On Fri, Oct 23, 2009 at 9:27 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,

thanks for the advice.
I have made some changes on that example, to be more similar to the Cric's example, in the attachment.


After this changes the problem noticed in the beginning of this thread has gone, probably because that exceptions was happening on a SeriesSpecification and the Cric's sampel doesn't not use series.

However, it brings me a few questions:
The examples under tradesystem.systems derives from MarketTradeSystemBase, which fires onMarket and deal with CandleSries
Cric's sample and some other examples do not derives from MarketTradeSystemBase, consequently they fire onCandle instead of onMarket, and they deal with InstrumentSpecification instead of SeriesSpecification.

I don't quite understand the differences between these two approaches and when to use one or another.  Could you give me an overview or point some documentation, please?

Thanks in advance,
Franklin Samir Dattein



On Thu, Oct 22, 2009 at 7:58 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, I am somewhat puzzled by your code.
It seems to me that Henry's problem was quite different (and he did not post his code, btw).

Yes, MainBacktest, etc classes are familiar. I believe they were submitted by CriC as an example for some bug research.

Yet your code is VERY different. I see that you extend MarketTradeSystemBase, use @Optimize annotations, etc. And apparently expect something to happen in "onMarket" method. Shortly, I do not believe your code has anything to do with aq examples or CriC's sample. Therefore, its incorrect to suggest that aq has a bug. Most likely there is a problem in your code. I suggest starting from existing example (with possible minor changes) and move step-by-step toward the functionality that you need. This way I and others on the list will have a chance to be more helpful.

Regards,

-Mike


On Thu, Oct 22, 2009 at 11:50 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,

the exception is the one in the beggining of this email thread:

Exception in thread "main" java.lang.AssertionError: input dates are
out-of-order at org.activequant.util.tools.UniqueDateGenerator.generate(UnknownSource)

I could not found the example on Nabble and I don't remember if the author was you. I still have the code here, it is composed by 4 classes:
MainBacktest
TradeSystemConfig
TradeSystemLogic
YahooBacktestContextConfig.

Do you recognize it?

Thanks,
Franklin Samir Dattein



On Thu, Oct 22, 2009 at 11:09 AM, Mike Kroutikov <pgmmpk@...> wrote:
What is the exception stack? 

Can you also add a link to the "Mike's sample posted here in the mailing list"?

-Mike


On Wed, Oct 21, 2009 at 10:14 AM, Franklin S. Dattein <franklin@...> wrote:
Follow the example.

It is based in one of Mike's sample posted here in the mailing list.
I have changed that example to be configured by XML instead of Java and added two stock symbols instead of only one.

Thanks
Franklin Samir Dattein



On Wed, Oct 21, 2009 at 11:58 AM, Mike Kroutikov <pgmmpk@...> wrote:
yes, sources would help


On Wed, Oct 21, 2009 at 8:57 AM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
Yes, I am putting both series in an ArrayList. That is the code that is causing the exception:

    <bean id="specs" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean id="series1" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="LAME4.SA" />
                      ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
                <bean id="series2" class="org.activequant.core.domainmodel.SeriesSpecification">
                    <constructor-arg>
                        <bean class="org.activequant.core.domainmodel.InstrumentSpecification">
                            <property name="symbol" value="PETR4.SA" />
                   ...
                        </bean>   
                    </constructor-arg>
                    <constructor-arg value="1d"/>
                </bean>
            </list>
        </constructor-arg>
    </bean>
##################

After removing one of the SeriesSpecification above, the system works fine.
The data source is YahooCandleSeriesSource.
Could it be caused by an error in the data that comes from Yahoo?

I can zip the system if you think it would help.

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 7:52 PM, Mike Kroutikov <pgmmpk@...> wrote:
Hmm, that is the whole point of the backtester - to cross-sort data coming from different streams (each stream is assumed sorted). I am pretty sure backtester works correctly. This leaves us with the only one possibility - your data is bad. This kind of exception means that one of the streams is not sorted. Are you putting both series in one ArrayList? 

-Mike

On Tue, Oct 20, 2009 at 3:41 PM, Franklin S. Dattein <franklin@...> wrote:
Hi Mike,
I am running a back test with two SeriesSpecification. My code is based on the DualMovingAverageSystem example.

If the ArrayList contains only one SeriesSpecification there is no trouble. It only happens when I have more than one SeriesSpecification.

By reading the past mail thread I couldn't understand if that is expected. Is that the expected behavior or a bug?

Thanks,
Franklin Samir Dattein



On Tue, Oct 20, 2009 at 5:33 PM, Mike Kroutikov <pgmmpk@...> wrote:
Franklin, what exactly are you doing? Backtester will refuse to merge data streams if any stream has out-of-order items (check your data). If you are trying to re-start the same backtester instance, it also won't work as you have to discard and re-create it after each run....

-Mike


On Tue, Oct 20, 2009 at 2:31 PM, Franklin Dattein <franklin@...> wrote:

I am also facing this error. Since this message is from 2008, I think it has
been already fixed and I am doing something wrong.

Thoughts?

Thanks,
Franklin Dattein


H. Canterburry wrote:
>
> I am running some back tests right now that loop optimization code. It
> seems like I cannot complete a single pass without the following
> exception:
>
> I am streaming everything from a database.
>
> Exception in thread "main" java.lang.AssertionError: input dates are
> out-of-order
>     at org.activequant.util.tools.UniqueDateGenerator.generate(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.fireExecution(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.checkOrder(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker.access$300(Unknown Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)
>     at
> org.activequant.broker.PaperBroker$OrderTracker$1.eventFired(Unknown
> Source)2008-03-05 15:55:22,906 [main] INFO
> [org.activequant.data.util.converter.CandleToTradeIndicationConverter] -
> one candle  D : 943070400000000000 O : 42.94 H : 43.0 L : 39.81 C :
> 40.38 V : 1.08971E7 generated 61 trade indications
>
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.access$200(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription.access$100(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at
> org.activequant.data.util.converter.CandleToTradeIndicationConverter$CandleSubscription$1.eventFired(Unknown
> Source)
>     at org.activequant.util.pattern.events.Event.fire(Unknown Source)
>     at
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(Unknown
> Source)
>     at org.activequant.data.util.ReplayServiceBase.fire(Unknown Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
>     at org.activequant.data.util.MarketDataReplayService.fire(Unknown
> Source)
> ...
>
> _______________________________________________
> ccapi mailing list
> ccapi@...
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>
>
> -----
> -HC
>

--
View this message in context: http://www.nabble.com/input-dates-are-out-of-order-Exception-tp15861447p25980196.html
Sent from the ActiveQuant mailing list archive at Nabble.com.

_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi


_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi



_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi