小果网页---套利系统添加了可以套利模块,提供数据api

最近在小果套利系统里面添加了一下可以套利模块,同时实现了盘中自动更新,30分钟更新一次。给大家提交交易参考,可以套利模块的选择

复制代码
df=df[df['申购状态'] !='暂停申购']df=df[df['申购限额'] !='无限额']df['溢价率']=df['溢价率'].astype(float)df['成交量']=df['成交量'].astype(float)df=df[df['溢价率']>=1.2]df=df[df['成交量']>=1000000]

成交量大于100万,溢价率对于1.2,申购状态不是暂停申购,申购限额不是无限额

网页http://120.78.132.143:8023/

点击lof套利模块 网页http://120.78.132.143:8023/lof_fund_data_analysis_app

点击运行,在点击不运行在点运行

可以点击排序溢价率

可以点击下载数据下载数据

下载的数据

全部的lof数据

套利分析

可以套利模块

历史溢价率

可以选择状态的标的

历史数据

交易状态查询可以选择标的

源代码全部上传了知识星球可以下载

可以加我备注加群,进入我的量化研究群

数据api​​​​​

复制代码
import pandas as pdimport jsonimport requestsimport osclass xg_financial_database:    '''    小果金融数据库    '''    def __init__(self,url='http://120.78.132.143',port=8023,password='123456'):        '''        小果金融数据库        url服务器网页        port端口        password授权码        '''        self.url=url        self.port=port        self.password=password        self.path=os.path.dirname(os.path.abspath(__file__))    def get_user_info(self):        '''        获取用户信息        '''        url='{}:{}/_dash-update-component'.format(self.url,self.port)        headers={'Content-Type':'application/json'}        data={            "output":"finace_data_table_1.data@c28c1f466316fd80f79b58b2e7baab2f",            "outputs":{"id":"finace_data_table_1","property":"data@c28c1f466316fd80f79b58b2e7baab2f"},            "inputs":[{"id":"finace_data_password","property":"value","value":"{}".format(self.password)},            {"id":"finace_data_data_type","property":"value","value":"代码"},            {"id":"finace_data_text","property":"value","value":"from trader_tool.stock_data import stock_data\nstock_data=stock_data()\ndf=stock_data.get_stock_hist_data_em(stock='600031',start_date='20210101',end_date='20600101',data_type='D',count=8000)\ndf.to_csv(r'{}\\数据\\{}数据.csv')\n                \n                "},            {"id":"finace_data_run","property":"value","value":"运行"},            {"id":"finace_data_down_data","property":"value","value":"不下载数据"}],            "changedPropIds":["finace_data_run.value"]}        res=requests.post(url=url,data=json.dumps(data),headers=headers)        text=res.json()        df=pd.DataFrame(text['response']['finace_data_table_1']['data'])        return df    def get_user_def_data(self,func=''):        '''        自定义数据获取        调用数据库        '''        text=self.params_func(text=func)        func=text        info=self.get_user_info()        print(info)        url='{}:{}/_dash-update-component'.format(self.url,self.port)        headers={'Content-Type':'application/json'}        data={"output":"finace_data_table.data@c28c1f466316fd80f79b58b2e7baab2f",            "outputs":{"id":"finace_data_table","property":"data@c28c1f466316fd80f79b58b2e7baab2f"},            "inputs":[{"id":"finace_data_password","property":"value","value":"{}".format(self.password)},            {"id":"finace_data_data_type","property":"value","value":"代码"},            {"id":"finace_data_text","property":"value","value":"{}".format(func)},            {"id":"finace_data_run","property":"value","value":"运行"},            {"id":"finace_data_down_data","property":"value","value":"不下载数据"}],            "changedPropIds":["finace_data_run.value"]}        res=requests.post(url=url,data=json.dumps(data),headers=headers)        text=res.json()        df=pd.DataFrame(text['response']['finace_data_table']['data'])        return info, df    def params_func(self,text=''):        '''        解析函数        '''        data_list=[]        f=text.split('\n')        for i in f:            text=i.strip().lstrip()            data_list.append(text)        func='\n'.join(data_list)        return func    def get_all_etf_data(self):        '''        获取全部的etf数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_all_etf_data()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_bond_etf_data(self):        '''        获取债券的etf数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_bond_etf_data()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_sz_sh_etf(self):        '''        获取A股ETF数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_sz_sh_etf()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_wp_etf_data(self):        '''        获取外盘ETF数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_wp_etf_data()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_sp_etf_data(self):        '''        获取商品ETF数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_sp_etf_data()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_hot_spot_investment(self):        '''        获取ETF热点投资数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_hot_spot_investment()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_hot_spot_investment(self):        '''        获取ETF热点投资数据        '''        func="""        from trader_tool.dfcf_etf_data import dfcf_etf_data        data=dfcf_etf_data()        df=data.get_hot_spot_investment()        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_limit_up_pool(self,date='20240126'):        '''        获取涨停板数据        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_limit_up_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_limit_up(self,date=''):        '''        冲刺涨停        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_limit_up(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_continuous_limit_pool(self,date='20230925'):        '''        连扳        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_continuous_limit_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_open_limit_pool(self,date='20230925'):        '''        炸板池        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_open_limit_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_lower_limit_pool(self,date='20230101'):        '''        跌停        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_lower_limit_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_block_top_pool(self,date='20230101'):        '''        最强风口        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_block_top_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_analysis_block_top_pool(self,date='20240101'):        '''        解析最强风口        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_analysis_block_top_pool(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_stock_continuous_limit_up(self,date='20240101'):        '''        连扳天梯        '''        func="""        from trader_tool.ths_limitup_data import ths_limitup_data        data=ths_limitup_data()        df=data.read_func_data(func="self.get_stock_continuous_limit_up(date={})")        print(df)        """.format(date)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_hot_stock_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_hot_stock_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_stock_concept_rot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_stock_concept_rot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_stock_industry_rot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_stock_industry_rot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_etf_hot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_etf_hot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_cov_bond_rot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_cov_bond_rot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_HK_stock_rot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_HK_stock_rot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_US_stock_rot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_US_stock_rot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_futurn_hot_rank(self):        func="""        from trader_tool.ths_rq import ths_rq        models=ths_rq()        df=models.get_futurn_hot_rank()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def fund_lof_spot_em(self):        '''        LOF 实时行情        '''        func="""        from trader_tool.lof_fund_data import lof_fund_data        models=lof_fund_data()        df=models.fund_lof_spot_em()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def fund_lof_hist_em(self,        symbol: str = "166009",        period: str = "daily",        start_date: str = "19700101",        end_date: str = "20500101",        adjust: str = "",):        '''        获取lof历史数据        '''        func="""        from trader_tool.lof_fund_data import lof_fund_data        models=lof_fund_data()        df=models.fund_lof_hist_em(symbol='{}',        period='{}',        start_date='{}',        end_date='{}',        adjust='{}')        print(df)        """.format(symbol,period,start_date,end_date,adjust)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def fund_lof_hist_min_em(self,        symbol: str = "166009",        start_date: str = "1979-09-01 09:32:00",        end_date: str = "2222-01-01 09:32:00",        period: str = "5",        adjust: str = ""):        '''        lof分时行情        '''        func="""        from trader_tool.lof_fund_data import lof_fund_data        models=lof_fund_data()        df=models.fund_lof_hist_min_em(symbol='{}',        period='{}',        start_date='{}',        end_date='{}',        adjust='{}')        print(df)        """.format(symbol,period,start_date,end_date,adjust)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_lof_fund_info_data(self,stock='501225'):        '''        获取ETF基本信息        '''        func="""        from trader_tool.lof_fund_data import lof_fund_data        models=lof_fund_data()        df=models.get_lof_fund_info_data(stock='{}')        """.format(stock)+"""        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,df    def get_all_lof_fund_info_data(self):        '''        获取全部lof基金数据        '''        func="""        from trader_tool.lof_fund_data import lof_fund_data        models=lof_fund_data()        df=models.get_all_lof_fund_info_data()        print(df)        df.to_csv(r'{}\数据\{}数据.csv')        """        info,df=self.get_user_def_data(func=func)        return info,dfif __name__=='__main__':    data=xg_financial_database(password='123456')    df=data.get_lof_fund_info_data(stock='501025')    print(df)
相关推荐
johnny23321 小时前
Python Web服务器网关接口:WSGI、ASGI、RSGI、uWSGI、uwsgi、Gunicorn、Uvicorn
python
weixin_4087177721 小时前
为什么宝塔面板定时访问URL任务总是报502_检查目标接口响应时间与延长任务执行超时设置
jvm·数据库·python
小陈工21 小时前
python Web开发从入门到精通(二十七)微服务架构设计原则深度解析:告别拆分烦恼,掌握治理精髓(上)
后端·python·架构
源码之家21 小时前
计算机毕业设计:Python渔业资源数据可视化分析大屏 Flask框架 数据分析 可视化 数据大屏 大数据 机器学习 深度学习(建议收藏)✅
人工智能·python·信息可视化·数据挖掘·数据分析·flask·课程设计
m0_7467523021 小时前
如何在导航栏中实现左右分列的菜单项布局
jvm·数据库·python
214396521 小时前
怎么为MongoDB事务调优:将读操作尽量移到事务外面执行
jvm·数据库·python
曲幽21 小时前
FastAPI服务半夜又挂了?先别急着重启,查查你的数据库连接池“池子”是不是漏了
python·prometheus·fastapi·web·async·sqlalchemy·connection·pool
baidu_3409988221 小时前
JavaScript中函数式编程中不可变性与闭包的关联
jvm·数据库·python
djjdjdjdjjdj21 小时前
c++如何利用std--tie实现多个文件属性字段的快速比较排序【详解】
jvm·数据库·python
Csvn21 小时前
🌟 LangChain 30 天保姆级教程 · Day 24|Plan-and-Execute Agent!让 AI 先“写计划”再“干活”,搞定复杂任务!
python·langchain