Beispiel #1
0
def update_valuebook():
    printmsg("updating valuebook")
    global valuebook
    vbook = getValueBook()
    if len(vbook) > 0:
        for v in vbook:
            name = v[0]
            p1 = v[1]
            pid1 = int(v[2])
            p2 = v[3]
            pid2 = int(v[4])
            rate = v[5]
            time = str(v[6])
            source = v[7]
            if p1 == 'Bitcoin' and p2 == 'Omni':
                if pid2 == 1:
                    symbol = "OMNI"
                else:
                    symbol = "SP" + str(pid2)
            elif p1 == 'Fiat' and p2 == 'Bitcoin':
                symbol = "BTC"
                if pid1 > 0 or pid2 > 0:
                    symbol = symbol + str(name)
            else:
                symbol = name + str(pid2)
            valuebook[symbol] = {
                "price": rate,
                "symbol": symbol,
                "timestamp": time,
                "source": source
            }
Beispiel #2
0
def update_valuebook():
  global valuebook
  try:
    pmaxid=0
    while True:
      time.sleep(30)
      printmsg("updating valuebook")
      vbook,maxid=getValueBook(pmaxid)
      if len(vbook)>0:
        pmaxid=maxid
        for v in vbook:
          name=v[0]
          p1=v[1]
          pid1=int(v[2])
          p2=v[3]
          pid2=int(v[4])
          rate=v[5]
          tstamp=str(v[6])
          source=v[7]
          if p1=='Bitcoin' and p2=='Omni':
            if pid2==1:
              symbol="OMNI"
            else:
              symbol="SP"+str(pid2)
          elif p1=='Fiat' and p2=='Bitcoin':
            symbol="BTC"
            if pid1>0 or pid2>0:
              symbol=symbol+str(name)
          else:
            symbol=name+str(pid2)
          valuebook[symbol]={"price":rate,"symbol":symbol,"timestamp":tstamp, "source":source}
  except Exception as e:
    printmsg("error updating valuebook: "+str(e))
Beispiel #3
0
def update_valuebook():
  global valuebook
  try:
    pmaxid=0
    while True:
      time.sleep(30)
      printmsg("updating valuebook")
      vbook,maxid=getValueBook(pmaxid)
      if len(vbook)>0:
        pmaxid=maxid
        for v in vbook:
          name=v[0]
          p1=v[1]
          pid1=int(v[2])
          p2=v[3]
          pid2=int(v[4])
          rate=v[5]
          tstamp=str(v[6])
          source=v[7]
          if p1=='Bitcoin' and p2=='Omni':
            if pid2==1:
              symbol="OMNI"
            else:
              symbol="SP"+str(pid2)
          elif p1=='Fiat' and p2=='Bitcoin':
            symbol="BTC"
            if pid1>0 or pid2>0:
              symbol=symbol+str(name)
          else:
            symbol=name+str(pid2)
          valuebook[symbol]={"price":rate,"symbol":symbol,"timestamp":tstamp, "source":source}
  except Exception as e:
    printmsg("error updating valuebook: "+str(e))