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: Tue 25 Apr, 2017, 21:00 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
I am just wandering if there is any possibility to use Market Depth data in Automated Trading. In other words my question is about implementation of Market Depth in to Automated Strategy. Could anybody help me with this?


 
 Post subject: Re: Market Depth Post rating: 0   New post Posted: Fri 28 Apr, 2017, 07:13 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tick.getAskVolumes() and tick.getBidVolumes() return arrays with market depth values. Please note that in order to receive 10 values strategy must explicitly subscribe to the instrument.


Attachments:
Strategy.java [1.69 KiB]
Downloaded 178 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: Sun 30 Apr, 2017, 19:16 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Thanks a lot.


 
 Post subject: Re: Market Depth Post rating: 0   New post Posted: Tue 14 Nov, 2017, 19:48 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
I'm curious how to make it work in plugin. The ticks i receive there have only 1-level depth of market. Is it possible to make it 10-level depth?

Here is the dummy plugin's code i tried (mostly copy/pasted from Strategy provided ealier)

package jforex;

import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.plugins.*;
import com.dukascopy.api.feed.ITickFeedListener;

public class MarketLogger extends Plugin implements ITickFeedListener {
    private IPluginContext context;
    private IConsole console;
   
    public void onStart(IPluginContext context) throws JFException {
        this.context = context;
        this.console = context.getConsole();
        Set<Instrument> instruments = new HashSet<Instrument>();
        instruments.add(Instrument.EURUSD);
        this.context.setSubscribedInstruments(instruments);
        this.context.subscribeToTicksFeed(Instrument.EURUSD, this);
    }

    public void onStop() throws JFException {
    }
   
    @Override
    public void onTick(final Instrument instrument, final ITick tick) {
        if(!Instrument.EURUSD.equals(instrument)) {
            return;
        }
               
        console.getOut().print("ask ");
        for(double volume : tick.getAskVolumes()) {
            console.getOut().print(volume+ ", ");
        }
        console.getOut().println();
       
        console.getOut().print("bid ");
        for(double volume : tick.getBidVolumes()) {
            console.getOut().print(volume+ ", ");
        }
        console.getOut().println();
    }   
}


 
 Post subject: Re: Market Depth Post rating: 0   New post Posted: Wed 15 Nov, 2017, 17:37 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
https://www.dukascopy.com/wiki/en/devel ... rket-depth


 
 Post subject: Re: Market Depth Post rating: 0   New post Posted: Thu 16 Nov, 2017, 07:05 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
That link is the strategy - "class FullMarketDepth implements IStrategy", not "class FullMarketDepth extends Plugin" ...

But anyway, as far as I see strategy has same access to UI elements as plugin and rewriting plugin as strategy is not a big deal. This is somewhat unnatural (using strategy to alter UI), but it works :) Therefore my question is closed.


 

Jump to:  

  © 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