Esempio n. 1
0
def checkWallets():
    currBTCPrice = dbMod.getBTCPrice()
    if len(currBTCPrice) > 0:
        for coin, amt in wallets.iteritems():
            coinPrice = dbMod.getCoinPrice(coin)
            if len(coinPrice) != 0:
                thisCoinPrice = coinPrice[0][0]
                btcValue = thisCoinPrice * amt
                usdValue = btcValue * currBTCPrice[0][0]
                #print type(btcValue)
                #print nowTime
                #print type(usdValue)
                dbMod.insertTotBalHist(nowTime, 'WALLET', coin, btcValue,
                                       usdValue)

    totalBTC = dbMod.getTotalBTC()
    decimalTotalBTC = totalBTC[0][0]
    #print type(decimalTotalBTC)
    if len(totalBTC) != 0:
        currBTCPrice = dbMod.getBTCPrice()
        #print currBTCPrice
        usdValue = decimalTotalBTC * currBTCPrice[0][0]
        print "============================================"
        print "You're total BTC holdings: " + str(decimalTotalBTC)
        print
        print "USD equivalent: " + str(usdValue)
        print "BTC/USD: " + str(currBTCPrice[0][0])
        print "============================================"
        dbMod.insertTotBalHist(nowTime, 'TOTAL', 'BTC', decimalTotalBTC,
                               usdValue)
        message = "Total USD value: " + str(usdValue)
        #sendSMS.sendMessage(message)
    else:
        print "Cannot load BTC price from DB."
Esempio n. 2
0
def loadTotalBalHistory():

    activeExchanges = ['POLONIEX', 'BITTREX']

    currBTCPrice = dbMod.getBTCPrice()

    for exchange in activeExchanges:
        totalBTCList = dbMod.getTotalBTCExch(exchange)
        totalBTC = totalBTCList[0][0]
        if totalBTC is not None:
            usdValue = totalBTC * currBTCPrice[0][0]
            dbMod.insertTotBalHist(nowTime, exchange, 'BTC', totalBTC,
                                   usdValue)
Esempio n. 3
0
def loadTotalBalHistory():
    
    activeExchanges = ['POLONIEX','BITTREX','BITFINEX']


    currBTCPrice = dbMod.getBTCPrice()

    for exchange in activeExchanges:
        print "Processing " + exchange
        totalBTCList = dbMod.getTotalBTCExch(exchange)
        print "totalBTCList: "
        print totalBTCList
        totalBTC = totalBTCList[0][0]
        print "Total BTC is: " + str(totalBTC)
        if totalBTC is not None:
            usdValue = totalBTC * currBTCPrice[0][0]
            dbMod.insertTotBalHist(nowTime, exchange, 'BTC', totalBTC, usdValue)