def header(self): """Return auth headers. Will use API Keys if present in settings.""" auth_header = [] alog.info(f'### should auth {self.should_auth} ###') if self.should_auth: alog.info("Authenticating with API Key.") # To auth to the WS using an API key, we generate a signature # of a nonce and the WS API endpoint. alog.info((settings.BITMEX_API_KEY, settings.BITMEX_API_SECRET)) nonce = generate_nonce() api_signature = generate_signature(settings.BITMEX_API_SECRET, 'GET', '/realtime', nonce, '') auth_header = [ "api-nonce: " + str(nonce), "api-signature: " + api_signature, "api-key:" + settings.BITMEX_API_KEY ] alog.info(alog.pformat(auth_header)) return auth_header
def on_action(self, message): alog.debug(alog.pformat(message))
def test_pformat(self): msg = {'life is strange': True, 'list is weird': list(range(10))} alog.info(alog.pformat(msg))
def on_action(self, message): alog.info(alog.pformat(message['data']))