bartol82
Hi,
I'm developing a proof-of-concept .NET data adapter for LS and I'm still getting the hang of it so I apologise in front if I ask something obvious.
As the adapter feeds the current stock data to LS clients, I definitely want to have an item in the MERGE mode for each of the listed stock, e.g. PLVA, ERNT. So far so good.
But I would also like to have the ability for the clients to subscribe to an item that represents "all traded stocks for the current trading day". So I figured I need an item "ALL_TRADED" in the COMMAND mode, where I could ADD new stocks to the table as they get traded. The schema (fields) and the data of "ALL_TRADED" and every specific stock's items are identical. After a (too) long introduction my question would be is there a way to setup things so that if a subscription is made to the "ALL_TRADED" item I do not have to call listener's Update event for each of the specific stock's items that are already included in the "ALL_TRADED" item?
Thanks.
Dario Crivelli
As far as I am concerned, the introduction is not too long; rather, the final question is a bit too short.
If I understand well, you would like to save the management of the "ALL_TRADED" item in your Data Adapter, in particular because it would be a problem to provide the current snapshot at subscription time.
Other aspects of the problem are unclear to me.
Does the list of traded quotes include quotes that may have never been subscribed to by any client
or a list based on the currently subscribed items would be enough?
If Lightstreamer is started when the market is already open, can you ask your feed for the current list of traded items
or generating an approximate list based on the trades occurred since Lightstreamer start would be enough?
Dario Crivelli
Sorry, perhaps you meant that you would like to avoid calling "Update" twice for each event you receive from the feed (once for the stock-specific item and once for the "ALL_TRADED" items).
May you please confirm?
bartol82
Sorry for the (much) delayed answer, I got occupied with higher priority things.
Yes, that is correct, I was wondering was there a way to avoid calling Update for each single stock subscription items and then again for the ALL_TRADED subscription, since the data is identical (minus "key" and "command" fields for the ALL_TRADED item)?
But maybe this is a perfect example of a premature optimization attempt?
Dario Crivelli
You could implement your ALL_TRADED item as only listing the stock-specific item names of the traded stocks;
your client could get quote data for those items by second-level subscriptions driven by the ALL_TRADED item contents.
This seems quite complicated, but, thanks to your delay, you can now take advantage of the MultiMetapush table support, introduced with the newly released Lightstreamer 3.5, which does just the above.
This support is available for the Web Client Library and the Flex Client Library, both for visual and nonvisual tables.
These libraries also take care of optimizing the process of performing many second-level subscriptions in short time.