Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3240 Method getLabel() does not work in history orders
 Post subject: JFOREX-3240 Method getLabel() does not work in history orders Post rating: 0   New post Posted: Tue 27 Sep, 2011, 23:54 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
getLabel() in Interface IOrder returns null if it is called from an IOrder object of getOrdersHistory(...) in Interface IHistory.
Please correct this.

Dukascopy ver. 2.13.30
JForex API ver. 2.6.38


See an example here

/*     
 * This is a test program only, do not use for trading!
 * It shows that getLabel() of an IOrder object returns null, if called from a IHistory List
 *
 *     Stash GmbH Muenchen
 *     www.stash.de
 *     Author: Bernhard Schicht
 */
 
 package jforex;

import java.util.*;

import com.dukascopy.api.*;

public class StrategyTest2 implements IStrategy {
   private IEngine engine;
   private IConsole console;
   private IHistory history;
   private IContext context;
   private IIndicators indicators;
   private IUserInterface userInterface;
   
   public void onStart(IContext context) throws JFException {
      this.engine = context.getEngine();
      this.console = context.getConsole();
      this.history = context.getHistory();
      this.context = context;
      this.indicators = context.getIndicators();
      this.userInterface = context.getUserInterface();
   }

   public void onAccount(IAccount account) throws JFException {
       for (Instrument instr : context.getSubscribedInstruments() ) {
            p("checking instrument: "+instr.toString());
            IHistory history = context.getHistory();

            // console.getOut().println(cal.getTime().toString());
            List<IOrder> historyOrders = null;
            while (true){
                try{
                    // from = 30 days back
                    historyOrders = history.getOrdersHistory(instr , System.currentTimeMillis()-30*24*60*60*1000, System.currentTimeMillis());
                }
                catch (Exception e) {
                    try{ Thread.sleep(2*1000); }      catch (Exception e2) { e2.printStackTrace(console.getErr()); }
                    continue;
                }               
                break;
            }
            for (IOrder order : historyOrders) {
                p("label = "+order.getLabel()+", id = "+order.getId());   
            }
         }
   }

   public void onMessage(IMessage message) throws JFException {
   }

   public void onStop() throws JFException {
   }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
    public void p(String text){
        console.getOut().println(text);
    }

}


 
 Post subject: Re: JFOREX-3240 Method getLabel() does not work in history o Post rating: 0   New post Posted: Fri 23 Dec, 2011, 13:25 

User rating: 0
Joined: Fri 23 Dec, 2011, 12:30
Posts: 1
Location: ES
Hello,
I'd like to know, there are any news related to this problem?


 
 Post subject: Re: JFOREX-3240 Method getLabel() does not work in history o Post rating: 0   New post Posted: Wed 28 Dec, 2011, 11:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is still in developing.


 
 Post subject: Re: JFOREX-3240 Method getLabel() does not work in history orders Post rating: 0   New post Posted: Wed 25 Apr, 2012, 15:42 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Are there any news regarding this implentation? It doesn't seem hard to develop.

regards,
Kurak


 
 Post subject: Re: JFOREX-3240 Method getLabel() does not work in history orders Post rating: 0   New post Posted: Wed 25 Apr, 2012, 16:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is already implemented.


 
 Post subject: Re: JFOREX-3240 Method getLabel() does not work in history orders Post rating: 0   New post Posted: Wed 25 Apr, 2012, 16:19 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
That is great news, thank you very much. I must have missed the information.

kind regards,
Grzegorz


 

Jump to:  

cron
  © 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