def marketData(self, market=None, type=None): if not market and not type: return rp.Parse(url='/markets', type='get') elif market: if not type: return rp.Parse(url='/markets/' + market, type='get') else: return rp.Parse(url='/markets/' + market + '/' + type, type='get')
def cancelOrder(self, market=None): if market: self.report.notice(content="Cancelling all orders at " + market) return rp.Parse(url='/orders/' + market , type='delete', auth='true') pass else: self.report.notice(content="Cancelling all orders.") return rp.Parse(url='/orders', type='delete', auth='true') pass
def createOrder(self, type=None, amount=None, price=None, market=None): if type and amount and price and market: if amount <= '0.0001': self.report.error(content="Amount has to be larger than 0.") if price <= '0.01': self.report.error(content="Price has to be larger than 0.") obj = { 'market': market, 'amount': str(amount), 'price': str(price), 'type': type } self.report.notice(content="Placing order: " + str(obj)) rp.Parse(url='/orders', data=obj, type='post', auth='true') else: self.report.error(content="Missing critical information, e.g: order type, amount or price")
def history(self, data=None, year=None, month=None, market=None): if data: if data == 'deposit': return rp.Parse(url='/deposit/history', type='get', auth='true') if data == 'orders': if not market: return rp.Parse(url='/history/orders', type='get', auth='true') else: return rp.Parse(url='/history/orders/' + market, type='get', auth='true') if data == 'trades' or data == 'transactions': if year and month: return rp.Parse(url='/history/' + data + '/' + month + '/' + year, type='get', auth='true') elif year: return rp.Parse(url='/history/' + data + '/' + year, type='get', auth='true') elif not year and not month: return rp.Parse(url='/history/' + data, type='get', auth='true') else: self.report.error( content="Missing data type: orders, trades or transactions") pass
def getTime(self): return rp.Parse(url='/time', type='get')
def history(self, market=None): if market: return rp.Parse(url='/orders/' + market + '/history', type='get', auth='true') else: return rp.Parse(url='/orders/history', type='get', auth='true')
def orderList(self, market=None): if market: return rp.Parse(url='/orders/' + market, type='get', auth='true') else: return rp.Parse(url='/orders/', type='get', auth='true')
def addresses(self): return rp.Parse(url='/deposit/address', type='get', auth='true')