def __init__(self): self.host = '' self.dao = dao.DAO() self.port = 12345 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.bind((self.host, self.port)) self.cnt = 0
def __init__(self, args): # Pour l'instant on ne fait que garder les arguments dans une variable self.arguments = args # Un dictionnaire de fonctions self.fonctions = {"entrainement":self.__entrainement, "recherche":self.__recherche, "reinitialiser":self.__reinitialiser} # Le DAO est utilise peu importe la fonctionalite en ce moment, on peut le laisser ici self.dao = d.DAO() self.dao.connecter_dao() self.dict_mots_bd = {} self.dict_coocs_bd = {} self.liste_nouv_mots = [] self.liste_nouv_coocs = [] self.liste_nouv_freqs = []
def diversity_payment(find_v, self, tree): db = dao.DAO() diversity_payment.DiversityPayment(find_v, making_payment, db, self, tree)
def receipt(find_v, number): db = dao.DAO() receipt.ChoiceReceipt(db, find_v, number)
def update_electric(find_v, number, self, tree): db = dao.DAO() update_electric.UpdateElectric(find_v, number, db, self, tree)
def update(find_v, number, self, tree): db = dao.DAO() update_payment.UpdatePayment(find_v, number, db, self, tree)
import dao class OwnersMenuActions: @staticmethod def open_add_owner(window, tree): add_owner.AddOwner(db, window, tree) @staticmethod def open_add_payment(): add_payment.AddPay(db, calculation) @staticmethod def open_find_payment(): find_payment.FindPayments(db) @staticmethod def open_update(owner_id, window, tree): update_owner.UpdateOwner(db, owner_id, window, tree) if __name__ == "__main__": root = tk.Tk() db = dao.DAO() app = owners.Owners(root, OwnersMenuActions(), db) app.pack() root.title("Clever SNT") root.geometry("1050x650+0+0") root.mainloop()
snapshot_epoch = time.time() logging.info("Processing raw orderbook for snapshot_epoch %d", snapshot_epoch) columns = [] for ask in res["asks"]: price = float(ask[0]) volume = float(ask[1]) order_epoch = ask[2] columns.append( [pair, price, volume, True, order_epoch, snapshot_epoch]) for bid in res["bids"]: price = float(bid[0]) volume = float(bid[1]) order_epoch = bid[2] columns.append( [pair, price, volume, False, order_epoch, snapshot_epoch]) return columns if __name__ == "__main__": api = kraken.API() dao = dao.DAO() pairs = [pr.PAIR_XBT_USD, pr.PAIR_ETH_USD] while True: for pair in pairs: res = api.get_orderbook(pair) columns = process_raw_orderbook(pair, res) dao.bulk_insert_raw_orderbook(columns)