Doubts on writing a LiveDataServer


#1

Hi ,

I am trying to write a live data server like the “Simulated live market data” source.
Here i got a grasp of the rest of the things but one.

How is the string “Simulated live market data” mapped to the class "SimulatedMarketDataGenerator"
I went through the file ExampleMarketDataComponentFactory.java to see that 2 different components LiveMarketDataProviderFactory and NamedMarketDataSpecificationRepository are registered independently in 2 functions.

Here in first function , MarketDataProviderFactory component is registered
and in second “Simulated live market data” is mapped to an instance of LiveMarketDataSpecification which is in no way is connected to SimulatedMarketDataGenerator.

It will help me a lot if someone can help to understand the mechanism by which both these are connected or mapped.

Thanks
Vineeth


#2

What are you actually trying to achieve? From what you’ve said before you really want to be able to run engine cycles against historical data. In that case we already have a mechanism for that which we’ve been discussing in the other thread.


#3

I am trying to understand how the example live market data generator is working.
I can see the class SimulatedMarketDataGenerator pumping Market_value.
Also i can see the keyword “Simulated live market data” somehow mapped to SimulatedMarketDataGenerator.
But my doubt in this regard is that , how are both these mapped.
From your reply from the previous thread , my understanding is that , any number of datagenerators can pump data and the field with highest “rating” as show in HistoricalTimeSeriesRating is chosen.

Correct me if i am wrong.

Thanks
Vineeth


#4

Let me rephrase my doubt in simple words -

For every MarketDataSpecification i believe there should be a MarketDataProvider which pumps value.
How is a MarketDataProvider mapped to MarketDataSpecification.

Thanks
Vineeth


#5

In MarketDataProviderResolverComponentFactory.initMarketDataProviderResolver(), the system registers a range of MarketDataProviders against the class of the corresponding MarketDataSpecification. When the MarketDataSpecification is passed in through the execution options, it is looked up in a TypeBasedMarketDataProviderResolver populated in that method to find a factory that can create the appropriate MarketDataProvider. For the examples, there’s an equivalent class that just registers the SimulatedMarketDataGenerator in ExampleMarketDataComponentFactory.initMarketDataProviderResolver().


#6

@Jim - many thanks for your reply. That certainly answers all my queries.


#7

@jim - again i have a small doubt here.

Following line in MarketDataSpecification is what mapping LatestHistoricalMarketDataSpecification to latestHistoricalMarketDataProviderFactory.

providerResolver.addProvider(LatestHistoricalMarketDataSpecification.class, latestHistoricalMarketDataProviderFactory);

That is pretty clear.

But then what if i add a new of code as follows
MarketDataProviderFactory latestHistoricalMarketDataProviderFactoryWthAnotherHistoricalTimeSeriesSource = initLatestHistoricalMarketDataProviderFactoryWthAnotherHistoricalTimeSeriesSource();
providerResolver.addProvider(LatestHistoricalMarketDataSpecification.class, latestHistoricalMarketDataProviderFactoryWthAnotherHistoricalTimeSeriesSource);

I created another instance of MarketDataProviderFactory with another htssource and mapped it to LatestHistoricalMarketDataSpecification.

How will resolution happen between the instances here.
And let say DEFAULT_TSS_CONFIG resolves to values which is common between both the instances of MarketDataProviderFactory.

Or even lets look at a different instance.

For LiveMarketDataSpecification , i have multiple providers say bloomberg and reuters.

How will LiveMarketDataSpecification decide which provider to accept as it cant accept both at a time.

Bottom line is that i agree that MarketDataSpecification class is mapped to their respective MarketDataProviderFactory.
But how are distinct MarketDataProviders resolved when there are more than one of them mapped to the same MarketDataSpecification ?

Thanks
Vineeth


#8

You can’t, it’s a one to one mapping, you need to use a combining provider that merges the two. See CombinedMarketDataProvider[Factory] which accepts CombinedMarketDataSpecification objects.