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.

label not unique
 Post subject: label not unique Post rating: 0   New post Posted: Tue 15 Dec, 2009, 15:09 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:13
Posts: 3
on creation of an order I am getting the following order in the console
15.12.2009 16:02:22.653   SEVERE                    execution.m ] Label not unique. (Order already exists)
com.dukascopy.api.JFException: Label not unique. (Order already exists)
   at com.dukascopy.api.impl.connect.m.a(Unknown Source)
   at com.dukascopy.api.impl.execution.b.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.k$a.a(Unknown Source)
   at com.dukascopy.api.impl.execution.k$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

my label is specifically unique containing references to the strategy name, the instrument and the time.

I can't be sure this happens that order creation but that is my best guess.

Is it possible that this happens because the label is too long, is there a limit to the size of the label?


 
 Post subject: Re: label not unique Post rating: 0   New post Posted: Wed 16 Dec, 2009, 14:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Quote:
Is it possible that this happens because the label is too long?
no
Quote:
is there a limit to the size of the label?
yes, 64 symbols.
There is such restriction for order labels:
  • Label must not be null;
  • Label must not be longer than 64 symbols;
  • Label must contain restricted symbols;
  • Label must not start with number.
Exception is thrown because an order with your given label already exists on the server. To avoid such exceptions, always before place an order, check if there isn't already placed such. Consider this example:
    public void onStart(IContext context) throws JFException {
       if (context.getEngine().getOrder("MyOrder") == null){
         context.getEngine().submitOrder("MyOrder", Instrument.EURUSD, OrderCommand.BUY, 0.5);
       }
If you are submitting order in onTick function, then to get an unique label, you must add some randomize number. Its because in one second could be lot of ticks. Here is link with example https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=7&t=914


 
 Post subject: Re: label not unique Post rating: 0   New post Posted: Thu 17 Dec, 2009, 12:54 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:13
Posts: 3
I tried this. Checking if there was an existing trade and it still says label not unique in my java console, while opening the trade no problem.


 
 Post subject: Re: label not unique Post rating: 0   New post Posted: Wed 23 Dec, 2009, 09:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Does the problem reproduce itself every time?
Add an output of order's label every time you are trying to create it, and look in the console if the label is really not unique


 
 Post subject: Re: label not unique Post rating: 0   New post Posted: Mon 01 Nov, 2010, 01:52 

User rating: 0
Joined: Mon 27 Sep, 2010, 14:41
Posts: 6
Hi Support,

What are the "restricted symbols" ?

Thanks in advance.


 
 Post subject: Re: label not unique Post rating: 0   New post Posted: Mon 01 Nov, 2010, 10:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
it's easier to say what is no restricted. For a strategy label, you could use any Latin capital or non-capital letter or this char "_".


 

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