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.

Market Depth
 Post subject: Market Depth Post rating: 0   New post Posted: Wed 01 Aug, 2012, 20:27 

User rating: 0
Joined: Mon 25 Jun, 2012, 15:55
Posts: 13
Dear Support,


is it possible to get the content of the Market Depth Window in JForex(10 ask and 10 bid components)
to provide Ask and Bid Volume for a specific price to program a strategy in JForex? (see Screenshot)


thank you
jIMMY


Attachments:
Screenshot25.jpg [32.63 KiB]
Downloaded 382 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: Market Depth Post rating: 0   New post Posted: Thu 02 Aug, 2012, 07:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You can do it the following way:
package jforex.data;

import java.util.Arrays;

import com.dukascopy.api.*;

public class TickDepth implements IStrategy {

   @Configurable("")
   public Instrument instrument = Instrument.EURUSD;
   
    private IConsole console;
    @Override
    public void onStart(IContext context) throws JFException {
        console = context.getConsole();
    }

    @Override
    public void onTick(Instrument instrument, ITick tick) throws JFException {
       if(instrument == this.instrument){
          console.getOut().println(instrument + " best bids: "+ Arrays.toString(tick.getBids()));
       }
    }

    @Override
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}

    @Override
    public void onMessage(IMessage message) throws JFException {}

    @Override
    public void onAccount(IAccount account) throws JFException {}

    @Override
    public void onStop() throws JFException {}

}
Mind that the depth may vary from 1 to 10 and for history ticks the depth always is 1.
Also see the example:
https://www.dukascopy.com/wiki/#Get_full_Market_Depth


 
 Post subject: Re: Market Depth Post rating: 0   New post Posted: Thu 02 Aug, 2012, 19:40 

User rating: 0
Joined: Mon 25 Jun, 2012, 15:55
Posts: 13
Thank you for the strategy.

I tried this but I get always two different kinds of output. Once it shows only one single column with strange values and the other time it shows the right number of columns with correct values.
Is it possible to provide only the proper output? I uploaded two screenshots with the correct and incorrect output.

Thank you
jIMMY kNOPPERS :)


Attachments:
works.jpg [150.67 KiB]
Downloaded 349 times
does_not_work.jpg [121.49 KiB]
Downloaded 323 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: Market Depth Post rating: 0   New post Posted: Fri 03 Aug, 2012, 07:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Add the tick filtering by instrument:
https://www.dukascopy.com/wiki/#Filter_Ticks_Bars


 

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