本文主要是介绍禄得可转债自定义因子交易系统,年化40%,最大回撤15%,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
经过2个月的研究,和大佬们讨论轮动算法,选股算法,终于完成了可转债自定义因子轮动系统,非常感谢禄得老师的数据
文件链接 禄得可转债自定义因子交易系统,年化40%,最大回撤15% (qq.com)
网页 https://lude.cc/
程序支持自定义数据,自定义股票池,我提供了服务器的数据支持
网页 http://120.78.132.143:8023/
可转债数据支持http://120.78.132.143:8023/lude_data_app
我实盘4个月了稳定的在服务器自动交易,还没有死机
24小时自动交易分析
服务器api支持
import pandas as pd
import requests
import json
class lude_data_api:
def __init__(self,url='http://120.78.132.143',port='8023',password='123456'):
'''
手动下载存数据库
禄得数据api
url服务器
port端口
password授权码
'''
self.url=url
self.port=port
self.password=password
def get_bond_data(self,date='2024-04-26'):
'''
获取可转债数据
'''
url='{}:{}/_dash-update-component'.format(self.url,self.port)
headers={'Content-Type':'application/json'}
data={"output":"lude_data_maker_table.data@669dd4696a628d8290353c138057eb97",
"outputs":{"id":"lude_data_maker_table","property":"data@669dd4696a628d8290353c138057eb97"},
"inputs":[{"id":"password","property":"value","value":self.password},
{"id":"lude_data_data_type","property":"value","value":"禄得数据"},
{"id":"lude_data_end_date","property":"date","value":date},
{"id":"lude_data_run","property":"value","value":"运行"},
{"id":"lude_data_down_data","property":"value","value":"不下载数据"}],
"changedPropIds":["lude_data_run.value"]}
res=requests.post(url=url,data=json.dumps(data),headers=headers)
text=res.json()
df=pd.DataFrame(text['response']['lude_data_maker_table']['data'])
return df
if __name__=='__main__':
models=lude_data_api()
df=models.get_bond_data(date='2019-01-15')
print(df)
因子的设置和录得一模一样,兼容录得的设计
禄的设置因子
点击回撤,我也在开发回测程序,自动组合因子,年化40,最大回撤15
实盘设置打开qmt登录qmt,同花顺也可以
选择交易系统比如qmt
"交易系统设置":"*********************************************",
"交易系统选择":"ths/qmt",
"交易系统":"qmt",
"交易品种":"fund",
"交易品种说明":["stock","fund","bond","全部"],
"同花顺下单路径":"C:/同花顺软件/同花顺/xiadan.exe",
"识别软件安装位置":"C:/Program Files/Tesseract-OCR/tesseract",
"qmt路径":"C:/国金QMT交易端模拟/userdata_mini",
"qmt账户":"55004082",
"qmt账户类型":"STOCK",
"证券公司交易设置":"兼容老牌证券公司可转债1手为单位",
"是否开启特殊证券公司交易设置":"否",
选择交易模型比如可转债自定义因子
"自定义交易":"************************",
"是否开启自定义函数模块":"是",
"自定义运行函数设置":"自定义运行函数说明,运行类型有定时和循环,只需要把自定义模块的函数名称放在下面******",
"目前设置说明":"早上交易人气,下午做概念,2个策略的间隔长,干扰小,手动更新数据是最后一个策略的",
"自定义函数运行类型":["定时","定时","定时","定时"],
"自定义函数模块运行时间":["09:45","09:50","14:30","14:35"],
"红利和自定义股票池策略说明":"把对方策略的股票池加入对方的黑名单隔离2个策略参数",
"自定义函数":[
"run_lude_convertible_bond_custom_factor_rotation"
],
"黑名单":["600031"],
全部的策略
设置资金模块
"交易模式":"金额",
"固定交易资金":10000,
"持有金额限制":10000,
"固定交易数量":10,
"持有限制":10,
"持股限制":10,
"特殊标的金额设置":"特殊标的金额设置*************",
"特殊标的":["511130","511090","511580","511220","159816",
"511030","511520","159650","511010","159972","511270",
"511100","511020","511060","159649","511260","511360",
"511180","511380"],
"特殊资金说明":"资金金额最好和固定交易金额成倍数,方便释放资金比如1.5,1,2倍数",
"特殊固定交易资金":15000,
"特殊持有金额限制":15000,
"滑点设置":"滑点设置滑点价格最后一位,比如滑点0.01,股票换掉0.01,etf,可转债滑点0.01/10=0.001价格最后一位,比如现在12.01,买入12.02,卖出12.00",
"滑点":0.01,
运行user def models更新数据
更新的结果
我们对比一下禄得的选股,禄得的选股结果
程序自动分析的选股结果
看打分因子一样的结果
运行trader st进入24小时实盘交易
运行是结果
下单的结果
周末委托下单失败
全部的代码我上传了知识星球可以直接下载使用
加我备注加群可以进入我的量化交流群,很多大佬一起研究策略
全部的参数,可转债自定义因子轮动
{
"可转债溢价率设置":"可转债溢价率设置",
"数据源模式说明":"服务器/自定义",
"数据源":"服务器",
"服务器":"http://120.78.132.143",
"端口":"8023",
"授权码":"123456",
"是否测试":"否",
"是否数据没有更新的情况下更新":"是",
"强制赎回设置":"************************",
"是否剔除强制赎回":"是",
"距离强制赎回天数":0,
"排除上市天数":3,
"是否排除ST":"是",
"市场说明":["沪市主板","深市主板","创业板","科创板"],
"排除市场":[],
"行业说明":"查询行业表**********,混合排除不区分一二三级行业",
"排除行业":[],
"企业类型说明":["民营企业","地方国有企业","中央国有企业","外资企业","中外合资经营企业","集体企业"],
"排除企业类型":[],
"排除地域说明":["陕西", "山西", "山东", "河南", "新疆", "安徽", "西藏", "海南", "湖北", "河北",
"福建", "广西", "内蒙古", "浙江", "江西", "江苏", "上海", "贵州", "黑龙江", "湖南", "甘肃",
"宁夏", "云南", "天津", "广东", "四川", "北京", "辽宁", "重庆"],
"排除地域":[],
"排除外部评级说明":["AAA", "AA+", "AA", "AA-", "A+", "A", "A-",
"BBB+", "BBB", "BBB-", "BB+", "BB", "BB-", "B+", "B", "B-", "CCC", "CC"],
"排除外部评级":["B","B-","CCC","CC"],
"排除三方评级说明":["1", "2", "3", "4+", "4", "4-", "5+", "5", "5-", "6+", "6",
"6-", "7+", "7", "7-", "8+", "8", "8-", "9", "10"],
"排除三方评级":["10","9","8"],
"添加排除因子":"排除因子设置************************",
"全部的排除因子打分因子,必须选择可以计算的":["开盘价", "最高价", "最低价", "最新价", "涨跌幅", "5日涨跌幅",
"正股最高价", "正股最低价", "正股最新价", "正股涨跌幅", "正股5日涨跌幅", "成交量(手)",
"成交额(万)", "年化波动率", "正股年化波动率", "股息率", "转股价值", "转股溢价率", "理论转股溢价率",
"修正转股溢价率", "纯债价值", "纯债溢价率", "期权价值", "理论价值", "理论偏离度", "双低",
"剩余规模(亿)", "剩余市值(亿)", "换手率", "市净率", "市盈率_ttm", "市销率_ttm", "正股流通市值(亿)",
"正股总市值(亿)", "资产负债率", "转债市占比", "上市天数", "转股截止日", "剩余年限",
"到期收益率(税前)", "强赎触发比例", "外部评级", "三方评级", "企业类型", "地域", "一级行业", "二级行业", "三级行业"],
"因子计算符号说明":"大于,小于,大于排名%,小于排名%,空值,排除是相反的,大于是小于",
"排除因子":["剩余规模(亿)","最新价","转股溢价率"],
"因子计算符号":["大于","大于","大于"],
"因子值":[10,130,0.3],
"打分因子设置":"*************************************************",
"打分因子说明":"正相关:因子值越大得分越高;负相关:因子值越大得分越低,",
"打分因子":["转股溢价率","最新价","剩余规模(亿)"],
"因子相关性":["负相关","负相关","负相关"],
"因子权重":[1,1,1],
"持有限制":10,
"持股限制":10,
"策略轮动设置":"策略轮动设置************************,轮动都按排名来",
"轮动方式说明":"每天/每周/每月/特别时间",
"轮动方式":"每天",
"说明":"每天按自定义函数运行",
"每周轮动是说明":"每周比如0是星期一,4是星期五**********",
"每周轮动时间":0,
"每月轮动是说明":"必须是交易日,需要自己每个月自动输入**********",
"每月轮动时间":["2024-02-29","2024-02-29","2024-02-29","2024-02-29","2024-02-29","2024-02-29","2024-02-29"],
"特定时间说明":"特别的应该交易日",
"特定时间":["2024-02-23","2024-02-24","2024-02-25","2024-02-26","2024-02-27"],
"轮动规则设置":"轮动规则设置88888888**********排名",
"买入排名前N":10,
"持有排名前N":10,
"跌出排名卖出N":10,
"买入前N":5
}
这篇关于禄得可转债自定义因子交易系统,年化40%,最大回撤15%的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!