1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import db
class Pool:
def __init__(self): self.db = db
def add_pool_data(self, pool_name: str, block_coin: str, coin_reward: str, theory_reward: str, block_time: str, pool_power: str, pool_scale: str, diff_24h: str, lucky_3d: str): sql = "insert into t_pool_data(`pool_name`,`block_coin`,`coin_reward`,`theory_reward`,`block_time`,`pool_power`,`pool_scale`,`diff_24h`,`lucky_3d`) values (%s,%s,%s,%s,%s,%s,%s,%s,%s);" return self.db.insert_one(sql, [pool_name, block_coin, coin_reward, theory_reward, block_time, pool_power, pool_scale, diff_24h, lucky_3d])
def get_by_pool_coin_time(self, pool_name: str, block_coin: str, start_time: str, end_time: str): sql = "select pool_name,coin_reward,theory_reward,block_time,pool_power,pool_scale,diff_24h,lucky_3d from t_pool_data where pool_name = %s and block_coin = %s and block_time >= %s and block_time <= %s;" return self.db.get_all(sql, [pool_name, block_coin, start_time, end_time])
def get_by_time(self, coin_type, block_time): sql = "select count(*) from t_pool_data where block_coin = %s and block_time = %s;" ret = self.db.get_one(sql, [coin_type, block_time]) return ret[0]
|