'Get the latest data and updates the states.'

def update(self):

    self.data.update()
    stats = self.data.stats
    ticker = self.data.ticker
    if (self.type == 'exchangerate'):
        self._state = ticker[self._currency].p15min
        self._unit_of_measurement = self._currency
    elif (self.type == 'trade_volume_btc'):
        self._state = '{0:.1f}'.format(stats.trade_volume_btc)
    elif (self.type == 'miners_revenue_usd'):
        self._state = '{0:.0f}'.format(stats.miners_revenue_usd)
    elif (self.type == 'btc_mined'):
        self._state = '{}'.format((stats.btc_mined * 1e-08))
    elif (self.type == 'trade_volume_usd'):
        self._state = '{0:.1f}'.format(stats.trade_volume_usd)
    elif (self.type == 'difficulty'):
        self._state = '{0:.0f}'.format(stats.difficulty)
    elif (self.type == 'minutes_between_blocks'):
        self._state = '{0:.2f}'.format(stats.minutes_between_blocks)
    elif (self.type == 'number_of_transactions'):
        self._state = '{}'.format(stats.number_of_transactions)
    elif (self.type == 'hash_rate'):
        self._state = '{0:.1f}'.format((stats.hash_rate * 1e-06))
    elif (self.type == 'timestamp'):
        self._state = stats.timestamp
    elif (self.type == 'mined_blocks'):
        self._state = '{}'.format(stats.mined_blocks)
    elif (self.type == 'blocks_size'):
        self._state = '{0:.1f}'.format(stats.blocks_size)
    elif (self.type == 'total_fees_btc'):
        self._state = '{0:.2f}'.format((stats.total_fees_btc * 1e-08))
    elif (self.type == 'total_btc_sent'):
        self._state = '{0:.2f}'.format((stats.total_btc_sent * 1e-08))
    elif (self.type == 'estimated_btc_sent'):
        self._state = '{0:.2f}'.format((stats.estimated_btc_sent * 1e-08))
    elif (self.type == 'total_btc'):
        self._state = '{0:.2f}'.format((stats.total_btc * 1e-08))
    elif (self.type == 'total_blocks'):
        self._state = '{0:.2f}'.format(stats.total_blocks)
    elif (self.type == 'next_retarget'):
        self._state = '{0:.2f}'.format(stats.next_retarget)
    elif (self.type == 'estimated_transaction_volume_usd'):
        self._state = '{0:.2f}'.format(stats.estimated_transaction_volume_usd)
    elif (self.type == 'miners_revenue_btc'):
        self._state = '{0:.1f}'.format((stats.miners_revenue_btc * 1e-08))
    elif (self.type == 'market_price_usd'):
        self._state = '{0:.2f}'.format(stats.market_price_usd)
