Exemplo n.º 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']
Exemplo n.º 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']
Exemplo n.º 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']
Exemplo n.º 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']
Exemplo n.º 5
0
 def averageUSD(self):
     return safe_get([self.LAST.format('USD')], None)
Exemplo n.º 6
0
 def totalBCs(self):
     return safe_get([self.TOTAL_BCS], None)
Exemplo n.º 7
0
 def averageUSD(self):
     return safe_get([self.LAST.format('USD')], None)
Exemplo n.º 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)
Exemplo n.º 9
0
 def latestHash(self):
     return safe_get([self.LASH_HASH], None)
Exemplo n.º 10
0
 def blockHash(self, block):
     return safe_get([self.BLOCK_HASH.format(block)], None)
Exemplo n.º 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']
Exemplo n.º 12
0
 def latestHash(self):
     return safe_get([self.LASH_HASH], None)
Exemplo n.º 13
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         return int(last)
Exemplo n.º 14
0
 def blockHash(self, block):
     return safe_get([self.BLOCK_HASH.format(block)], None)
Exemplo n.º 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']
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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'))
Exemplo n.º 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']
Exemplo n.º 23
0
 def currentBlock(self):
     last = safe_get([self.LAST_BLOCK], None)
     if not last is None:
         return int(last)
Exemplo n.º 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']
Exemplo n.º 25
0
 def totalBCs(self):
     return safe_get([self.TOTAL_BCS], None)
Exemplo n.º 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']
Exemplo n.º 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']
Exemplo n.º 28
0
 def average(self, currency):
     return safe_get([self.LAST.format(currency)], None)
Exemplo n.º 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'))
Exemplo n.º 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']
Exemplo n.º 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']
Exemplo n.º 32
0
 def average(self, currency):
     return safe_get([self.LAST.format(currency)], None)