Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jun 2008
    Location
    Glasgow
    Posts
    4

    Multiple rows per item

    Hi,

    I've written a data adapter that is used to provide exchange rate data to a client. Currently I just assume that there is only ever one rate per currency, per update. In reality, for each rate update, there may be multiple bands of rate, depending on the amount of currency you're buying.

    What I want to know is, is there any built in functionality to support this in lightstreamer, or do I have to write something myself.

    The scenario is something like (bearing in mind that the numbers are completely contrived):

    Code Bid Offer Limit
    GBPUSD 1.2 1.3 1000
    GBPUSD 1.1 1.2 5000

    Basically, I want someone to be able to subscribe to GBPUSD and receive all the rate bands for that currency pair in one update. I could write something myself to just pack and then extract this information, but obviously if there's something built in I won't.

    Cheers,
    Adam

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Hi Adam,

    There are at least three ways to handle this with Lightstreamer, depending on how the bands of rate behave.

    1) If you have a fixed number of bands, then you only need to dedicate a subset of fields (in the schema) to each band. Your Data Adapter will publish all the bands for each item. Your Client will subscribe to all the bands or only to those it is interested in.

    2) If you have a variable and dynamic number of bands, the you need to use COMMAND mode. This way, your Data Adapter will publish updates on the available bands and your Client will keep the up-to-date state of all the bands and prices.

    3) If the price/limit band depends on the specific user, you can leverage the customizeUpdate callback in the Metadata Adapter to dynamically change the price before sending it to the Client. But consider that this method in only available in Java-based Metadata Adapter and not in .NET ones (but you can still have a .NET Data Adapter and a simple Java Metadata Adapter to handle event customization).

    Hope that helps.

    Cheers,
    Alessandro

  3. #3
    Member
    Join Date
    Jun 2008
    Location
    Glasgow
    Posts
    4
    Thanks for the reply. There may be variable bands, etc so I can't really use your first solution. I'll have a think about either 2 or 3, but I think for now I'm just going to have something that will take a List and convert it to a dictionary, and vice-versa. The idea being that I can basically store it as csv and then unpack it at the client side. For example:

    myDict["myfield"] = "item1;item2;";

    One of the problems that I have is that the bands potentially vary per update (they may not in reality, but...)

    After I've got everything working I plan on changing this, though since I don't think it's a great solution.

    Cheers,
    Adam

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    OK Adam, probably COMMAND mode should do the trick.

 

 

Similar Threads

  1. Replies: 2
    Last Post: December 24th, 2010, 08:51 AM
  2. Replies: 1
    Last Post: November 6th, 2008, 09:44 AM
  3. recommened usage - multiple item subscription
    By tstojano in forum Client SDKs
    Replies: 1
    Last Post: August 13th, 2008, 05:12 PM
  4. Maximum limit of rows & coluns in a table
    By indrajit in forum Client SDKs
    Replies: 1
    Last Post: February 22nd, 2008, 09:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 04:25 PM.