mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-17 13:58:15 +00:00
v4.0.1
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
from datetime import datetime, UTC
|
||||
import asyncio
|
||||
import json
|
||||
import shutil
|
||||
from datetime import datetime, UTC
|
||||
from logging import getLogger
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from aiomql.core import Config
|
||||
from aiomql.core.meta_backtester import MetaBackTester
|
||||
from aiomql.core.backtesting.backtest_engine import BackTestEngine
|
||||
@@ -57,7 +58,7 @@ async def config(request):
|
||||
data["mode"] = "backtest"
|
||||
json.dump(data, fh1, indent=2)
|
||||
json.dump(data, fh2, indent=2)
|
||||
config = Config(filename="test.json", root="tests/backtest")
|
||||
config = Config(config_file="tests/backtest/test.json", root="tests/backtest", filename="test.json")
|
||||
yield config
|
||||
await cleanup()
|
||||
|
||||
@@ -73,7 +74,8 @@ async def mt():
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
async def period():
|
||||
return {"start": datetime(2024, 2, 1, hour=8, tzinfo=UTC), "end": datetime(2024, 2, 7, hour=16, tzinfo=UTC)}
|
||||
return {"start": datetime(2024, 2, 1, hour=8, tzinfo=UTC),
|
||||
"end": datetime(2024, 2, 7, hour=16, tzinfo=UTC)}
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
|
||||
@@ -27,7 +27,8 @@ async def make_buy_sell_orders():
|
||||
return {"buy": Order(**buy_req), "sell": Order(**sell_req)}
|
||||
|
||||
|
||||
def test_trade_mode(config, backtest_engine, history, positions, order_sell, order_buy, btc_usd):
|
||||
def test_trade_mode(config, backtest_engine, history, positions, order_sell, order_buy, btc_usd, capsys):
|
||||
print(config.filename, config.root)
|
||||
assert config.mode == "backtest"
|
||||
assert isinstance(backtest_engine, BackTestEngine)
|
||||
assert isinstance(history.mt5, MetaBackTester)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
def test_config(config, capsys):
|
||||
print(config.filename, config.root, config.mode, config.config_file)
|
||||
assert 6 == 6
|
||||
assert config.mode == "backtest"
|
||||
Reference in New Issue
Block a user