def test_rpc_delete_lock(mocker, default_conf): freqtradebot = get_patched_freqtradebot(mocker, default_conf) rpc = RPC(freqtradebot) pair = 'ETH/BTC' PairLocks.lock_pair(pair, datetime.now(timezone.utc) + timedelta(minutes=4)) PairLocks.lock_pair(pair, datetime.now(timezone.utc) + timedelta(minutes=5)) PairLocks.lock_pair(pair, datetime.now(timezone.utc) + timedelta(minutes=10)) locks = rpc._rpc_locks() assert locks['lock_count'] == 3 locks1 = rpc._rpc_delete_lock(lockid=locks['locks'][0]['id']) assert locks1['lock_count'] == 2 locks2 = rpc._rpc_delete_lock(pair=pair) assert locks2['lock_count'] == 0
def delete_lock_pair(payload: DeleteLockRequest, rpc: RPC = Depends(get_rpc)): return rpc._rpc_delete_lock(lockid=payload.lockid, pair=payload.pair)
def delete_lock(lockid: int, rpc: RPC = Depends(get_rpc)): return rpc._rpc_delete_lock(lockid=lockid)