feat: add cost to minimized order json output

pull/11275/head
Matthias 1 year ago
parent 03a22186bb
commit 1d22cf98c8

@ -270,6 +270,7 @@ class Order(ModelBase):
"order_filled_timestamp": dt_ts_none(self.order_filled_utc),
"ft_is_entry": self.ft_order_side == entry_side,
"ft_order_tag": self.ft_order_tag,
"cost": self.cost if self.cost else 0,
}
if not minified:
resp.update(
@ -278,7 +279,6 @@ class Order(ModelBase):
"order_id": self.order_id,
"status": self.status,
"average": round(self.average, 8) if self.average else 0,
"cost": self.cost if self.cost else 0,
"filled": self.filled,
"is_open": self.ft_is_open,
"order_date": (

@ -5,7 +5,7 @@ from collections import defaultdict
from copy import deepcopy
from datetime import datetime, timedelta, timezone
from pathlib import Path
from unittest.mock import MagicMock, PropertyMock
from unittest.mock import ANY, MagicMock, PropertyMock
import numpy as np
import pandas as pd
@ -795,6 +795,7 @@ def test_backtest_one(default_conf, mocker, testdatadir) -> None:
"order_filled_timestamp": 1517251200000,
"ft_is_entry": True,
"ft_order_tag": "",
"cost": ANY,
},
{
"amount": 0.00957442,
@ -803,6 +804,7 @@ def test_backtest_one(default_conf, mocker, testdatadir) -> None:
"order_filled_timestamp": 1517265300000,
"ft_is_entry": False,
"ft_order_tag": "roi",
"cost": ANY,
},
],
[
@ -813,6 +815,7 @@ def test_backtest_one(default_conf, mocker, testdatadir) -> None:
"order_filled_timestamp": 1517283000000,
"ft_is_entry": True,
"ft_order_tag": "",
"cost": ANY,
},
{
"amount": 0.0097064,
@ -821,6 +824,7 @@ def test_backtest_one(default_conf, mocker, testdatadir) -> None:
"order_filled_timestamp": 1517285400000,
"ft_is_entry": False,
"ft_order_tag": "roi",
"cost": ANY,
},
],
],

Loading…
Cancel
Save