示例#1
0
 def blockTS(self, block):
     '''
     Returns the timestamp for a particular block.
     '''
     block = safe_get([self.BLOCK_INFO.format(block)], None)
     if block:
         return json.loads(block)['time']
示例#2
0
 def blockTS(self, block):
     '''
     Returns the timestamp for a particular block.
     '''
     block = safe_get([self.BLOCK_INFO.format(block)], None)
     if block:
         return json.loads(block)['time']
示例#3
0
    def balance(self, addr, min_confirms):
        bal_url = self.BALANCE.format(addr, min_confirms)
        bal_url += '&amount_format=float'

        bal = safe_get([bal_url], None)
        if not bal is None:
            balj = json.loads(bal)
            return balj['data']['balance']
示例#4
0
    def balance(self, addr, min_confirms):
        bal_url = self.BALANCE.format(addr, min_confirms)
        bal_url += '&amount_format=float'

        bal = safe_get([bal_url], None)
        if not bal is None:
            balj = json.loads(bal)
            return balj['data']['balance']
示例#5
0
 def averageUSD(self):
     return safe_get([self.LAST.format('USD')], None)
示例#6
0
 def totalBCs(self):
     return safe_get([self.TOTAL_BCS], None)
示例#7
0
 def averageUSD(self):
     return safe_get([self.LAST.format('USD')], None)
示例#8
0
 def averageUSD(self):
     avg = safe_get([self.AVG_RATE], None)
     if not avg is None:
         rates = json.loads(avg)['data'][0]['rates']
         usd = 1.0 / float(rates['BTC'])
         return round(usd, 2)
示例#9
0
 def latestHash(self):
     return safe_get([self.LASH_HASH], None)
示例#10
0
 def blockHash(self, block):
     return safe_get([self.BLOCK_HASH.format(block)], None)
示例#11
0
 def blockHash(self, block):
     info = safe_get([self.BLOCK_INFO.format(block)], None)
     if not info is None:
         return json.loads(info)['hash']
示例#12
0
 def latestHash(self):
     return safe_get([self.LASH_HASH], None)
示例#13
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         return int(last)
示例#14
0
 def blockHash(self, block):
     return safe_get([self.BLOCK_HASH.format(block)], None)
示例#15
0
 def blockHash(self, block):
     info = safe_get([self.BLOCK_INFO.format(block)], None)
     if not info is None:
         return json.loads(info)['hash']
示例#16
0
 def balance(self, addr, min_confirms):
     bal = safe_get([self.ADDR_BAL.format(addr, min_confirms)], None)
     if not bal is None:
         return round(float(bal) / 1.e8, 8)
示例#17
0
 def saveAll(self):
     self.all = safe_get([self.ALL], None)
     if self.all is not None:
         self.all = json.loads(self.all)
     return self.all is not None
示例#18
0
 def saveAll(self):
     self.all = safe_get([self.ALL], None)
     if self.all is not None:
         self.all = json.loads(self.all)
     return self.all is not None
示例#19
0
 def balance(self, addr, min_confirms):
     bal = safe_get([self.ADDR_BAL.format(addr, min_confirms)], None)
     if not bal is None:
         return round(float(bal) / 1.e8, 8)
示例#20
0
 def averageUSD(self):
     avg = safe_get([self.AVG_RATE], None)
     if not avg is None:
         rates = json.loads(avg)['data'][0]['rates']
         usd = 1.0 / float(rates['BTC'])
         return round(usd, 2)
示例#21
0
 def blockTS(self, block):
     block = safe_get([self.BLOCK_INFO.format(block)], None)
     if block:
         tss = json.loads(block)['data']['time_utc']
         return int(parse(tss, tzinfos={'UTC': 0}).strftime('%s'))
示例#22
0
 def blockHash(self, block):
     block_data = safe_get([self.BLOCK_INFO.format(block)], None)
     if not block_data is None:
         block_data = json.loads(block_data)
         if block_data['status'] == 'success':
             return block_data['data']['hash']
示例#23
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         return int(last)
示例#24
0
 def blockHash(self, block):
     block_data = safe_get([self.BLOCK_INFO.format(block)], None)
     if not block_data is None:
         block_data = json.loads(block_data)
         if block_data['status'] == 'success':
             return block_data['data']['hash']
示例#25
0
 def totalBCs(self):
     return safe_get([self.TOTAL_BCS], None)
示例#26
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         lastj = json.loads(last)
         return lastj['data']['nb']
示例#27
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         lastj = json.loads(last)
         return lastj['data']['nb']
示例#28
0
 def average(self, currency):
     return safe_get([self.LAST.format(currency)], None)
示例#29
0
 def blockTS(self, block):
     block = safe_get([self.BLOCK_INFO.format(block)], None)
     if block:
         tss = json.loads(block)['data']['time_utc']
         return int(parse(tss, tzinfos={'UTC': 0}).strftime('%s'))
示例#30
0
 def latestHash(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         lastj = json.loads(last)
         return lastj['data']['hash']
示例#31
0
 def latestHash(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         lastj = json.loads(last)
         return lastj['data']['hash']
示例#32
0
 def average(self, currency):
     return safe_get([self.LAST.format(currency)], None)