mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
reduce arrow in tests
This commit is contained in:
parent
d131dd4050
commit
29fdcdbf56
|
@ -23,6 +23,8 @@ from freqtrade.exchange.exchange import timeframe_to_minutes
|
|||
from freqtrade.freqtradebot import FreqtradeBot
|
||||
from freqtrade.persistence import LocalTrade, Order, Trade, init_db
|
||||
from freqtrade.resolvers import ExchangeResolver
|
||||
from freqtrade.util import dt_ts
|
||||
from freqtrade.util.datetime_helpers import dt_now
|
||||
from freqtrade.worker import Worker
|
||||
from tests.conftest_trades import (leverage_trade, mock_trade_1, mock_trade_2, mock_trade_3,
|
||||
mock_trade_4, mock_trade_5, mock_trade_6, short_trade)
|
||||
|
@ -1663,8 +1665,8 @@ def limit_buy_order_open():
|
|||
'type': 'limit',
|
||||
'side': 'buy',
|
||||
'symbol': 'mocked',
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'datetime': dt_now().isoformat(),
|
||||
'price': 0.00001099,
|
||||
'average': 0.00001099,
|
||||
'amount': 90.99181073,
|
||||
|
@ -1823,8 +1825,8 @@ def limit_sell_order_open():
|
|||
'type': 'limit',
|
||||
'side': 'sell',
|
||||
'symbol': 'mocked',
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': dt_now().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'price': 0.00001173,
|
||||
'amount': 90.99181073,
|
||||
'filled': 0.0,
|
||||
|
@ -2838,8 +2840,8 @@ def limit_buy_order_usdt_open():
|
|||
'type': 'limit',
|
||||
'side': 'buy',
|
||||
'symbol': 'mocked',
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': dt_now().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'price': 2.00,
|
||||
'average': 2.00,
|
||||
'amount': 30.0,
|
||||
|
@ -2866,8 +2868,8 @@ def limit_sell_order_usdt_open():
|
|||
'type': 'limit',
|
||||
'side': 'sell',
|
||||
'symbol': 'mocked',
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': dt_now().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'price': 2.20,
|
||||
'amount': 30.0,
|
||||
'cost': 66.0,
|
||||
|
@ -2893,8 +2895,8 @@ def market_buy_order_usdt():
|
|||
'type': 'market',
|
||||
'side': 'buy',
|
||||
'symbol': 'mocked',
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'datetime': dt_now().isoformat(),
|
||||
'price': 2.00,
|
||||
'amount': 30.0,
|
||||
'filled': 30.0,
|
||||
|
@ -2950,8 +2952,8 @@ def market_sell_order_usdt():
|
|||
'type': 'market',
|
||||
'side': 'sell',
|
||||
'symbol': 'mocked',
|
||||
'timestamp': arrow.utcnow().int_timestamp * 1000,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'timestamp': dt_ts(),
|
||||
'datetime': dt_now().isoformat(),
|
||||
'price': 2.20,
|
||||
'amount': 30.0,
|
||||
'filled': 30.0,
|
||||
|
|
|
@ -14,6 +14,7 @@ from freqtrade.data.converter import ohlcv_to_dataframe
|
|||
from freqtrade.edge import Edge, PairInfo
|
||||
from freqtrade.enums import ExitType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.util.datetime_helpers import dt_ts
|
||||
from tests.conftest import EXMS, get_patched_freqtradebot, log_has
|
||||
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
||||
_get_frame_time_from_offset)
|
||||
|
@ -220,7 +221,7 @@ def test_edge_heartbeat_calculate(mocker, edge_conf):
|
|||
heartbeat = edge_conf['edge']['process_throttle_secs']
|
||||
|
||||
# should not recalculate if heartbeat not reached
|
||||
edge._last_updated = arrow.utcnow().int_timestamp - heartbeat + 1
|
||||
edge._last_updated = dt_ts() - heartbeat + 1
|
||||
|
||||
assert edge.calculate(edge_conf['exchange']['pair_whitelist']) is False
|
||||
|
||||
|
@ -268,7 +269,7 @@ def test_edge_process_downloaded_data(mocker, edge_conf):
|
|||
|
||||
assert edge.calculate(edge_conf['exchange']['pair_whitelist'])
|
||||
assert len(edge._cached_pairs) == 2
|
||||
assert edge._last_updated <= arrow.utcnow().int_timestamp + 2
|
||||
assert edge._last_updated <= dt_ts() + 2
|
||||
|
||||
|
||||
def test_edge_process_no_data(mocker, edge_conf, caplog):
|
||||
|
|
|
@ -25,6 +25,7 @@ from freqtrade.optimize.optimize_reports import (_get_resample_from_period, gene
|
|||
store_backtest_stats, text_table_bt_results,
|
||||
text_table_exit_reason, text_table_strategy)
|
||||
from freqtrade.resolvers.strategy_resolver import StrategyResolver
|
||||
from freqtrade.util import dt_ts
|
||||
from tests.conftest import CURRENT_TEST_STRATEGY
|
||||
from tests.data.test_history import _clean_test_file
|
||||
|
||||
|
@ -106,8 +107,8 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmpdir):
|
|||
'canceled_trade_entries': 0,
|
||||
'canceled_entry_orders': 0,
|
||||
'replaced_entry_orders': 0,
|
||||
'backtest_start_time': Arrow.utcnow().int_timestamp,
|
||||
'backtest_end_time': Arrow.utcnow().int_timestamp,
|
||||
'backtest_start_time': dt_ts() // 1000,
|
||||
'backtest_end_time': dt_ts() // 1000,
|
||||
'run_id': '123',
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +162,8 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmpdir):
|
|||
'canceled_trade_entries': 0,
|
||||
'canceled_entry_orders': 0,
|
||||
'replaced_entry_orders': 0,
|
||||
'backtest_start_time': Arrow.utcnow().int_timestamp,
|
||||
'backtest_end_time': Arrow.utcnow().int_timestamp,
|
||||
'backtest_start_time': dt_ts() // 1000,
|
||||
'backtest_end_time': dt_ts() // 1000,
|
||||
'run_id': '124',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6003,7 +6003,7 @@ def test_position_adjust(mocker, default_conf_usdt, fee) -> None:
|
|||
'ft_is_open': False,
|
||||
'id': '651',
|
||||
'order_id': '651',
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'datetime': dt_now().isoformat(),
|
||||
}
|
||||
|
||||
mocker.patch(f'{EXMS}.create_order', MagicMock(return_value=closed_dca_order_1))
|
||||
|
|
Loading…
Reference in New Issue
Block a user