devcartel / pyrfa

Open sourced Python API for Refinitiv (Thomson Reuters) Enterprise Platform.
http://devcartel.com/pyrfa
MIT License
52 stars 16 forks source link

Examples: marketPricePause() and marketPriceResume() #25

Closed peervm closed 7 years ago

peervm commented 7 years ago

Hi,

Can you provide working examples of marketPricePause() and marketPriceResume() please.

I am unable to make the call as per the documentation and the stubs below don't help much.

Thanks, Peer

Boost.Python.ArgumentError: Python argument types in Pyrfa.marketPriceResume(Pyrfa) did not match C++ signature: marketPriceResume(class Pyrfa {lvalue}, class boost::python::api::object)

ukrit-himakoon commented 7 years ago

Hello Peer,

Pyrfa.marketPricePause(symbols) and Pyrfa.marketPriceResume(symbols)

requires the input parameter as strings for example: p.marketPricePause("JPY=") p.marketPriceResume("JPY=")

you can also pause/resume multiple rics using "," for example

p.marketPricePause("JPY=,EUR=")

Best regards, Ukrit H.

On Mon, Apr 17, 2017 at 9:07 AM, Peer VM notifications@github.com wrote:

Hi,

Can you provide working examples of marketPricePause() and marketPriceResume() please.

I am unable to make the call as per the documentation and the stubs below don't help much.

Thanks, Peer

Boost.Python.ArgumentError: Python argument types in Pyrfa.marketPriceResume(Pyrfa) did not match C++ signature: marketPriceResume(class Pyrfa {lvalue}, class boost::python::api::object)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/devcartel/pyrfa/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQ4J0fhrSiDLu_cEAqGluDpdenWkMiQks5rwslygaJpZM4M-ziV .

wiwat-tharateeraparb commented 7 years ago

There is a working example on GitHub https://github.com/devcartel/pyrfa/blob/master/examples/conflate.py

peervm commented 7 years ago

Thanks guys. The conflate.py example has pauseAll() and resumeAll() which works fine for me.

I'm using 8.1.0 on Python 3.6 win64 but this code doesn't work; p.marketPricePause("JPY=") p.marketPriceResume("JPY=") where p is an instance of the pyrfa.pyrfa.Pyrfa class.

It says method signature error; did not match C++ signature: marketPriceResume(class Pyrfa {lvalue}, class boost::python::api::object)

peervm commented 7 years ago

I can see the signature looks the for all methods;

Expected usage:

wiwat-tharateeraparb commented 7 years ago

@peervm Can you check the PyRFA version on your machine? Looks like you are loading older version of PyRFA. PyRFA supports pause and resume from version 8.0.0.1.

wiwat-tharateeraparb commented 7 years ago

@peervm We just did a test on Python 3.6 windows 64 and it works fine.

Result:

pasted image at 2017_04_17 12_28 pm

Try with below code:

import pyrfa
exec(open('./utils/every.py').read())

p = pyrfa.Pyrfa()
p.createConfigDb("./pyrfa.cfg")
p.acquireSession("Session1")
p.createOMMConsumer()
p.login()
p.directoryRequest()
p.dictionaryRequest()
p.marketPriceRequest("JPY=")
p.dispatchEventQueue(1000)
p.marketPricePause("JPY=")

def getConflatedUpdate():
    p.marketPriceResume("JPY=")
    updates = p.dispatchEventQueue(10)
    p.marketPricePause("JPY=")
    if updates:
        print("")
        for u in updates:
            print(u['SERVICE'] + " - " + u['RIC'])
            for k,v in u.items():
                if type(v) is float:
                    print("%15s %g" % (k,v))
                else:
                    print("%15s %s" % (k,v))
            print("")

loop = every(10, getConflatedUpdate)
end = False
try:
    while not end:
        pass
except KeyboardInterrupt:
    loop.stop()
    end = True
peervm commented 7 years ago

Installing RFA libraries on win7 machine installs into difference and confusing paths and this caused a conflict.

I haven't fixed the issue locally yet, but it is almost certainly the root cause.

Thanks for your assistance and amazing response time.

peervm commented 7 years ago

Got everything working now. But just for future reference, another mistake I made was to use snapshot mode. Obviously pause\resume only works for setInteractionType("stream").