Ptrade 逆回购+自动申购新股可转债

分享一些最基本的ptrade代码实盘例子。 持续更新,喜欢的朋友请关注本站哦。
本站所有代码均经过实盘验证。
# ptrade软件-量化-回测 里,新建策略,复制全文粘贴进去,周期选分钟,再到交易里新增交易

import time

def reverse_repurchase(context):
cash = context.portfolio.cash
amount = int(cash/1000)*10
log.info(amount)
order('131810.SZ', -1*amount) # 深圳逆回购,


def ipo(context):
ipo_stocks_order()


def initialize(context):
g.flag = False
log.info("initialize g.flag=" + str(g.flag) )
run_daily(context, reverse_repurchase, '14:57')
run_daily(context, ipo, '13:30')

def before_trading_start(context, data):
pass

def handle_data(context, data):
pass

def on_order_response(context, order_list):
# 该函数会在委托回报返回时响应
log.info(order_list)

上面代码设定在13:30分申购新股,新债;
在14:57分申购深圳逆回购R-001
 
喜欢的朋友拿去,欢迎转载。
 

欢迎关注公众号
 

0 个评论

要回复文章请先登录注册