def __init__(self, db: SalesmanDatabase, master_id='', and_clause=''): clauses = [] if master_id != '': clauses.append("{}='{}'".format(SLDC.MASTER_ID, master_id)) if and_clause != '': clauses.append(and_clause) where_clause = '' if len(clauses) == 0 else 'WHERE {}'.format( ' AND '.join(clauses)) self.statement = "SELECT * from {}{}".format(SMTBL.SALE, where_clause) DatabaseDataFrame.__init__(self, db, self.statement)
def __init__(self, db: StockDatabase, symbol='', and_clause='', period=PRD.DAILY, aggregation=1): self.symbol = symbol self.statement = "SELECT * from {} WHERE Symbol = '{}' and Period = '{}' and Aggregation = {}".format( STBL.STOCKS, symbol, period, aggregation) if and_clause != '': self.statement += ' and ' + and_clause DatabaseDataFrame.__init__(self, db, self.statement) if self.df.shape[0] == 0: self.df_data = None else: self.df.set_index(CN.TIMESTAMP, drop=False, inplace=True) self.column_data = [CN.CLOSE] self.df_data = self.df[[ CN.OPEN, CN.HIGH, CN.LOW, CN.CLOSE, CN.VOL, CN.TIMESTAMP, CN.BIG_MOVE, CN.DIRECTION ]]
def __init__(self, db: SalesmanDatabase, offer_id_master: str): self.offer_id_master = offer_id_master self.statement = "SELECT * from {} WHERE {} = '{}'".format(SMVW.V_SALE, SLDC.MASTER_ID, offer_id_master) DatabaseDataFrame.__init__(self, db, self.statement) if self.df.shape[0] == 0: self.df_data = None