mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
Add order_tag to orders model
This commit is contained in:
parent
c59ae30e31
commit
d82bfc9fad
|
@ -223,6 +223,7 @@ def migrate_orders_table(engine, table_back_name: str, cols_order: List):
|
||||||
ft_amount = get_column_def(cols_order, 'ft_amount', 'coalesce(amount, 0.0)')
|
ft_amount = get_column_def(cols_order, 'ft_amount', 'coalesce(amount, 0.0)')
|
||||||
ft_price = get_column_def(cols_order, 'ft_price', 'coalesce(price, 0.0)')
|
ft_price = get_column_def(cols_order, 'ft_price', 'coalesce(price, 0.0)')
|
||||||
ft_cancel_reason = get_column_def(cols_order, 'ft_cancel_reason', 'null')
|
ft_cancel_reason = get_column_def(cols_order, 'ft_cancel_reason', 'null')
|
||||||
|
ft_order_tag = get_column_def(cols_order, 'ft_order_tag', 'null')
|
||||||
|
|
||||||
# sqlite does not support literals for booleans
|
# sqlite does not support literals for booleans
|
||||||
with engine.begin() as connection:
|
with engine.begin() as connection:
|
||||||
|
@ -230,13 +231,14 @@ def migrate_orders_table(engine, table_back_name: str, cols_order: List):
|
||||||
insert into orders (id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
insert into orders (id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||||
status, symbol, order_type, side, price, amount, filled, average, remaining, cost,
|
status, symbol, order_type, side, price, amount, filled, average, remaining, cost,
|
||||||
stop_price, order_date, order_filled_date, order_update_date, ft_fee_base, funding_fee,
|
stop_price, order_date, order_filled_date, order_update_date, ft_fee_base, funding_fee,
|
||||||
ft_amount, ft_price, ft_cancel_reason
|
ft_amount, ft_price, ft_cancel_reason, ft_order_tag
|
||||||
)
|
)
|
||||||
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||||
status, symbol, order_type, side, price, amount, filled, {average} average, remaining,
|
status, symbol, order_type, side, price, amount, filled, {average} average, remaining,
|
||||||
cost, {stop_price} stop_price, order_date, order_filled_date,
|
cost, {stop_price} stop_price, order_date, order_filled_date,
|
||||||
order_update_date, {ft_fee_base} ft_fee_base, {funding_fee} funding_fee,
|
order_update_date, {ft_fee_base} ft_fee_base, {funding_fee} funding_fee,
|
||||||
{ft_amount} ft_amount, {ft_price} ft_price, {ft_cancel_reason} ft_cancel_reason
|
{ft_amount} ft_amount, {ft_price} ft_price, {ft_cancel_reason} ft_cancel_reason,
|
||||||
|
{ft_order_tag} ft_order_tag
|
||||||
from {table_back_name}
|
from {table_back_name}
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,8 @@ class Order(ModelBase):
|
||||||
funding_fee: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
funding_fee: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
|
|
||||||
ft_fee_base: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
ft_fee_base: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
|
ft_order_tag: Mapped[Optional[str]] = mapped_column(String(CUSTOM_TAG_MAX_LENGTH),
|
||||||
|
nullable=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def order_date_utc(self) -> datetime:
|
def order_date_utc(self) -> datetime:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user