def onOpen(self): logger.info('Connected to websocket') self.url = 'https://priv-api.bitstamp.net/api/order_book/' self.redis = yield util.setup_redis() binding_key = '%s.orderbook.tinker' % self.exchange_name.lower() self.producer = yield util.setup_producer(consts.ORDERBOOK_QUEUE, binding_key) # Reset everything self.orderbook = '' self.orderbook_timestamp = None self.orderbook_change_backlog = {} self.first_change_timestamp = None self.message_count = 0 self.message_count_buffer = 3 self.last_amqp_push = 0 yield self.redis.set(self.orderbook_key, None) # Start fetching the base orderbook from self.url the request poller will call # parse_response with the response. self.get_request() self.subscribe_to_websocket()
def start(self): self.redis = yield util.setup_redis() self.setup_mysql() self.heartbeat_key = 'trades_auditor_heartbeat' self.looping_call = LoopingCall(self.audit).start(1800) self.accuracy_bottom = Decimal('0.99') self.accuracy_top = Decimal('1.01') self.slacker = Slacker('#notifications', 'Auditor')
def start(self): self.setup_mysql() self.orderbook_timestamp = Delorean().datetime self.unsuccessful_audits = 0 self.incomplete_audits = 0 self.touch_path = 'monit/heartbeat/%s_orderbook.txt' % self.exchange_name.lower( ) self.looping_call = LoopingCall(self.pre_audit) self.looping_call.start(self.audit_time) self.redis = yield util.setup_redis() self.should_continue_key = '%s_orderbook_should_continue' % self.exchange_name.lower( ) self.redis.set(self.should_continue_key, 1)
def onOpen(self): logger.info('Connected to websocket') self.redis = yield util.setup_redis() binding_key = '%s.orderbook.tinker' % self.exchange_name.lower() self.producer = yield util.setup_producer(consts.ORDERBOOK_QUEUE, binding_key) # Reset everything. self.orderbook = {'bids': None, 'asks': None} self.bids_dict = {} self.asks_dict = {} self.channel_id = None self.have_gotten_base_orderbook = False self.last_amqp_push = 0 yield self.redis.set(self.orderbook_key, None) self.subscribe_to_websocket()
def start(self): self.touch_path = 'monit/heartbeat/twisted.txt' self.redis = yield util.setup_redis() self.heartbeat_threshold = 120 self.heartbeats = [ 'bitfinex_trades_heartbeat', 'bitstamp_btc_usd_trades_heartbeat', 'coinbase_btc_usd_trades_heartbeat', 'itbit_trades_heartbeat', 'kraken_trades_heartbeat', 'kraken_usd_trades_heartbeat', 'kraken_cad_trades_heartbeat', 'okcoin_trades_heartbeat', #'coinbase_cad_trades_heartbeat', 'gemini_trades_heartbeat', 'quadriga_trades_heartbeat', 'okcoin_orderbook_heartbeat', 'bitstamp_btc_usd_orderbook_heartbeat', 'kraken_orderbook_heartbeat', 'kraken_usd_orderbook_heartbeat', 'kraken_cad_orderbook_heartbeat', 'itbit_orderbook_heartbeat', 'coinbase_btc_usd_orderbook_heartbeat', #'coinbase_cad_orderbook_heartbeat', 'bitfinex_orderbook_heartbeat', 'quadriga_orderbook_heartbeat', 'gemini_orderbook_heartbeat', 'gemini_eth_btc_orderbook_heartbeat', 'bitstamp_eth_btc_orderbook_heartbeat', 'poloniex_eth_btc_orderbook_heartbeat', 'gemini_eth_usd_orderbook_heartbeat', 'bitstamp_eth_usd_orderbook_heartbeat', 'bitstamp_eth_eur_orderbook_heartbeat', 'bitstamp_bch_eur_orderbook_heartbeat', 'bitstamp_bch_usd_orderbook_heartbeat', 'bitstamp_bch_btc_orderbook_heartbeat', 'bitstamp_btc_eur_orderbook_heartbeat', 'open_exchange_rate_poller_heartbeat', ] self.looping_call = LoopingCall(self.audit) self.looping_call.start(30)
def start(self): self.redis = yield util.setup_redis() binding_key = '%s.trades.tinker' % self.exchange_name.lower() self.producer = yield util.setup_producer(consts.TRADES_QUEUE, binding_key) raw_most_recent_trade_id = yield self.redis.get(self.trade_id_key) if raw_most_recent_trade_id: self.most_recent_trade_id = int(raw_most_recent_trade_id) else: self.most_recent_trade_id = 0 # We are not using RequestPoller's start() function because we want to set # now=False. This is a bit of a hack to give the producer time to get set up # before we start publishing messages. self.looping_call = LoopingCall(self.get_request) self.looping_call.start(self.poll_time, now=False)
def onOpen(self): logger.info('Connected to websocket') reactor.callLater(self.ping_interval, self.keepalive) self.redis = yield util.setup_redis() binding_key = '%s.orderbook.tinker' % self.exchange_name.lower() self.producer = yield util.setup_producer(consts.ORDERBOOK_QUEUE, binding_key) # Reset everything. self.orderbook = '' self.orderbook_change_backlog = {} self.first_sequence_number = 0 self.current_sequence_number = 0 self.orderbook_sequence_number = 0 self.received_orders = {} self.last_amqp_push = 0 yield self.redis.set(self.orderbook_key, None) # Start fetching the base orderbook from self.url. The request poller will call # parse_response with the response. self.get_request() self.subscribe_to_websocket()
def start(self): self.redis = yield util.setup_redis() self.setup_mysql() self.looping_call = LoopingCall(self.audit).start(30)
def start(self): self.redis = yield util.setup_redis() self.looping_call = LoopingCall(self.get_request) self.looping_call.start(self.poll_time)