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.

get Console messages
 Post subject: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 00:35 

User rating: 0
Joined: Wed 17 Dec, 2008, 11:19
Posts: 29
Hi,

How to get new messages displayed in Console?

We know write them (Console.getOut) but how to read/get them when they are written by Engine or Strategy?

Thanks


 
 Post subject: Re: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 09:13 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
there isn't such functionality. In fact it's bad idea, because its just String message. Console only visualizes for user some event's that had been accrued and can't be noted other way.
Its better to get those actions from objects that gives such info. For example, if you want to know when order is submitted to the server, consider this example
public void onMessage(IMessage message) throws JFException {       
       if (message.getType().equals(IMessage.Type.ORDER_SUBMIT_OK)){          
          //do something...          
       }
    }

Let us know what exactly you would like to do, so we could give you more specific advise


 
 Post subject: Re: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 14:36 

User rating: 0
Joined: Wed 17 Dec, 2008, 11:19
Posts: 29
Thanks for your reply,

I'm yet using onMessage to follow order execution.

My problem is to log (ie write to a file) com.dukascopy.api.JFException. Do you have a code example for it?


 
 Post subject: Re: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 15:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Put your business logic in try catch block for all implemented IStartegy methods (onStart, onAccount, onMessage, onStop, onTick, onBar).
Consider this example:
       try{          
          //your business logic goes here   .  .  .          
       }catch (JFException e){
          
          // do some additional logging   .  .  .

          //its important to throw this exception forward
         throw new JFException(e);
       }

Here is example off storing info locally:https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=7&t=913


 
 Post subject: Re: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 16:24 

User rating: 0
Joined: Wed 17 Dec, 2008, 11:19
Posts: 29
ok, so in place of:

onStart() throws JFException {
blabla..
}

we should have 1):

onStart() {
try{
blabla..
}catch (JFException e){
logging..
throw new JFException(e);
}
}

or 2):

onStart() throws JFException {
try{
blabla..
}catch (JFException e){
logging..
throw new JFException(e);
}
}

1) or 2) is right ?


 
 Post subject: Re: get Console messages Post rating: 0   New post Posted: Thu 29 Oct, 2009, 16:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
2 :)


 

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