Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

getOriginalAmount() returns incorrect amount
 Post subject: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Fri 15 Apr, 2016, 20:44 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
Hello, Support Team.

Sometimes getOriginalAmount() returns incorrect amount of the order.
For example, for my order 62836911 getOriginalAmount() returns 0.05, but it must return 0.025.

Please fix this bug.


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Mon 18 Apr, 2016, 09:02 
User avatar

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

Were unable to reproduce your problem correctly. Please provide your strategy, that can reproduce issue.

Thank you

Good luck and have a nice day!


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Mon 18 Apr, 2016, 09:35 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
Enter id 62836911. Original amount fot this order must be 0.025, but getOriginalAmount() returns 0.05.

package jforex;

import java.util.*;

import com.dukascopy.api.*;

public class Amount implements IStrategy {
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
   
    @Configurable("id")
    public String id="";
   
    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();
       
        IOrder order=history.getHistoricalOrderById(id);
        console.getOut().println("Original amount for order "+id+": "+order.getOriginalAmount());
       
        context.stop();
    }

    public void onAccount(IAccount account) throws JFException {
    }

    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 {
    }
}


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Tue 19 Apr, 2016, 06:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please give example of how the order is created.


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Tue 19 Apr, 2016, 10:39 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
This is my function.

private String Order(double lot, double price, double slippage, double stoploss, double takeprofit, String comment, String number) throws JFException
     {     
      String id=null;

if(Math.abs(lot)<0.001)                                                         
      console.getOut().println(LABEL+" {"+TIME+"}: Lot is too small for Order"+number+"!!!");
                                     
      else
        {
         ITick tick=history.getLastTick(INSTRUMENT);
         OrderCommand command=null;     
             
         if(lot>0)
           {
            if(tick.getAsk()>=price)             
            command=OrderCommand.BUYLIMIT;
                                             
            else
            command=OrderCommand.BUYSTOP;                         
           }
   
         if(lot<0)
           {
            if(tick.getBid()<=price)             
            command=OrderCommand.SELLLIMIT;
                                           
            else               
            command=OrderCommand.SELLSTOP;                           
           }
   
         IOrder order=engine.submitOrder(LABEL+"_"+number,INSTRUMENT,command,Math.abs(lot),price,slippage,stoploss,takeprofit,0,comment);                     
         order.waitForUpdate(OPENED);               
                             
         while(id==null) id=order.getId();                                                                                                         
        }
     
      return id; 
     }


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Tue 19 Apr, 2016, 10:42 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
Slippage for my orders always is set to 0.


 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Mon 25 Apr, 2016, 11:27 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please run the attached strategy, getOriginalAmount() should returns correct value.


Attachments:
Strategy.java [4.02 KiB]
Downloaded 143 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: getOriginalAmount() returns incorrect amount Post rating: 0   New post Posted: Mon 25 Apr, 2016, 11:56 
User avatar

User rating: 0
Joined: Wed 05 Mar, 2014, 17:24
Posts: 30
Location: Russian Federation, Tomsk
This is not what I need.

I have not any information about my closed orders except id.
Why for my order 62836911 and some other orders getOriginalAmount() returns double amount?
This is bug or not?


 

Jump to:  

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