Ejemplo n.º 1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import time, urllib, csv, re, time, sys, math
from operator import  itemgetter
import MySQLdb as mdb
import math as math
import numpy as np

lib_path = os.path.abspath('/secure/conf')
import ccoin_conf as cconf

try:
    cconf.__sec_initialize(token="diplo-demo")   
    con = mdb.connect(cconf.host, cconf.user, cconf.pass, cconf.db)    
    
    con.autocommit(True)
            
    cur = con.cursor()
    cur.execute("SELECT VERSION()")

    ver = cur.fetchone()

except mdb.Error, e:

    print "Error %d: %s" % (e.args[0], e.args[1])
    emergency_email_warning("MYSQL connection error! Error: %d, %s" % (e.args[0], e.args[1]))
    sys.exit(1)

debug_mode = 0
Ejemplo n.º 2
0
try:
   _d = date.today();
   _now = datetime.datetime.now().time()
   _day = datetime.datetime(_d.year, _d.month, _d.day, _now.hour, _now.minute, _now.second);
   _tsday = (_day.strftime("%s"));
   _ts_1h = ((_day - timedelta(minutes=60)).strftime("%s"));
   _ts_3h = ((_day - timedelta(hours=3)).strftime("%s"));
   _ts_12h = ((_day - timedelta(hours=12)).strftime("%s"));
   _ts_1d = ((_day - timedelta(days=1)).strftime("%s"));
   _ts_3d = ((_day - timedelta(days=3)).strftime("%s"));
   _ts_1w = ((_day - timedelta(days=7)).strftime("%s"));
   _ts_1m = ((_day - timedelta(days=30)).strftime("%s"));
   _ts_3m = ((_day - timedelta(days=90)).strftime("%s"));

               
   cconf.__sec_initialize(token="WHALECAT-demo")
   con = mdb.connect(cconf.host, cconf.user, cconf.pass, cconf.db)
   con.autocommit(False);
   cur = con.cursor()
   cur.execute("SELECT VERSION()")
   ver = cur.fetchone()

   cur.execute('SELECT id,addr from whales where valid=1 order by balance desc')
   a = cur.fetchall();
   _1m_b_chg = 0;
   
   _whale_stat_volumen_change = [0,0,0,0,0,0,0,0,0,0];
   _whale_stat_change = [0,0,0,0,0,0,0,0,0,0];
   _num_of_wiped_whales = 0;
   _max_volumen_of_wiped_whales = 0;
   _num_real_whales = 0;