def getCurrency(self, currency): url = self.url + currency iso = "USD" + currency ret = urllib2.urlopen(urllib2.Request(url)) jObj = json.loads(ret.read()) if jObj['success'] == True : print True price = jObj['quotes'][iso] DBRepository.getInstance().updateCurrency("USD", currency, price)
def selectHistory(self, exchange, coin): return DBRepository.getInstance().selectRecentHistory(exchange, coin)
def insertHistory(self, exchange, coin, price, qnty, transaction_date): return DBRepository.getInstance().insertHistory( exchange, coin, price, qnty, transaction_date)
def updatePrice(self, exchange, coin, first_price, last_price): DBRepository.getInstance().updatePrice(exchange, coin, first_price, last_price)
def updateOrderBook(self, exchange, coin, bid, ask): DBRepository.getInstance().updateOrderBook(exchange, coin, bid, ask)