def deleteportfolio(symbol, chatid): logger.info('Deleting portfolio... ' + symbol) rowcount = Calls.delete().where((Calls.sym == symbol) & ( Calls.chatid == chatid) & (Calls.type == PORTFOLIO_TYPE)).execute() return rowcount
def deletewatchlist(symbol, chatid): logger.info('Deleting watchlist... ' + symbol) rowcount = Calls.delete().where((Calls.sym == symbol) & (Calls.chatid == chatid) & (Calls.type == WATCH_TYPE)).execute() return rowcount
def deletecall(symbol, userid, chatid): logger.info('Deleting call... ' + symbol) rowcount = Calls.delete().where((Calls.sym == symbol) & (Calls.chatid == chatid)).execute() return rowcount
def deleteoldwatchlist(): calls = Calls.select(Calls.time).where(Calls.type == WATCH_TYPE).order_by( Calls.time.desc()).limit(LIMIT) Calls.delete().where((Calls.type == WATCH_TYPE) & (Calls.time.not_in(calls))).execute()
def deletependingportfolio(chatid): Calls.delete().where((Calls.chatid == str(chatid)) & (Calls.qty == 0)).execute()
def deleteoldcalls(): calls = Calls.select(Calls.time).where( (Calls.type.not_in([WATCH_TYPE, PORTFOLIO_TYPE ]))).order_by(Calls.time.desc()).limit(LIMIT) Calls.delete().where((Calls.type.not_in([WATCH_TYPE, PORTFOLIO_TYPE])) & (Calls.time.not_in(calls))).execute()