Jump to content
Sign in to follow this  
Guest andreif

Strange behavior of ListCfdMarkets method

Recommended Posts

Guest andreif
  1. When I call it with maxResults=500, it only returns 200 results
  2. When I pass # symbol as market name filter and maxResults=20, it returns all available markets (i.e. ignores maxResults parameter)

Here is some JS console code to reproduce this strange behaviour onhttps://ciapipreprod.cityindextest9.co.uk/tradingapi/?

var userName = "DM807444";
doPost('/session',{ "UserName": userName, "Password": "password"}, function (data, textCode) {
    setRequestHeader("UserName", userName);
    setRequestHeader("Session", data.Session);

    //Market search
    doGet('/cfd/markets?MarketName=uk&MaxResults=20');  //20 markets returned as expected
    doGet('/cfd/markets?MarketName=uk&MaxResults=500'); //there are 360 markets beginning with uk, but only 200 are returned
    doGet('/cfd/markets?MarketName=#&MaxResults=1');    //returns 5867 markets
    doGet('/cfd/markets?MarketName=#');                 //returns 5867 markets

});

Share this post


Link to post
Guest andreif

The maximum number of markets you can request currently with a specific search is 200.

Function should return error code, if input args are out of correct bounds. And what about case 2?

Share this post


Link to post
Guest sky.sanders

The maximum number of markets you can request currently with a specific search is 200.

i agree with setting a limit on a single response. but without a paging facility (and a stable server sort) this particular functionality is crippled. the only option one has currently is to exploit the ‘#’ bug and search the results. I guess what i am trying to say is that if you are going to limit the results of any single arbitrary query to a set that is smaller than the possible result you must provide a pagesize (maxresults) and page parameter.

Share this post


Link to post
Guest mrdavidlaing

The maximum number of markets you can request currently with a specific search is 200.

@andreif Case 2 is an “undocumented feature” that was used by an older client application. It might be removed at a later date for performance reasons, but currently there is no reason to change it.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×