How to use the pywaves.MATCHER function in PyWaves

To help you get started, we’ve selected a few PyWaves examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyWaves / PyWaves / asset.py View on Github external
def orderbook(self):
        req = pywaves.wrapper('/matcher/orderbook/%s/%s' % (self.a1, self.a2), host=pywaves.MATCHER)
        return req
github PyWaves / PyWaves / order.py View on Github external
def __init__(self, orderId, assetPair, address = ''):
        self.orderId = orderId
        self.assetPair = assetPair
        self.address = address
        self.matcher = pywaves.MATCHER
        self.matcherPublicKey = pywaves.MATCHER_PUBLICKEY
        self.status()
github PyWaves / PyWaves / address.py View on Github external
data = json.dumps({
            "senderPublicKey": self.publicKey,
            "matcherPublicKey": pywaves.MATCHER_PUBLICKEY,
            "assetPair": {
                "amountAsset": amountAsset.assetId,
                "priceAsset": priceAsset.assetId,
                },
            "orderType": otype,
            "price": price,
            "amount": amount,
            "timestamp": timestamp,
            "expiration": expiration,
            "matcherFee": matcherFee,
            "signature": signature
        })
        req = pywaves.wrapper('/matcher/orderbook', data, host=pywaves.MATCHER)
        print(req)
        id = -1
        if 'status' in req:
            if req['status'] == 'OrderRejected':
                msg = 'Order Rejected - %s' % req['message']
                logging.error(msg)
                pywaves.throw_error(msg)
            elif req['status'] == 'OrderAccepted':
                id = req['message']['id']
                logging.info('Order Accepted - ID: %s' % id)
        elif not pywaves.OFFLINE:
            logging.error(req)
            pywaves.throw_error(req)
        else:
            return req
        return id