future - - 期货
future 是 PTrade 文档中的- 期货参考条目。
条目定义
类型: 对象属性与字段定义
官方名称: future
本条目不是独立可调用函数,用于说明对象属性、数据字段、枚举、日志或平台约定。
释义
future 是 PTrade 文档中的- 期货参考条目。
研究:官方目录未明确;回测:官方目录未明确;模拟:官方目录未明确;实盘:官方目录未明确。
参数
本条目没有独立函数参数。字段、取值或对象属性请查看下方官方详细说明。
返回值
本条目不是独立可调用函数,没有单独返回值。
示例
def initialize(context):
# 初始化策略
g.security = "600570.SS"
set_universe(g.security)
def before_trading_start(context, data):
g.flag = False
g.business_type = get_business_type()
log.info("当前策略的业务类型为:%s" % g.business_type)
def handle_data(context, data):
if g.flag is False:
if g.business_type == "stock":
order("600570.SS", 100)
elif g.business_type == "future":
buy_open("IF2309.CCFX", 1, 3816.0)
g.flag = True