期货CTA策略
im
from tqz_strategy.template import CtaTemplatefrom public_module.object import BarDataclass TQZStockDoubleMaStrategy(CtaTemplate): """ re write. """ author = "tqz" fast_window = 30 sl
file_path_operator import TQZFilePathOperatorfrom public_module.tqz_extern.tools.position_operator.position_operator import TQZJs.
import reimport mathimport matplotlib.pyplot as pyplotfrom public_module.object import BarDatafrom public_module.tqz_extern.tools.position_operator.position_operator import TQZJsonOperatorfrom public_
from tqz_strategy.template import CtaTemplatefrom public_module.object import BarDatafrom public_module.utility import BarGeneratorclass TQZTurtleTradingStrategy(CtaTemplate): author = "tqz" # -
from math import floorimport osfrom public_module.tqz_extern.tools.file_path_operator.file_path_operator import TQZFilePathOperatorfrom public_module.tqz_extern.tools.position_operator.position_operat
"""在接废弃了vnpy自带的更新bar操作, 重写;"""from tqz_strategy.template import CtaTemplatefrom .
import reimport mathfrom public_module.tqz_extern.tools.position_operator.position_operator import TQZJsonOperatorfrom public_module.tqz_extern.tools.pandas_operator.pandas_operator import pandasfrom
from copy import deepcopyimport pandasimport
import osfrom datetime import datetime, date # noqafrom tqsdk import TqApi, TqAuthfrom tqsdk.tools import DataDownloaderfrom contextlib import closingfrom public_module.tqz_extern.tools.file_path_ope
from tqz_strategy.future.strategies.pair_trading_strategy import PairTradingStrategy # noqaimport osfrom datetime import datetime, date # noqafrom tqsdk import TqApi, TqAuthfrom tqsdk.tools import D
"""1. 期货品种的沉淀资金是未平仓的期货合约(持仓量)所占用的保证金.期货品种的沉淀资金越大说明这个品种非常受资金喜欢.相反,如果期货品种的沉淀资金越小,说明这个品种越冷门.2. 期货交易的本质就是资金的重新分配, 品种的沉淀资金越大, 未来有出现较大级别行情的机会就越大."""import osimport refrom public_module.tqz_extern.tools.pand
xrn.tools.
//------------------------------------------------------------------------// 简称: FactorER// 名称: ER因子// 类别: 用户函数// 类型: 用户函数// 输出: 数值型//------------------------------------------------------------------
fro
TQZTi.
mport TQZTi.
tester_branch.back_tester_source_data import BackTesterFutureConfigPathclass TQZRefreshFutureStrategiesSetting: @classmethod def refresh_m..
import osimport importlibimport tracebackfrom pathlib import Pathfrom public_module.tqz_extern.tools.position_operator.position_operator import TQZJsonOperatorfrom public_module.tqz_extern.tools.file_
import refrom public_module.tqz_extern.tools.pandas_operator.pandas_operator import pandasfrom public_module.tqz_extern.tools.position_operator.position_operator import TQZJsonOperatorfrom public_modu
from tqsdk import TqApi, TqAuthfrom public_module.tqz_extern.tools.pandas_operator.pandas_operator import pandas # noqafrom server_api.tqz_object import BarData, ExchangeTIME_GAP = 8 * 60 * 60 * 1000
import
a, TradeData, OrderDatafrom public_module.ut.
from copy import deepcopyimport pandasimport matplotlib.pyplot as pyplotimport mathfrom public_module.object import BarDatafrom back_tester_core.back_tester_source_data import BackTesterDataCorefrom b
import refrom abc import ABCfrom copy import copyfrom typing import Any, Callableimport pandasfrom public_module.constant import Interval, Direction, Offsetfrom public_module.object import BarData, Ti
import osimport importlibimport tracebackfrom datetime import datetimefrom pathlib import Pathfrom server_api.api.tqz_tushare_api import TQZTushareClientfrom tqz_strategy.template import CtaTemplatefr
from datetime import datetimefrom typing import Listfrom public_module.object import BarDatafrom public_module.constant import Exchangefrom public_module.tqz_extern.tools.pandas_operator.pandas_operat
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号