def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event pricing.start() subject = pricing.build for ccyPair in ["EURUSD", "GBPUSD", "USDJPY", "USDCAD"]: pricing.subscribe( subject.fx.indicative.spot.currency_pair(ccyPair).create_subject()) vod = (subject.equity.exchange("LSE").level("Depth").source( "ComStock").symbol("E:VOD").create_subject()) rog = (subject.equity.exchange("VTX").level("Depth").source( "ComStock").symbol("E:ROG").create_subject()) pricing.subscribe(vod) pricing.subscribe(rog) time.sleep(25) pricing.unsubscribe(vod) time.sleep(25) pricing.subscribe(vod)
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event pricing.start() for ccyPair in ["EURUSD", "GBPUSD", "USDJPY", "USDCAD"]: pricing.subscribe( pricing.build.fx.indicative.spot.currency_pair( ccyPair).create_subject()) src = "IDC" pricing.subscribe( pricing.build.equity.exchange("LSE").level("Depth").source(src).symbol( "E:VOD").create_subject()) pricing.subscribe( pricing.build.equity.exchange("VTX").level("Depth").source(src).symbol( "E:ROG").create_subject()) pricing.subscribe( pricing.build.equity.exchange("SWX").level("Depth").source(src).symbol( "E:ROSE").create_subject()) pricing.subscribe( pricing.build.equity.exchange("SWX").level("Depth").source(src).symbol( "E:ALPH").create_subject()) pricing.subscribe( pricing.build.equity.exchange("SWX").level("Depth").source(src).symbol( "E:CSLP").create_subject())
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event pricing.start() for lp in ["RBCFX", "SSFX", "MSFX", "CSFX", "JPMCFX"]: for ccy_pair in ["EURUSD", "GBPUSD", "USDJPY"]: ccy = ccy_pair[:3] pricing.subscribe( pricing.build.fx.quote.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) for ccy_pair in ["USDKRW", "USDINR", "USDCOP"]: ccy = ccy_pair[:3] pricing.subscribe( pricing.build.fx.quote.ndf.liquidity_provider(lp). currency_pair(ccy_pair).currency(ccy).quantity(1000000).tenor( Tenor.of_month(1)).create_subject())
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() def killer(): time.sleep(10) logging.error("** Killing the Pixie socket connection") session.pricing._pixie_provider._opened_socket.shutdown( socket.SHUT_RDWR) for ccy_pair in ["EURUSD", "GBPUSD", "USDJPY"]: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.quote.spot.liquidity_provider( "RBCFX").currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) Thread(target=killer).start()
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() subjects = [ session.pricing.build.fx.indicative.spot.currency_pair( ccyPair).create_subject() for ccyPair in ["EURUSD", "GBPUSD", "USDJPY", "USDCAD"] ] for s in subjects: session.pricing.subscribe(s) time.sleep(15) for s in subjects: session.pricing.unsubscribe(s) time.sleep(15) for s in subjects: session.pricing.subscribe(s)
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() session.pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start()
def main(): session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.subscribe( pricing.build.fx.stream.spot.liquidity_provider("CSFX").currency_pair( "EURUSD").currency("EUR").quantity(1000000).create_subject()) pricing.start()
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event pricing.start() pricing.subscribe( pricing.build.fx.stream.spot.liquidity_provider("DBFX").currency_pair( "EURUSD").currency("EUR").quantity(1000000).create_subject()) pricing.subscribe( pricing.build.fx.stream.spot.liquidity_provider("DBFX").currency_pair( "USDJPY").currency("USD").quantity(5000000).create_subject())
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() for ccy_pair in [ "EURUSD", "GBPUSD", ]: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( "RBCFX").currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) time.sleep(10) print("Subscribe to new ones") for ccy_pair in ["USDJPY"]: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( "RBCFX").currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) time.sleep(10) print("Unsubscribe to new ones") for ccy_pair in ["EURUSD", "GBPUSD"]: ccy = ccy_pair[:3] session.pricing.unsubscribe( session.pricing.build.fx.stream.spot.liquidity_provider( "RBCFX").currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject())
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event pricing.start() subjects = create_subjects(pricing) for subject in subjects: pricing.subscribe(subject) for _ in range(10): sleep(2) shuffle(subjects) for subject in subjects[:3]: pricing.unsubscribe(subject) sleep(2) shuffle(subjects) for subject in subjects[:2]: pricing.subscribe(subject)
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() def killer(): time.sleep(15) session.pricing._puffin_provider.sock.close() print("KILLER") for ccyPair in ["EURUSD", "GBPUSD", "USDJPY"]: session.pricing.subscribe( session.pricing.build.fx.indicative.spot.currency_pair( ccyPair).create_subject()) Thread(target=killer).start()
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() # Subscribe to next Level 1 subject for lp in ["RBCFX", "SSFX", "MSFX"]: ccy_pair = "EURUSD" ccy = "EUR" session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 5000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 20000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 100000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1234567.80).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1234567.89).create_subject()) ccy = "USD" session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1234567.89).create_subject()) ccy_pair = "USDJPY" ccy = "USD" session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 100000000).create_subject()) ccy = "JPY" session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 100000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1000000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 10000000000).create_subject()) session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 12345678901).create_subject())
def test_version(self): self.assertEqual(VERSION, Session.version())
def main(): logging.basicConfig( level=logging.INFO, format="%(asctime)s %(levelname)-7s %(threadName)-12s %(message)s", ) session = Session.create_from_ini_file() pricing = session.pricing pricing.callbacks.price_event_fn = on_price_event pricing.callbacks.subscription_event_fn = on_subscription_event pricing.callbacks.provider_event_fn = on_provider_event session.pricing.start() # Subscribe to next Level 1 Quote subject PROVIDERS = { "UBSFX", "SSFX", "DBFX", "CITIFX", "NATIXISFX", "RBCFX", "TSFX2", "BOAFX", "TSFX", "CSFX", "GSFX", "SGX", "BARCFX", "JEFFX", "MSFX", "JPMCFX", "BNPFX", } CCY_PAIRS = { "EURGBP", "EURAUD", "EURCLF", "EURKWD", "EURBHD", "EUROMR", "EURJOD", "EURFKP", "EURGIP", "EURSHP", "EURKYD", "EURCHE", "EURCUC", "EURBSD", "EURPAB", "EURBMD", "EURCUP", "EURCHW", "EURSGD", "EURBND", "EURLYD", "EURAZN", "EURANG", "EURAWG", "EURBAM", "EURBGN", "EURBYN", "EURBBD", "EURBZD", "EURFJD", "EURTOP", "EURTND", "EURGEL", "EURWST", "EURXCD", "EURBRL", "EURPGK", "EURMXV", "EURPEN", "EURTMT", "EURQAR", "EURILS", "EURAED", "EURTRY", "EURSAR", "EURPLN", "EURGHS", "EURRON", "EURMYR", "EURSDG", "CLFKWD", "CLFBHD", "CLFOMR", "CLFJOD", "CLFFKP", "CLFGIP", "CLFSHP", "CLFKYD", "CLFCHE", "CLFCUC", "CLFBSD", "CLFPAB", "CLFBMD", "CLFCUP", "CLFCHW", "SGDBND", "SGDLYD", "SGDAZN", "SGDANG", "SGDAWG", "SGDBAM", "SGDBGN", "SGDBYN", "SGDBBD", "SGDBZD", "SGDFJD", "SGDTOP", "SGDTND", "SGDGEL", "SGDWST", "XCDBRL", "XCDPGK", "XCDMXV", "XCDPEN", "XCDTMT", "XCDQAR", "XCDILS", "XCDAED", "XCDTRY", "XCDSAR", "XCDPLN", "XCDGHS", "XCDRON", "XCDMYR", "XCDSDG", } for lp in PROVIDERS: for ccy_pair in CCY_PAIRS: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.quote.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1230080.11).create_subject()) for ccy_pair in CCY_PAIRS: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.quote.ndf.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1230080.11).tenor(Tenor.of_month(1)).create_subject()) for lp in PROVIDERS: for ccy_pair in CCY_PAIRS: ccy = ccy_pair[:3] session.pricing.subscribe( session.pricing.build.fx.stream.spot.liquidity_provider( lp).currency_pair(ccy_pair).currency(ccy).quantity( 1230080.11).create_subject()) session.pricing.subscribe( session.pricing.build.fx.quote.ndf.liquidity_provider(lp). currency_pair(ccy_pair).currency(ccy).quantity(1000000).tenor( Tenor.of_month(1)).create_subject())