Ejemplo n.º 1
0
    def btce(self):
        btce = BTCE()
        btce.get_ticker()
        if btce.error:
            return self.response_txt(btce.error)

        usd_cny_currency = get_usd_cny_currency()

        content = u"""BTC-E比特币实时行情
---------------
最新成交价:$%.2f,合¥%.2f
日交量:%.4f BTC
最高成交价:$%.2f,合¥%.2f
最低成交价:$%.2f,合¥%.2f
最新买入价:$%.2f,合¥%.2f
最新卖出价:$%.2f,合¥%.2f""" % (
            btce.last_all,
            btce.last_all * usd_cny_currency,
            btce.volume,
            btce.high,
            btce.high * usd_cny_currency,
            btce.low,
            btce.low * usd_cny_currency,
            btce.last_buy,
            btce.last_buy * usd_cny_currency,
            btce.last_sell,
            btce.last_sell * usd_cny_currency,
        )
        return self.response_txt(content)
Ejemplo n.º 2
0
    def btce(self):
        btce = BTCE()
        btce.get_ticker()
        if btce.error:
            return self.response_txt(btce.error)

        usd_cny_currency = get_usd_cny_currency()

        content = u"""BTC-E比特币实时行情
---------------
最新成交价:$%.2f,合¥%.2f
日交量:%.4f BTC
最高成交价:$%.2f,合¥%.2f
最低成交价:$%.2f,合¥%.2f
最新买入价:$%.2f,合¥%.2f
最新卖出价:$%.2f,合¥%.2f""" %\
            (btce.last_all,
             btce.last_all * usd_cny_currency,
             btce.volume,
             btce.high,
             btce.high * usd_cny_currency,
             btce.low,
             btce.low * usd_cny_currency,
             btce.last_buy,
             btce.last_buy * usd_cny_currency,
             btce.last_sell,
             btce.last_sell * usd_cny_currency)
        return self.response_txt(content)
Ejemplo n.º 3
0
    def btc(self):
        mt_usd = Mtgox(currency='USD')
        #mt_cny = Mtgox(currency='CNY')
        btce = BTCE()
        btcc = BTCChina()
        fxbtc = Fxbtc()
        cn42btc = CN42BTC()
        list_instance = [mt_usd, btce, btcc, fxbtc, cn42btc]

        list_thread = []
        for instance in list_instance:
            t = FetcherThread(instance)
            list_thread.append(t)
            t.daemon = True
            t.start()

        # wait for all thread finish
        for t in list_thread:
            t.join()

        for instance in list_instance:
            if instance.error:
                instance = None

        usd_cny_currency = get_usd_cny_currency()

        content = u"""比特币实时行情汇总
----------------
Mtgox价格:$%.2f,合¥%.2f
MtGox日交量:%s

BTC-E价格:$%.2f,合¥%.2f
BTC-E日交量:%.4f BTC

BTCChina价格:¥%.2f
BTCChina日交量:%.4f BTC

FXBTC价格:¥%.2f
FXBTC日交量:%.4f BTC

42BTC价格:¥%.2f
42BTC日交量:%.4f BTC
""" %\
            (0 if mt_usd is None else mt_usd.last_all,
             mt_usd.last_all * usd_cny_currency,
             0 if mt_usd is None else mt_usd.volume,
             0 if btce is None else btce.last_all,
             btce.last_all * usd_cny_currency,
             0 if btce is None else btce.volume,
             0 if btcc is None else btcc.last_all,
             0 if btcc is None else btcc.volume,
             0 if fxbtc is None else fxbtc.last_all,
             0 if fxbtc is None else fxbtc.volume,
             0 if cn42btc is None else cn42btc.last_all,
             0 if cn42btc is None else cn42btc.volume)

        return self.response_txt(content)
Ejemplo n.º 4
0
    def btce(self):
        btce = BTCE()
        btce.get_ticker()
        if btce.error:
            return self.response_txt(btce.error)

        print "***btce****"
        print btce.error
        print "***btce***"
        content = u"""BTC-E比特币实时行情
---------------
最新成交价:$%.2f
日交量:%.4f BTC
最高成交价:$%.2f
最低成交价:$%.2f
最新买入价:$%.2f
最新卖出价:$%.2f""" %\
            (btce.last_all, btce.volume, btce.high,
                btce.low, btce.last_buy, btce.last_sell)
        return self.response_txt(content)
Ejemplo n.º 5
0
    def ltc(self):
        btce_ltcusd = BTCE(coin='ltc_usd')
        btce_ltcbtc = BTCE(coin='ltc_btc')
        fx_ltccny = Fxbtc(coin='ltc_cny')
        fx_ltcbtc = Fxbtc(coin='ltc_btc')
        list_instance = [btce_ltcusd, btce_ltcbtc, fx_ltccny, fx_ltcbtc]

        list_thread = []
        for instance in list_instance:
            t = FetcherThread(instance)
            list_thread.append(t)
            t.daemon = True
            t.start()

        # wait for all thread finish
        for t in list_thread:
            t.join()

        for instance in list_instance:
            if instance.error:
                instance = None

        usd_cny_currency = get_usd_cny_currency()

        content = u"""利特币实时行情汇总
-----------------
BTC-E价格1:$%.2f,合¥%.2f
BTC-E价格2:%.4f BTC
BTC-E日交量:%.2f LTC

FXBTC价格1:¥%.2f
FXBTC价格2:%.4f BTC
FXBTC日交量:%.2f LTC""" %\
            (0 if btce_ltcusd is None else btce_ltcusd.last_all,
             btce_ltcusd.last_all * usd_cny_currency,
             0 if btce_ltcbtc is None else btce_ltcbtc.last_all,
             0 if (btce_ltcusd and btce_ltcbtc) is None else btce_ltcusd.volume + btce_ltcbtc.volume,
             0 if fx_ltccny is None else fx_ltccny.last_all,
             0 if fx_ltcbtc is None else btce_ltcbtc.last_all,
             0 if (fx_ltccny and fx_ltcbtc) is None else fx_ltccny.volume + fx_ltcbtc.volume)
        return self.response_txt(content)