btfxwss/connection.py
def send(self, api_key=None, secret=None, list_data=None, auth=False, **kwargs):
        """Sends the given Payload to the API via the websocket connection.

        :param kwargs: payload paarameters as key=value pairs
        :return:
        """
        if auth:
            nonce = str(int(time.time() * 10000000))
            auth_string = 'AUTH' + nonce
            auth_sig = hmac.new(secret.encode(), auth_string.encode(),
                                hashlib.sha384).hexdigest()

            payload = {'event': 'auth', 'apiKey': api_key, 'authSig': auth_sig,
                       'authPayload': auth_string, 'authNonce': nonce}
            payload = json.dumps(payload)
        elif list_data:
            payload = json.dumps(list_data)
        else:
            payload = json.dumps(kwargs)
        self.log.debug("send(): Sending payload to API: %s", payload)
        try:
            self.socket.send(payload)
        except websocket.WebSocketConnectionClosedException:
            self.log.error("send(): Did not send out payload %s - client not connected. ", kwargs)
def send(self, api_key=None, secret=None, list_data=None, auth=False, **kwargs):
        if auth:
            nonce = str(int(time.time() * 10000000))
            auth_string = 'AUTH' + nonce
            auth_sig = hmac.new(secret.encode(), auth_string.encode(),
                                hashlib.sha384).hexdigest()

            payload = {'event': 'auth', 'apiKey': api_key, 'authSig': auth_sig,
                       'authPayload': auth_string, 'authNonce': nonce}
            payload = json.dumps(payload)
        elif list_data:
            payload = json.dumps(list_data)
        else:
            payload = json.dumps(kwargs)
        self.log.debug("send(): Sending payload to API: %s", payload)
        try:
            self.socket.send(payload)
        except websocket.WebSocketConnectionClosedException:
            self.log.error("send(): Did not send out payload %s - client not connected. ", kwargs)
def send ( self , api_key = None , secret = None , list_data = None , auth = False , * * kwargs ) : if auth : nonce = str ( int ( time . time ( ) * 10000000 ) ) auth_string = 'AUTH' + nonce auth_sig = hmac . new ( secret . encode ( ) , auth_string . encode ( ) , hashlib . sha384 ) . hexdigest ( ) payload = { 'event' : 'auth' , 'apiKey' : api_key , 'authSig' : auth_sig , 'authPayload' : auth_string , 'authNonce' : nonce } payload = json . dumps ( payload ) elif list_data : payload = json . dumps ( list_data ) else : payload = json . dumps ( kwargs ) self . log . debug ( "send(): Sending payload to API: %s" , payload ) try : self . socket . send ( payload ) except websocket . WebSocketConnectionClosedException : self . log . error ( "send(): Did not send out payload %s - client not connected. " , kwargs )
Sends the given Payload to the API via the websocket connection.

        :param kwargs: payload paarameters as key=value pairs
        :return:
Sends the given Payload to the API via the websocket connection .