Cleanup some nitpicks
This commit is contained in:
@@ -107,6 +107,7 @@ class CustomDataWrapper:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def delete_custom_data(trade_id: int) -> None:
|
def delete_custom_data(trade_id: int) -> None:
|
||||||
_CustomData.session.query(_CustomData).filter(_CustomData.ft_trade_id == trade_id).delete()
|
_CustomData.session.query(_CustomData).filter(_CustomData.ft_trade_id == trade_id).delete()
|
||||||
|
_CustomData.session.commit()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_custom_data(*, trade_id: int, key: Optional[str] = None) -> List[_CustomData]:
|
def get_custom_data(*, trade_id: int, key: Optional[str] = None) -> List[_CustomData]:
|
||||||
|
|||||||
@@ -343,7 +343,6 @@ class LocalTrade:
|
|||||||
id: int = 0
|
id: int = 0
|
||||||
|
|
||||||
orders: List[Order] = []
|
orders: List[Order] = []
|
||||||
custom_data: List[_CustomData] = []
|
|
||||||
|
|
||||||
exchange: str = ''
|
exchange: str = ''
|
||||||
pair: str = ''
|
pair: str = ''
|
||||||
@@ -1507,7 +1506,7 @@ class Trade(ModelBase, LocalTrade):
|
|||||||
innerjoin=True) # type: ignore
|
innerjoin=True) # type: ignore
|
||||||
custom_data: Mapped[List[_CustomData]] = relationship(
|
custom_data: Mapped[List[_CustomData]] = relationship(
|
||||||
"_CustomData", cascade="all, delete-orphan",
|
"_CustomData", cascade="all, delete-orphan",
|
||||||
lazy="raise") # type: ignore
|
lazy="raise")
|
||||||
|
|
||||||
exchange: Mapped[str] = mapped_column(String(25), nullable=False) # type: ignore
|
exchange: Mapped[str] = mapped_column(String(25), nullable=False) # type: ignore
|
||||||
pair: Mapped[str] = mapped_column(String(25), nullable=False, index=True) # type: ignore
|
pair: Mapped[str] = mapped_column(String(25), nullable=False, index=True) # type: ignore
|
||||||
@@ -1613,7 +1612,6 @@ class Trade(ModelBase, LocalTrade):
|
|||||||
|
|
||||||
CustomDataWrapper.delete_custom_data(trade_id=self.id)
|
CustomDataWrapper.delete_custom_data(trade_id=self.id)
|
||||||
|
|
||||||
_CustomData.session.commit()
|
|
||||||
Trade.session.delete(self)
|
Trade.session.delete(self)
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
|
|
||||||
|
|||||||
@@ -2099,6 +2099,7 @@ def test_Trade_object_idem():
|
|||||||
'get_mix_tag_performance',
|
'get_mix_tag_performance',
|
||||||
'get_trading_volume',
|
'get_trading_volume',
|
||||||
'validate_string_len',
|
'validate_string_len',
|
||||||
|
'custom_data'
|
||||||
)
|
)
|
||||||
EXCLUDES2 = ('trades', 'trades_open', 'bt_trades_open_pp', 'bt_open_open_trade_count',
|
EXCLUDES2 = ('trades', 'trades_open', 'bt_trades_open_pp', 'bt_open_open_trade_count',
|
||||||
'total_profit', 'from_json',)
|
'total_profit', 'from_json',)
|
||||||
|
|||||||
Reference in New Issue
Block a user