Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def orderbook(self):
req = pywaves.wrapper('/matcher/orderbook/%s/%s' % (self.a1, self.a2), host=pywaves.MATCHER)
return req
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()
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