Dukascopy
 
 
Wiki JStore Search Login

IFeedListener in standalone API client missing Market Depth
 Post subject: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Thu 31 Jan, 2013, 18:20 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Using API 2.7.8

Request for 2 related enhancements to IFeedListener for standalone API client.

I posted:

Possible Workaround: How to implement IFeedListener in standalone client?

in this thread:
viewtopic.php?f=65&t=48702

1) It is very difficult for a standalone API client to establish an IFeedListener, and the thread above describes a method to obtain IClient so that IClient.subscribeToTicksFeed or
IClient.subscribeToFeed can be used (code snippet shown below).

Please provide a straightforward method for standalone API client to establish a listener,
without the need to use the IStrategy approach.

2) The listener is active with this approach, but then ITick.getBids() and ITick.getAsks() within the IFeedListener returns an array
with only 1 element so full Market Depth is not available. How can full market depth
be made available to the feed listener?

Please populate the ITick with Market Depth in the listener.

            // want to get IContext so try to do it this way (need a better way)
            getClient().startStrategy(new EmptyStrategy() {
               @Override
               public void onStart(IContext contextArg) throws JFException {
                  context = contextArg;
                  //indicators = contextArg.getIndicators();
               }
            });
            //the startegy has been started in another thread, thus the onStart has not been called at this point yet

            //wait max
            int i = 10;
            while (context == null && i > 0) {
               Thread.sleep(1000);
               i--;
               System.out.println("Context is: "+(context==null?"NULL":"AVAILABLE"));
            }
            if (context!=null) {
               System.out.println("Set HyperScalperConsoleSA as a feed listener...");
               //context.subscribeToFeed(ticksFeedDescriptor, this);
               context.subscribeToTicksFeed(selectedInstrument, this); // implements ITickFeedListener
            }


Advise me if I've done something wrong, but am unable to get Market Depth using this approach, on EUR/USD for Tick feeds only. I tried with an IFeedDescriptor and with an ITickFeedDescriptor and couldn't not see Market Depth with either approach. Please advise.

Thanks !
HyperScalper


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Tue 12 Feb, 2013, 08:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Quote:
1) It is very difficult for a standalone API client to establish an IFeedListener, and the thread above describes a method to obtain IClient so that IClient.subscribeToTicksFeed or
IClient.subscribeToFeed can be used (code snippet shown below).
Please provide a straightforward method for standalone API client to establish a listener,
without the need to use the IStrategy approach.
We don't see a reason why the ticks should get subscribed outside a strategy. The sole purpose of the given example usage is due to a bug which will has already been fixed in nightly build.
Quote:
2) The listener is active with this approach, but then ITick.getBids() and ITick.getAsks() within the IFeedListener returns an array
with only 1 element so full Market Depth is not available. How can full market depth
be made available to the feed listener?
In a new API branch a full Market Depth will be available also through IFeedListener.


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Tue 12 Feb, 2013, 14:54 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Are nightly API builds available to us as developers?
Thanks.


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Tue 12 Feb, 2013, 15:17 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
hyperscalper wrote:
Are nightly API builds available to us as developers?
No, this means that the bug has been fixed and will be available with JForex-API 2.7.9.


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Tue 12 Feb, 2013, 17:33 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
API Support wrote:
Quote:
Quote:
Please provide a straightforward method for standalone API client to establish a listener,
without the need to use the IStrategy approach.
We don't see a reason why the ticks should get subscribed outside a strategy. The sole purpose of the given example usage is due to a bug which will has already been fixed in nightly build.


Yes, if you are intending the primary data acquisition mechanism to be the IStrategy construct, then that makes sense. However, why should we have to use the IStrategy construct in the standalone client in order to obtain feed data, and Market Depth? So I can understand that it really comes down to your design direction for the standalone API client, whether running IStrategy objects should be the only way that full data (ticks and Market Depth) can be obtained.

I am new at API standalone, but now that I am using it, I'll probably not go back to running IStrategy modules in JForex platform for my specializ(s)ed needs. And I would prefer not to have to rely upon an IStrategy.onTick to receive market depth data in all cases. So, please continue to make it easy and straightforward for full feeds to be obtained, without the need for an IStrategy "helper" mechanism or construct.

HyperScalper


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Wed 13 Feb, 2013, 15:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The main purpose of the JForex-SDK is launching strategies outside the jforex platform. The job of IClient is setting up the environment for this purpose and the strategy launching itself. IClient's job, however, is not the duplication of the IStrategy functionality.


 
 Post subject: Re: IFeedListener in standalone API client missing Market Depth Post rating: 0   New post Posted: Sat 16 Feb, 2013, 01:05 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
API Support wrote:
The main purpose of the JForex-SDK is launching strategies outside the jforex platform. The job of IClient is setting up the environment for this purpose and the strategy launching itself. IClient's job, however, is not the duplication of the IStrategy functionality.


So, then the IStrategy construct is your fundamental structure for trading systems. But when I use an API, I don't expect to have to use just one single approach to implement my standalone trading system.

Of course, it's very nice that the standalone client can re-use existing IStrategy constructs, but I would hope the API opens up possibilities to implement much more generic approaches.

Why should I have to launch IStrategy instances (in callback threads which I don't control) just in order to get access, for example, to Market Depth information and pricing?

When I look at others' usage of the standalone API, one function is as a "container" for IStrategies, but I hope the Dukascopy team will continue to expand what can be done outside of the IStrategy construct itself, please :)

HyperScalper


 

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