fix trader.record_trade

make lib.backtester importable from the top level
This commit is contained in:
Ichinga Samuel
2024-11-19 21:56:12 +01:00
parent 3143ca9936
commit b92c9b516a
3 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
-e git+https://github.com/Ichinga-Samuel/aiomql.git@3143ca9936e2f791798b4944bf0df7225c4c6a78#egg=aiomql
anyio==4.3.0 anyio==4.3.0
argon2-cffi==23.1.0 argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0 argon2-cffi-bindings==21.2.0
@@ -9,7 +10,7 @@ Babel==2.14.0
beautifulsoup4==4.12.3 beautifulsoup4==4.12.3
black==23.9.1 black==23.9.1
bleach==6.1.0 bleach==6.1.0
build==1.0.3 build==1.2.2.post1
certifi==2023.7.22 certifi==2023.7.22
cffi==1.16.0 cffi==1.16.0
charset-normalizer==3.3.0 charset-normalizer==3.3.0
@@ -140,7 +141,7 @@ tomli==2.0.1
tomli_w==1.0.0 tomli_w==1.0.0
tornado==6.4 tornado==6.4
traitlets==5.14.2 traitlets==5.14.2
twine==4.0.2 twine==5.1.1
typeapi==2.1.1 typeapi==2.1.1
types-python-dateutil==2.9.0.20240316 types-python-dateutil==2.9.0.20240316
typing_extensions==4.6.3 typing_extensions==4.6.3
+1
View File
@@ -14,3 +14,4 @@ from .strategy import Strategy
from .sessions import Sessions, Session from .sessions import Sessions, Session
from .trade_records import TradeRecords from .trade_records import TradeRecords
from .terminal import Terminal from .terminal import Terminal
from .backtester import BackTester
+2 -1
View File
@@ -1,5 +1,6 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from datetime import datetime, UTC from datetime import datetime, UTC
from string import digits
from typing import TypeVar from typing import TypeVar
from logging import getLogger from logging import getLogger
@@ -198,7 +199,7 @@ class Trader(ABC):
""" """
if self.config.record_trades is False or result.retcode != 10009: if self.config.record_trades is False or result.retcode != 10009:
return return
params = {**parameters} or {} params = {**parameters} if isinstance(parameters, dict) else {}
profit = await self.order.calc_profit() profit = await self.order.calc_profit()
params["expected_profit"] = profit params["expected_profit"] = profit
date = ( date = (