Remove more usages of .query
This commit is contained in:
parent
d45599ca3b
commit
8073989c98
@ -819,7 +819,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
|
|
||||||
trade.orders.append(order_obj)
|
trade.orders.append(order_obj)
|
||||||
trade.recalc_trade_from_orders()
|
trade.recalc_trade_from_orders()
|
||||||
Trade.query.session.add(trade)
|
Trade._session.add(trade)
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
|
|
||||||
# Updating wallets
|
# Updating wallets
|
||||||
|
@ -51,8 +51,8 @@ class PairLocks():
|
|||||||
active=True
|
active=True
|
||||||
)
|
)
|
||||||
if PairLocks.use_db:
|
if PairLocks.use_db:
|
||||||
PairLock.query.session.add(lock)
|
PairLock._session.add(lock)
|
||||||
PairLock.query.session.commit()
|
PairLock._session.commit()
|
||||||
else:
|
else:
|
||||||
PairLocks.locks.append(lock)
|
PairLocks.locks.append(lock)
|
||||||
return lock
|
return lock
|
||||||
@ -106,7 +106,7 @@ class PairLocks():
|
|||||||
for lock in locks:
|
for lock in locks:
|
||||||
lock.active = False
|
lock.active = False
|
||||||
if PairLocks.use_db:
|
if PairLocks.use_db:
|
||||||
PairLock.query.session.commit()
|
PairLock._session.commit()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unlock_reason(reason: str, now: Optional[datetime] = None) -> None:
|
def unlock_reason(reason: str, now: Optional[datetime] = None) -> None:
|
||||||
@ -130,7 +130,7 @@ class PairLocks():
|
|||||||
for lock in locks:
|
for lock in locks:
|
||||||
logger.info(f"Releasing lock for {lock.pair} with reason '{reason}'.")
|
logger.info(f"Releasing lock for {lock.pair} with reason '{reason}'.")
|
||||||
lock.active = False
|
lock.active = False
|
||||||
PairLock.query.session.commit()
|
PairLock._session.commit()
|
||||||
else:
|
else:
|
||||||
# used in backtesting mode; don't show log messages for speed
|
# used in backtesting mode; don't show log messages for speed
|
||||||
locksb = PairLocks.get_pair_locks(None)
|
locksb = PairLocks.get_pair_locks(None)
|
||||||
|
@ -347,11 +347,6 @@ class RPC:
|
|||||||
Trade.close_date < (profitday + time_offset(1)))
|
Trade.close_date < (profitday + time_offset(1)))
|
||||||
.order_by(Trade.close_date)
|
.order_by(Trade.close_date)
|
||||||
).all()
|
).all()
|
||||||
# trades = Trade.query.session.query(Trade.close_profit_abs).filter(
|
|
||||||
# Trade.is_open.is_(False),
|
|
||||||
# Trade.close_date >= profitday,
|
|
||||||
# Trade.close_date < (profitday + time_offset(1))
|
|
||||||
# ).order_by(Trade.close_date).all()
|
|
||||||
|
|
||||||
curdayprofit = sum(
|
curdayprofit = sum(
|
||||||
trade.close_profit_abs for trade in trades if trade.close_profit_abs is not None)
|
trade.close_profit_abs for trade in trades if trade.close_profit_abs is not None)
|
||||||
|
Loading…
Reference in New Issue
Block a user