mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-03 10:33:08 +00:00
chore: update patch_exchange to not override builtins
This commit is contained in:
@@ -137,7 +137,7 @@ def generate_trades_history(n_rows, start_date: Optional[datetime] = None, days=
|
||||
random_timestamps_in_seconds = np.random.uniform(_start_timestamp, _end_timestamp, n_rows)
|
||||
timestamp = pd.to_datetime(random_timestamps_in_seconds, unit="s")
|
||||
|
||||
id = [
|
||||
trade_id = [
|
||||
f"a{np.random.randint(1e6, 1e7 - 1)}cd{np.random.randint(100, 999)}" for _ in range(n_rows)
|
||||
]
|
||||
|
||||
@@ -155,7 +155,7 @@ def generate_trades_history(n_rows, start_date: Optional[datetime] = None, days=
|
||||
df = pd.DataFrame(
|
||||
{
|
||||
"timestamp": timestamp,
|
||||
"id": id,
|
||||
"id": trade_id,
|
||||
"type": None,
|
||||
"side": side,
|
||||
"price": price,
|
||||
@@ -236,12 +236,12 @@ def patched_configuration_load_config_file(mocker, config) -> None:
|
||||
|
||||
|
||||
def patch_exchange(
|
||||
mocker, api_mock=None, id="binance", mock_markets=True, mock_supported_modes=True
|
||||
mocker, api_mock=None, exchange="binance", mock_markets=True, mock_supported_modes=True
|
||||
) -> None:
|
||||
mocker.patch(f"{EXMS}.validate_config", MagicMock())
|
||||
mocker.patch(f"{EXMS}.validate_timeframes", MagicMock())
|
||||
mocker.patch(f"{EXMS}.id", PropertyMock(return_value=id))
|
||||
mocker.patch(f"{EXMS}.name", PropertyMock(return_value=id.title()))
|
||||
mocker.patch(f"{EXMS}.id", PropertyMock(return_value=exchange))
|
||||
mocker.patch(f"{EXMS}.name", PropertyMock(return_value=exchange.title()))
|
||||
mocker.patch(f"{EXMS}.precisionMode", PropertyMock(return_value=2))
|
||||
# Temporary patch ...
|
||||
mocker.patch("freqtrade.exchange.bybit.Bybit.cache_leverage_tiers")
|
||||
@@ -254,7 +254,8 @@ def patch_exchange(
|
||||
|
||||
if mock_supported_modes:
|
||||
mocker.patch(
|
||||
f"freqtrade.exchange.{id}.{id.capitalize()}._supported_trading_mode_margin_pairs",
|
||||
f"freqtrade.exchange.{exchange}.{exchange.capitalize()}"
|
||||
"._supported_trading_mode_margin_pairs",
|
||||
PropertyMock(
|
||||
return_value=[
|
||||
(TradingMode.MARGIN, MarginMode.CROSS),
|
||||
|
||||
Reference in New Issue
Block a user