Closed CoreCPU closed 10 years ago
Hi Alain,
It is not possible to subscribe multiple services with one session. To achieve your goal, you need to instantiate two or more PyRFA objects with pyrfa.Pyrfa()
and each one will have its own ServiceName
in the configuration file.
So basically your Python code will look like
p = pyrfa.Pyrfa()
p.createConfigDb("./pyrfa.cfg")
p.acquireSession("Session1")
p.createOMMConsumer()
p.login()
p.directoryRequest()
p.dictionaryRequest()
q = pyrfa.Pyrfa()
q.createConfigDb("./pyrfa.cfg")
q.acquireSession("Session2")
q.createOMMConsumer()
q.login()
q.directoryRequest()
q.dictionaryRequest()
And you configuration will look like
\Sessions\Session1\connectionList = "Connection_RSSL1"
\Sessions\Session2\connectionList = "Connection_RSSL2"
\Connections\Connection_RSSL1\rsslPort = "14002"
\Connections\Connection_RSSL1\ServerList = "192.168.1.100"
\Connections\Connection_RSSL1\connectionType = "RSSL"
\Connections\Connection_RSSL1\logEnabled = true
\Connections\Connection_RSSL1\UserName = "pyrfa"
\Connections\Connection_RSSL1\InstanceId = "100"
\Connections\Connection_RSSL1\ServiceName = "IDN_SELECTFEED"
\Connections\Connection_RSSL1\downloadDataDict = true
\Connections\Connection_RSSL2\rsslPort = "14002"
\Connections\Connection_RSSL2\ServerList = "192.168.1.100"
\Connections\Connection_RSSL2\connectionType = "RSSL"
\Connections\Connection_RSSL2\logEnabled = true
\Connections\Connection_RSSL2\UserName = "pyrfa"
\Connections\Connection_RSSL2\InstanceId = "101"
\Connections\Connection_RSSL2\ServiceName = "BROKER_SERVICE"
\Connections\Connection_RSSL2\downloadDataDict = true
We did something like this in-house in order to generate aggregated order books from two exchange direct feeds into an application. Let me know if this works for you.
Hi,
Thank you so much for your reply and proposed solution. However, such a workaround wouldn't be very practical if you have numerous services on an ads. It looks to me that allowing one to set the service name programmatically would be a far more elegant solution.
Having said that, i'm loving PyRFA.
Kind Regards,
Alain
Hi Alain,
There is an undocumented PyRFA configuration called Service Group
and it is like:
\Connections\Connection_RSSL1\ServiceName = "SG1"
...
\ServiceGroups\SG1\serviceList = "SERVICE1, SERVICE2"
\Sessions\Session1\serviceGroupList = "SG1"
\Sessions\Session1\groupStatusFanoutEnabled = false
This will allow subscription from any one of the services (SERVICE1 or SERVICE2) in the group upon requesting market data. In your case, if you need to subscribe and receive data from one or more services so I guess this is not applicable to you.
Good news! The enhancement feature for subscribing multiple service is coming in the next release of PyRFA. Not so long now.
Done. This feature is available in v7.6.0.2.
Usage:
pyrfa.setServiceName("SERVICE1")
pyrfa.marketPriceRequest("RIC1")
pyrfa.setServiceName("SERVICE2")
pyrfa.marketPriceRequest("RIC2")
Hi,
I am trying to find out whether it is possible to subscribe to multiple services per session ? I can not find a way to set the ServiceName programmatically. The only way i found to specify the service name is in the config file.
How would i go about subscribing to multiple services as opposed to the single one specified in the config file ?
Thanks a lot...
Kind Regards,
Alain