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.

Cannot submit order from a JButton
 Post subject: Cannot submit order from a JButton Post rating: 0   New post Posted: Sun 19 Jul, 2015, 14:33 
User avatar

User rating: 0
Joined: Sat 02 Mar, 2013, 09:43
Posts: 12
Location: Canada, Vancouver
Ive programmed an order taking interface.
Ive tested a market order from onBar and onTick with the following code.

myEngine.submitOrder("myTrade", myInstrument, IEngine.OrderCommand.BUY, lotValue*0.001, 0);

Works fine.

Im calling the method buyMarket() with an ActionListener on a jButton.

public void buyMarket(){
debug("test");
}

This works fine, the method is being called on click of the button, and prints my debug message.

Now if I change the buyMarket() method to include a market order.

public void buyMarket(){
myEngine.submitOrder("myTrade", myInstrument, IEngine.OrderCommand.BUY, lotValue*0.001, 0);
}

I get an unhandled Exception. No real error message per se, just unhandled exception.
What gives???

:?


 
 Post subject: Re: Cannot submit order from a JButton Post rating: 0   New post Posted: Tue 21 Jul, 2015, 10:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
trading operations must be called in a special thread as described here:
https://www.dukascopy.com/wiki/#Threading


 

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