Pairlock to mappedColumn
This commit is contained in:
parent
39a658eac2
commit
0bd9b00132
@ -1,8 +1,8 @@
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from sqlalchemy import Boolean, Column, DateTime, Integer, String, or_
|
from sqlalchemy import Boolean, DateTime, Integer, String, or_
|
||||||
from sqlalchemy.orm import Query
|
from sqlalchemy.orm import Query, mapped_column
|
||||||
|
|
||||||
from freqtrade.constants import DATETIME_PRINT_FORMAT
|
from freqtrade.constants import DATETIME_PRINT_FORMAT
|
||||||
from freqtrade.persistence.base import ModelBase
|
from freqtrade.persistence.base import ModelBase
|
||||||
@ -16,18 +16,18 @@ class PairLock(ModelBase):
|
|||||||
# TODO: Properly type query.
|
# TODO: Properly type query.
|
||||||
query: Any
|
query: Any
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
id = mapped_column(Integer, primary_key=True)
|
||||||
|
|
||||||
pair = Column(String(25), nullable=False, index=True)
|
pair = mapped_column(String(25), nullable=False, index=True)
|
||||||
# lock direction - long, short or * (for both)
|
# lock direction - long, short or * (for both)
|
||||||
side = Column(String(25), nullable=False, default="*")
|
side = mapped_column(String(25), nullable=False, default="*")
|
||||||
reason = Column(String(255), nullable=True)
|
reason = mapped_column(String(255), nullable=True)
|
||||||
# Time the pair was locked (start time)
|
# Time the pair was locked (start time)
|
||||||
lock_time: datetime = Column(DateTime(), nullable=False)
|
lock_time: datetime = mapped_column(DateTime(), nullable=False)
|
||||||
# Time until the pair is locked (end time)
|
# Time until the pair is locked (end time)
|
||||||
lock_end_time: datetime = Column(DateTime(), nullable=False, index=True)
|
lock_end_time: datetime = mapped_column(DateTime(), nullable=False, index=True)
|
||||||
|
|
||||||
active = Column(Boolean, nullable=False, default=True, index=True)
|
active = mapped_column(Boolean, nullable=False, default=True, index=True)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
lock_time = self.lock_time.strftime(DATETIME_PRINT_FORMAT)
|
lock_time = self.lock_time.strftime(DATETIME_PRINT_FORMAT)
|
||||||
|
Loading…
Reference in New Issue
Block a user