mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-14 16:26:55 +08:00
fix annotation recursive error
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
from __future__ import annotations
|
||||||
import copy
|
import copy
|
||||||
from typing import Union
|
from typing import Union, TYPE_CHECKING
|
||||||
|
|
||||||
from .account import Account
|
from .account import Account
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..strategy.base import BaseStrategy
|
||||||
from .exchange import Exchange
|
from .exchange import Exchange
|
||||||
from .executor import BaseExecutor
|
from .executor import BaseExecutor
|
||||||
from .backtest import backtest_loop
|
from .backtest import backtest_loop
|
||||||
@@ -11,7 +15,6 @@ from .backtest import collect_data_loop
|
|||||||
from .utils import CommonInfrastructure
|
from .utils import CommonInfrastructure
|
||||||
from .order import Order
|
from .order import Order
|
||||||
|
|
||||||
from ..strategy.base import BaseStrategy
|
|
||||||
from ..utils import init_instance_by_config
|
from ..utils import init_instance_by_config
|
||||||
from ..log import get_module_logger
|
from ..log import get_module_logger
|
||||||
from ..config import C
|
from ..config import C
|
||||||
@@ -137,6 +140,11 @@ def get_strategy_executor(
|
|||||||
pos_type: str = "Position",
|
pos_type: str = "Position",
|
||||||
):
|
):
|
||||||
|
|
||||||
|
# NOTE:
|
||||||
|
# - for avoiding recursive import
|
||||||
|
# - typing annotations is not reliable
|
||||||
|
from ..strategy.base import BaseStrategy
|
||||||
|
|
||||||
trade_account = create_account_instance(
|
trade_account = create_account_instance(
|
||||||
start_time=start_time, end_time=end_time, benchmark=benchmark, account=account, pos_type=pos_type
|
start_time=start_time, end_time=end_time, benchmark=benchmark, account=account, pos_type=pos_type
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
from qlib.backtest.order import BaseTradeDecision
|
from qlib.backtest.order import BaseTradeDecision
|
||||||
from qlib.strategy.base import BaseStrategy
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from qlib.strategy.base import BaseStrategy
|
||||||
from qlib.backtest.executor import BaseExecutor
|
from qlib.backtest.executor import BaseExecutor
|
||||||
from ..utils.time import Freq
|
from ..utils.time import Freq
|
||||||
from tqdm.auto import tqdm
|
from tqdm.auto import tqdm
|
||||||
|
|||||||
Reference in New Issue
Block a user