From 0691bbaad9aeda6fdcc1ec9a9c75edf358974931 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 19 Feb 2023 20:18:46 +0100 Subject: [PATCH] Update some db types --- freqtrade/persistence/trade_model.py | 2 +- tests/persistence/test_migrations.py | 2 +- tests/persistence/test_persistence.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 4b7a09cbe..abb989940 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -1196,7 +1196,7 @@ class Trade(ModelBase, LocalTrade): fee_close_cost: Mapped[Optional[float]] = mapped_column(Float(), nullable=True) fee_close_currency: Mapped[Optional[str]] = mapped_column(String(25), nullable=True) open_rate: Mapped[float] = mapped_column(Float()) - open_rate_requested: Mapped[float] = mapped_column(Float()) + open_rate_requested: Mapped[float] = mapped_column(Float(), nullable=True) # open_trade_value - calculated via _calc_open_trade_value open_trade_value = mapped_column(Float()) close_rate: Mapped[Optional[float]] = mapped_column(Float()) diff --git a/tests/persistence/test_migrations.py b/tests/persistence/test_migrations.py index d49b7d207..5254164c1 100644 --- a/tests/persistence/test_migrations.py +++ b/tests/persistence/test_migrations.py @@ -21,7 +21,7 @@ spot, margin, futures = TradingMode.SPOT, TradingMode.MARGIN, TradingMode.FUTURE def test_init_create_session(default_conf): # Check if init create a session init_db(default_conf['db_url']) - assert hasattr(Trade, '_session') + assert hasattr(Trade, 'session') assert 'scoped_session' in type(Trade.session).__name__ diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index d06f05179..6d907ccf0 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -2440,6 +2440,7 @@ def test_select_filled_orders(fee): def test_order_to_ccxt(limit_buy_order_open): order = Order.parse_from_ccxt_object(limit_buy_order_open, 'mocked', 'buy') + order.ft_trade_id = 1 order.query.session.add(order) Order.query.session.commit()