got NPE while placing orders (backtest with CSV)

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

got NPE while placing orders (backtest with CSV)

by CriC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Can't get over this error.
I get the NPE when I try to place an order with the CSV backtest context.
maybe something wrong in the context file ?

Please see code attached.

If you comment the place order lines, it works correctly streaming candles from CSV file.

Any tip?
thank you
CriC

csvTS.zip

Re: got NPE while placing orders (backtest with CSV)

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CriC, what is the exception stack?

-Mike

On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@...> wrote:


Can't get over this error.
I get the NPE when I try to place an order with the CSV backtest context.
maybe something wrong in the context file ?

Please see code attached.

If you comment the place order lines, it works correctly streaming candles
from CSV file.

Any tip?
thank you
CriC

http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip

--
View this message in context: http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.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: got NPE while placing orders (backtest with CSV)

by CriC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hope this helps.

1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91 java.lang.RuntimeException: java.lang.NullPointerException
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
        at org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
        at org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
        at org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
        at org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
Caused by: java.lang.NullPointerException
        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
        ... 5 more
java.lang.RuntimeException: java.lang.NullPointerException



Mike Kroutikov-2 wrote:
CriC, what is the exception stack?

-Mike

On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@gmx.com> wrote:

>
>
> Can't get over this error.
> I get the NPE when I try to place an order with the CSV backtest context.
> maybe something wrong in the context file ?
>
> Please see code attached.
>
> If you comment the place order lines, it works correctly streaming candles
> from CSV file.
>
> Any tip?
> thank you
> CriC
>
> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
>
> --
> View this message in context:
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.html
> Sent from the ActiveQuant mailing list archive at Nabble.com.
>
> _______________________________________________
> ccapi mailing list
> ccapi@activestocks.de
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>

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

Re: got NPE while placing orders (backtest with CSV)

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The NPE is thrown from line 141 of TradeSystemLogic.java. It is the line saying:

// EXECUTE
position = positionService.openPosition(order);

which makes me think that positionService was not injected. Did u miss @Inject annotation?

-Mike


       at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)

On Wed, Nov 4, 2009 at 10:23 AM, CriC <cristina.colonna@...> wrote:


Hope this helps.

1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91
java.lang.RuntimeException: java.lang.NullPointerException
       at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
       at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
       at
org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
       at
org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
       at
org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
       at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
Caused by: java.lang.NullPointerException
       at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
       at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
       at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
       at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
       at org.activequant.util.pattern.events.Event.fire(Event.java:43)
       at
org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
       ... 5 more
java.lang.RuntimeException: java.lang.NullPointerException




Mike Kroutikov-2 wrote:
>
> CriC, what is the exception stack?
>
> -Mike
>
> On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@...> wrote:
>
>>
>>
>> Can't get over this error.
>> I get the NPE when I try to place an order with the CSV backtest context.
>> maybe something wrong in the context file ?
>>
>> Please see code attached.
>>
>> If you comment the place order lines, it works correctly streaming
>> candles
>> from CSV file.
>>
>> Any tip?
>> thank you
>> CriC
>>
>> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
>>
>> --
>> View this message in context:
>> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.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
>
>

--
View this message in context: http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26198154.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: got NPE while placing orders (backtest with CSV)

by CriC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Mike,

Mmmm yes I don't use @Inject BUT I set the positionService in the TradeSystemConfig.java :

        @Bean
        protected IPositionService positionService() {
                SimplePositionService positionService = new SimplePositionService(broker());
                positionService.setTrailingDistance(99.0);
                ....
                return positionService;
        }
       
       
        @Bean
        public Object system() {
                               
                TradeSystemLogic ts = new TradeSystemLogic();
                ....
                ts.setPositionService(positionService());
                ....
               
                return ts;
        }


NOTE that with the YahooContext works perfectly fine!
I just changed the Context, from Yahoo to CSV, that's why I think the Context is wrong...
Am I missing something?




Mike Kroutikov-2 wrote:
The NPE is thrown from line 141 of TradeSystemLogic.java. It is the line
saying:

// EXECUTE
position = positionService.openPosition(order);

which makes me think that positionService was not injected. Did u miss
@Inject annotation?

-Mike


       at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)

On Wed, Nov 4, 2009 at 10:23 AM, CriC <cristina.colonna@gmx.com> wrote:

>
>
> Hope this helps.
>
> 1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91
> java.lang.RuntimeException: java.lang.NullPointerException
>        at
>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
>        at
>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
>        at
>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
>        at
>
> org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
>        at
>
> org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
>        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
> Caused by: java.lang.NullPointerException
>        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
>        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
>        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
>        at
>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
>        ... 5 more
> java.lang.RuntimeException: java.lang.NullPointerException
>
>
>
>
> Mike Kroutikov-2 wrote:
> >
> > CriC, what is the exception stack?
> >
> > -Mike
> >
> > On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@gmx.com> wrote:
> >
> >>
> >>
> >> Can't get over this error.
> >> I get the NPE when I try to place an order with the CSV backtest
> context.
> >> maybe something wrong in the context file ?
> >>
> >> Please see code attached.
> >>
> >> If you comment the place order lines, it works correctly streaming
> >> candles
> >> from CSV file.
> >>
> >> Any tip?
> >> thank you
> >> CriC
> >>
> >> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.html
> >> Sent from the ActiveQuant mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> ccapi mailing list
> >> ccapi@activestocks.de
> >> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >>
> >
> > _______________________________________________
> > ccapi mailing list
> > ccapi@activestocks.de
> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26198154.html
> Sent from the ActiveQuant mailing list archive at Nabble.com.
>
> _______________________________________________
> ccapi mailing list
> ccapi@activestocks.de
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>

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

Re: got NPE while placing orders (backtest with CSV)

by Mike Kroutikov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In your ZIP file TradeSystemConfig.java does not have ts.setPositionService() call (or I can not find it in the hurry). Where from your quote below comes?

On Wed, Nov 4, 2009 at 4:14 PM, CriC <cristina.colonna@...> wrote:

Hello Mike,

Mmmm yes I don't use @Inject BUT I set the positionService in the
TradeSystemConfig.java :

       @Bean
       protected IPositionService positionService() {
               SimplePositionService positionService = new
SimplePositionService(broker());
               positionService.setTrailingDistance(99.0);
               ....
               return positionService;
       }


       @Bean
       public Object system() {

               TradeSystemLogic ts = new TradeSystemLogic();
               ....
               ts.setPositionService(positionService());
               ....

               return ts;
       }


NOTE that with the YahooContext works perfectly fine!
I just changed the Context, from Yahoo to CSV, that's why I think the
Context is wrong...
Am I missing something?





Mike Kroutikov-2 wrote:
>
> The NPE is thrown from line 141 of TradeSystemLogic.java. It is the line
> saying:
>
> // EXECUTE
> position = positionService.openPosition(order);
>
> which makes me think that positionService was not injected. Did u miss
> @Inject annotation?
>
> -Mike
>
>
>        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
>
> On Wed, Nov 4, 2009 at 10:23 AM, CriC <cristina.colonna@...> wrote:
>
>>
>>
>> Hope this helps.
>>
>> 1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91
>> java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>>
>> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
>>        at
>>
>> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
>>        at
>>
>> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
>>        at
>>
>> org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
>>        at
>>
>> org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
>>        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
>> Caused by: java.lang.NullPointerException
>>        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
>>        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
>>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
>>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
>>        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
>>        at
>>
>> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
>>        ... 5 more
>> java.lang.RuntimeException: java.lang.NullPointerException
>>
>>
>>
>>
>> Mike Kroutikov-2 wrote:
>> >
>> > CriC, what is the exception stack?
>> >
>> > -Mike
>> >
>> > On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@...> wrote:
>> >
>> >>
>> >>
>> >> Can't get over this error.
>> >> I get the NPE when I try to place an order with the CSV backtest
>> context.
>> >> maybe something wrong in the context file ?
>> >>
>> >> Please see code attached.
>> >>
>> >> If you comment the place order lines, it works correctly streaming
>> >> candles
>> >> from CSV file.
>> >>
>> >> Any tip?
>> >> thank you
>> >> CriC
>> >>
>> >> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.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
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26198154.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
>
>

--
View this message in context: http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26204726.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: got NPE while placing orders (backtest with CSV)

by CriC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Right, I messed up! I'll check it tomorrow morning and post here results.
Sorry :-/


Mike Kroutikov-2 wrote:
In your ZIP file TradeSystemConfig.java does not have
ts.setPositionService() call (or I can not find it in the hurry). Where from
your quote below comes?

On Wed, Nov 4, 2009 at 4:14 PM, CriC <cristina.colonna@gmx.com> wrote:

>
> Hello Mike,
>
> Mmmm yes I don't use @Inject BUT I set the positionService in the
> TradeSystemConfig.java :
>
>        @Bean
>        protected IPositionService positionService() {
>                SimplePositionService positionService = new
> SimplePositionService(broker());
>                positionService.setTrailingDistance(99.0);
>                ....
>                return positionService;
>        }
>
>
>        @Bean
>        public Object system() {
>
>                TradeSystemLogic ts = new TradeSystemLogic();
>                ....
>                ts.setPositionService(positionService());
>                ....
>
>                return ts;
>        }
>
>
> NOTE that with the YahooContext works perfectly fine!
> I just changed the Context, from Yahoo to CSV, that's why I think the
> Context is wrong...
> Am I missing something?
>
>
>
>
>
> Mike Kroutikov-2 wrote:
> >
> > The NPE is thrown from line 141 of TradeSystemLogic.java. It is the line
> > saying:
> >
> > // EXECUTE
> > position = positionService.openPosition(order);
> >
> > which makes me think that positionService was not injected. Did u miss
> > @Inject annotation?
> >
> > -Mike
> >
> >
> >        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
> >
> > On Wed, Nov 4, 2009 at 10:23 AM, CriC <cristina.colonna@gmx.com> wrote:
> >
> >>
> >>
> >> Hope this helps.
> >>
> >> 1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91
> >> java.lang.RuntimeException: java.lang.NullPointerException
> >>        at
> >>
> >>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
> >>        at
> >>
> >>
> org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
> >>        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
> >> Caused by: java.lang.NullPointerException
> >>        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
> >>        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
> >>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
> >>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
> >>        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
> >>        at
> >>
> >>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
> >>        ... 5 more
> >> java.lang.RuntimeException: java.lang.NullPointerException
> >>
> >>
> >>
> >>
> >> Mike Kroutikov-2 wrote:
> >> >
> >> > CriC, what is the exception stack?
> >> >
> >> > -Mike
> >> >
> >> > On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@gmx.com>
> wrote:
> >> >
> >> >>
> >> >>
> >> >> Can't get over this error.
> >> >> I get the NPE when I try to place an order with the CSV backtest
> >> context.
> >> >> maybe something wrong in the context file ?
> >> >>
> >> >> Please see code attached.
> >> >>
> >> >> If you comment the place order lines, it works correctly streaming
> >> >> candles
> >> >> from CSV file.
> >> >>
> >> >> Any tip?
> >> >> thank you
> >> >> CriC
> >> >>
> >> >> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.html
> >> >> Sent from the ActiveQuant mailing list archive at Nabble.com.
> >> >>
> >> >> _______________________________________________
> >> >> ccapi mailing list
> >> >> ccapi@activestocks.de
> >> >> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >> >>
> >> >
> >> > _______________________________________________
> >> > ccapi mailing list
> >> > ccapi@activestocks.de
> >> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26198154.html
> >> Sent from the ActiveQuant mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> ccapi mailing list
> >> ccapi@activestocks.de
> >> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >>
> >
> > _______________________________________________
> > ccapi mailing list
> > ccapi@activestocks.de
> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26204726.html
> Sent from the ActiveQuant mailing list archive at Nabble.com.
>
> _______________________________________________
> ccapi mailing list
> ccapi@activestocks.de
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>

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

Re: got NPE while placing orders (backtest with CSV)

by CriC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Still got the NPE  ( I have added the ts.setPositionService() ) which I forgot in he attached code, but:

2009-11-05 14:37:49,671 [main] INFO [ts.TradeSystemLogic] - subscribed for candles: DLR SMART USD FUTURE
java.lang.NullPointerException
        at org.activequant.data.util.ReplayServiceBase.fetchSeries(ReplayServiceBase.java:189)
        at org.activequant.data.util.ReplayServiceBase.addEventSink(ReplayServiceBase.java:67)
        at org.activequant.data.util.ReplayServiceBase.access$000(ReplayServiceBase.java:53)
        at org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.handleActivate(ReplayServiceBase.java:82)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.activate(SubscriptionSourceBase.java:357)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.access$200(SubscriptionSourceBase.java:324)
        at org.activequant.data.retrieval.SubscriptionSourceBase$1.activate(SubscriptionSourceBase.java:259)
        at org.activequant.data.util.converter.TradeIndicationToQuoteSubscriptionSourceConverter$QuoteSubscription.handleActivate(TradeIndicationToQuoteSubscriptionSourceConverter.java:89)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.activate(SubscriptionSourceBase.java:357)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.access$200(SubscriptionSourceBase.java:324)
        at org.activequant.data.retrieval.SubscriptionSourceBase$1.activate(SubscriptionSourceBase.java:259)
        at org.activequant.broker.PaperBroker$OrderTracker.handleSubmit(PaperBroker.java:152)
        at org.activequant.broker.BrokerBase$OrderTrackerBase.submit(BrokerBase.java:159)
        at org.activequant.broker.AccountManagingBrokerProxy$OrderTrackerProxy.submit(AccountManagingBrokerProxy.java:93)
        at org.activequant.examples.tradesystem.advanced.SimplePositionService$Tracker.<init>(SimplePositionService.java:156)
        at org.activequant.examples.tradesystem.advanced.SimplePositionService.openPosition(SimplePositionService.java:182)
        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
        at org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
        at org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
        at org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
        at org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
        at org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
2009-11-05 14:37:49,702 [main] ERROR [org.activequant.data.util.MarketDataReplayService$3] - java.lang.NullPointerException




Mike Kroutikov-2 wrote:
In your ZIP file TradeSystemConfig.java does not have
ts.setPositionService() call (or I can not find it in the hurry). Where from
your quote below comes?

On Wed, Nov 4, 2009 at 4:14 PM, CriC <cristina.colonna@gmx.com> wrote:

>
> Hello Mike,
>
> Mmmm yes I don't use @Inject BUT I set the positionService in the
> TradeSystemConfig.java :
>
>        @Bean
>        protected IPositionService positionService() {
>                SimplePositionService positionService = new
> SimplePositionService(broker());
>                positionService.setTrailingDistance(99.0);
>                ....
>                return positionService;
>        }
>
>
>        @Bean
>        public Object system() {
>
>                TradeSystemLogic ts = new TradeSystemLogic();
>                ....
>                ts.setPositionService(positionService());
>                ....
>
>                return ts;
>        }
>
>
> NOTE that with the YahooContext works perfectly fine!
> I just changed the Context, from Yahoo to CSV, that's why I think the
> Context is wrong...
> Am I missing something?
>
>
>
>
>
> Mike Kroutikov-2 wrote:
> >
> > The NPE is thrown from line 141 of TradeSystemLogic.java. It is the line
> > saying:
> >
> > // EXECUTE
> > position = positionService.openPosition(order);
> >
> > which makes me think that positionService was not injected. Did u miss
> > @Inject annotation?
> >
> > -Mike
> >
> >
> >        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
> >
> > On Wed, Nov 4, 2009 at 10:23 AM, CriC <cristina.colonna@gmx.com> wrote:
> >
> >>
> >>
> >> Hope this helps.
> >>
> >> 1919.0 : 2009/01/05   D : 1231159500000000000 O : 30.91
> >> java.lang.RuntimeException: java.lang.NullPointerException
> >>        at
> >>
> >>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:402)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:91)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase$DispatchingSubscription.fire(ReplayServiceBase.java:73)
> >>        at
> >>
> >>
> org.activequant.data.util.ReplayServiceBase.fire(ReplayServiceBase.java:108)
> >>        at
> >>
> >>
> org.activequant.data.util.MarketDataReplayService.fire(MarketDataReplayService.java:276)
> >>        at ts.MainBacktestCSV.main(MainBacktestCSV.java:45)
> >> Caused by: java.lang.NullPointerException
> >>        at ts.TradeSystemLogic.onCandle(TradeSystemLogic.java:141)
> >>        at ts.TradeSystemLogic.access$0(TradeSystemLogic.java:119)
> >>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:93)
> >>        at ts.TradeSystemLogic$1.eventFired(TradeSystemLogic.java:1)
> >>        at org.activequant.util.pattern.events.Event.fire(Event.java:43)
> >>        at
> >>
> >>
> org.activequant.data.retrieval.SubscriptionSourceBase$Subscription.fireEvent(SubscriptionSourceBase.java:399)
> >>        ... 5 more
> >> java.lang.RuntimeException: java.lang.NullPointerException
> >>
> >>
> >>
> >>
> >> Mike Kroutikov-2 wrote:
> >> >
> >> > CriC, what is the exception stack?
> >> >
> >> > -Mike
> >> >
> >> > On Tue, Nov 3, 2009 at 7:47 AM, CriC <cristina.colonna@gmx.com>
> wrote:
> >> >
> >> >>
> >> >>
> >> >> Can't get over this error.
> >> >> I get the NPE when I try to place an order with the CSV backtest
> >> context.
> >> >> maybe something wrong in the context file ?
> >> >>
> >> >> Please see code attached.
> >> >>
> >> >> If you comment the place order lines, it works correctly streaming
> >> >> candles
> >> >> from CSV file.
> >> >>
> >> >> Any tip?
> >> >> thank you
> >> >> CriC
> >> >>
> >> >> http://old.nabble.com/file/p26160075/csvTS.zip csvTS.zip
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26160075.html
> >> >> Sent from the ActiveQuant mailing list archive at Nabble.com.
> >> >>
> >> >> _______________________________________________
> >> >> ccapi mailing list
> >> >> ccapi@activestocks.de
> >> >> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >> >>
> >> >
> >> > _______________________________________________
> >> > ccapi mailing list
> >> > ccapi@activestocks.de
> >> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26198154.html
> >> Sent from the ActiveQuant mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> ccapi mailing list
> >> ccapi@activestocks.de
> >> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >>
> >
> > _______________________________________________
> > ccapi mailing list
> > ccapi@activestocks.de
> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/got-NPE-while-placing-orders-%28backtest-with-CSV%29-tp26160075p26204726.html
> Sent from the ActiveQuant mailing list archive at Nabble.com.
>
> _______________________________________________
> ccapi mailing list
> ccapi@activestocks.de
> http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
>

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