def step_impl(context, env, connection, instrument): context.instrument = instrument settings = read_settings(CONFIG_PATH_FOR_FEATURE_STEPS, env) context.streamer = \ get_price_streamer(context, connection, env, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], 'EUR_USD') context.price_thread = threading.Thread(target=context.streamer.stream, args=[]) context.price_thread.start()
def setUp(self): self.journaler = Journaler() domain = ENVIRONMENTS['api'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.streamer = HistoricForexPrices(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'])
def wire(self, com_q=None, in_q=None, out_q=None, hb_q=None, e_q=None): domain = ENVIRONMENTS['api'][self.target_env] settings = read_settings(self.config_path, self.target_env) executor = OandaExecutionHandler(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) execution_loop = EventLoop(in_q, executor, processed_event_q=out_q) execution_loop.set_command_q(com_q) return execution_loop
def step_impl(context, instrument): context.response = None domain = ENVIRONMENTS[context.connection][context.env] settings = read_settings(CONFIG_PATH_FOR_FEATURE_STEPS, context.env) context.prices = HistoricForexPrices(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID']) context.instrument = instrument context.response = context.prices.query(instrument)
def step_impl(context, instrument): context.response = None domain = ENVIRONMENTS[context.connection][context.env] settings = read_settings(CONFIG_PATH_FOR_FEATURE_STEPS, context.env) context.prices = HistoricForexPrices( domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'] ) context.instrument = instrument context.response = context.prices.query(instrument)
def setUp(self): self.journaler = Journaler() domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.ticks_q = Queue() self.heartbeat_q = Queue() self.exception_q = Queue() self.prices = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) self.prices.set_instruments('EUR_USD') self.prices.set_events_q(self.ticks_q).set_heartbeat_q(self.heartbeat_q).set_exception_q(self.exception_q) self.price_thread = Thread(target=self.prices.start, args=[])
def setUp(self): self.journaler = Journaler() domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.events = Queue() self.heartbeat_q = Queue() self.exceptions = Queue() self.streamer = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) self.streamer.set_events_q(self.events).set_heartbeat_q(self.heartbeat_q).set_exception_q(self.exceptions) self.streamer.set_context(OANDA_CONTEXT_EVENTS) self.streaming_thread = Thread(target=self.streamer.stream, args=[]) self.streaming_thread.start()
def setUp(self): domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.streamer = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], Journaler()) self.streamer.set_events_q(Queue()).set_heartbeat_q(Queue()).set_exception_q(Queue()) self.streamer.set_context(OANDA_CONTEXT_EVENTS) self.streaming_thread = Thread(target=self.streamer.stream, args=[]) self.command_q = Queue() self.listener = QueueCommandListener(self.command_q, self.streamer.on_command) self.command_thread = self.listener.start_thread() self.streaming_thread.start()
def wire(self, com_q=None, in_q=None, out_q=None, hb_q=None, e_q=None): domain = ENVIRONMENTS['streaming'][self.target_env] settings = read_settings(self.config_path, self.target_env) rates_streamer = OandaEventStreamer( domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) rates_streamer.set_instruments(self.instruments) rates_streamer.set_events_q(out_q).set_heartbeat_q(hb_q).set_exception_q(e_q) if com_q: listener = QueueCommandListener(com_q, rates_streamer.on_command) return rates_streamer, listener else: # Not required to return anything, but streamer reference can be used in shut down return rates_streamer
def setUp(self): self.journaler = Journaler() domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.ticks_q = Queue() self.heartbeat_q = Queue() self.exception_q = Queue() self.prices = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) self.prices.set_instruments('EUR_USD') self.prices.set_events_q(self.ticks_q).set_heartbeat_q( self.heartbeat_q).set_exception_q(self.exception_q) self.price_thread = Thread(target=self.prices.start, args=[])
def setUp(self): self.journaler = Journaler() domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.events = Queue() self.heartbeat_q = Queue() self.exceptions = Queue() self.streamer = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) self.streamer.set_events_q(self.events).set_heartbeat_q( self.heartbeat_q).set_exception_q(self.exceptions) self.streamer.set_context(OANDA_CONTEXT_EVENTS) self.streaming_thread = Thread(target=self.streamer.stream, args=[]) self.streaming_thread.start()
def setUp(self): domain = ENVIRONMENTS['streaming'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.streamer = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], Journaler()) self.streamer.set_events_q(Queue()).set_heartbeat_q( Queue()).set_exception_q(Queue()) self.streamer.set_context(OANDA_CONTEXT_EVENTS) self.streaming_thread = Thread(target=self.streamer.stream, args=[]) self.command_q = Queue() self.listener = QueueCommandListener(self.command_q, self.streamer.on_command) self.command_thread = self.listener.start_thread() self.streaming_thread.start()
def wire(self, com_q=None, in_q=None, out_q=None, hb_q=None, e_q=None): domain = ENVIRONMENTS['streaming'][self.target_env] settings = read_settings(self.config_path, self.target_env) rates_streamer = OandaEventStreamer(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], self.journaler) rates_streamer.set_instruments(self.instruments) rates_streamer.set_events_q(out_q).set_heartbeat_q( hb_q).set_exception_q(e_q) if com_q: listener = QueueCommandListener(com_q, rates_streamer.on_command) return rates_streamer, listener else: # Not required to return anything, but streamer reference can be used in shut down return rates_streamer
def step_impl(context, env, connection): context.response = None settings = read_settings(CONFIG_PATH_FOR_FEATURE_STEPS, env) context.executor = get_executor(connection, env, settings) context.executor.connect()
def setUp(self): domain = ENVIRONMENTS['api'][TARGET_ENV] settings = read_settings(CONFIG_PATH_FOR_UNIT_TESTS, TARGET_ENV) self.executor = OandaExecutionHandler(domain, settings['ACCESS_TOKEN'], settings['ACCOUNT_ID'], Journaler())
def step_impl(context, path): context.mySettings = read_settings(path, context.env)