Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

NullPointerException when submitting orders
 Post subject: NullPointerException when submitting orders Post rating: 0   New post Posted: Fri 07 Aug, 2009, 04:36 

User rating: 0
Joined: Thu 06 Aug, 2009, 19:46
Posts: 4
Hi everyone!

I have the following piece of code being called inside onTick()

this.engine.submitOrder("gGBPUSD", Instrument.fromString("GBPUSD"), IEngine.OrderCommand.BUY, 0.1, 0);


and it generated the following NullPointerException

java.lang.NullPointerException
   at com.dukascopy.dds2.greed.agent.A.submitOrder(Unknown Source)
   at com.dukascopy.dds2.greed.agent.A.submitOrder(Unknown Source)
   at com.dukascopy.dds2.greed.agent.A.submitOrder(Unknown Source)
   at com.dukascopy.dds2.greed.agent.A.submitOrder(Unknown Source)
   at com.dukascopy.dds2.greed.agent.A.submitOrder(Unknown Source)
   at jforex.ChakraaMain.onTick(ChakraaMain.java:116)
   at com.dukascopy.api.impl.a.l.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


I have checked that the engine object is not null because I can successfully call other methods on it like getAccount() etc. Any idea what could be causing this problem? Just FYI, this error started occurring at around 11:30 PM EST. Are we not allowed to place trades after a certain time of the day? I thought we could place trades 24 hours. I'm really clueless about this.

Any help would be most appreciated! Thanks!


 
 Post subject: Re: NullPointerException when submitting orders Post rating: 0   New post Posted: Fri 07 Aug, 2009, 21:24 

User rating: 0
Joined: Thu 06 Aug, 2009, 19:46
Posts: 4
I found the simple mistake I was making when submitting the order. I was missing a slash from Instrument.fromString("GBPUSD"). That was supposed to be Instrument.fromString("GBP/USD").


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com