IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 区块链 -> 链上量化合约智能合约dapp系统开发技术分析(成熟技术) -> 正文阅读

[区块链]链上量化合约智能合约dapp系统开发技术分析(成熟技术)

什么是量化交易?量化交易至少应该包括五个方面的要素:

  (1)买入和卖出的信号系统。

  (2)牛市还是熊市的方向指引

  (3)头寸管理以及资金管理。

  (4)风险控制,运用信号源来确定止损位置,利用资产曲线和权益曲线来加以判定和管理。

  (5)投资组合,不一样的投资品种、不相同的交易系统(不同功能和参数,有快有慢)以及不相同时间周期组合.,现分散组合,让交易账户波动更加稳定。

?

量化交易源代码分析:

 #将提取的数据处理成表格数据

  df_words=df['words'][10:]

  date=[]

  price=[]

  buy_ratio_tj=[]

  buy_ratio_trader=[]

  sell_ratio_tj=[]

  sell_ratio_trader=[]

  for i in range(0,len(df_words.tolist()),6):

  date.append(df_words.tolist()<i>)

  price.append(df_words.tolist()[i+1])

  buy_ratio_tj.append(df_words.tolist()[i+2])

  buy_ratio_trader.append(df_words.tolist()[i+3])

  sell_ratio_tj.append(df_words.tolist()[i+4])

  sell_ratio_trader.append(df_words.tolist()[i+5])

  now_df=pd.DataFrame({'时间':date,'结算价格':price,'买入投机比例':buy_ratio_tj,'买入交易比例':buy_ratio_trader,

  '卖出投资比例':sell_ratio_tj,'卖出交易比例':sell_ratio_trader})

  print(now_df)

  now_df.to_excel(r'C:UsersAdministratorDesktop期货交易结算套保.xlsx')

  pyttsx3.speak('期货结算套保数据提取成功')

  #识别升贴书数据

  def up_down_data():

  '''

  利用百度进行期货升贴水数据识别,处理

  '''

  #点击合约资料

  pyautogui.click(x=969,y=51)

  #信息截图

  time.sleep(1)

  #点击升贴书

  pyautogui.click(x=1053,y=149)

  #截图

  pyautogui.screenshot(r'C:UsersAdministratorDesktop期货交易升贴水.png',region=(553,771,1672-553,954-771))

  options={'language':'chn_eng'}

  aipcor=AipOcr(app_id,api_key,secret_key)

  image=open(r'C:UsersAdministratorDesktop期货交易升贴水.png','rb')

  image1=image.read()

  text_list=aipcor.general(image1,options=options)

  df1=pd.json_normalize(text_list['words_result'])

  df1.to_excel(r'C:UsersAdministratorDesktop期货交易升贴水.xlsx')

  #将识别的数据处理excel数据

  df=pd.read_excel(r'C:UsersAdministratorDesktop期货交易升贴水.xlsx')

  df_words=df['words']

  data=[]

  #现货价格

  new_price=[]

  #合约代码

  code=[]

  #合约价格

  price=[]

  new_cha=[]

  new_ratio=[]

  #主力代码

  stock=[]

  main_price=[]

  mian_new_cha=[]

  mian_new_ratio=[]

  for i in range(0,len(df_words.tolist()),10):

  data.append(df_words.tolist()<i>)

  new_price.append(df_words.tolist()[i+1])

  code.append(df_words.tolist()[i+2])

  price.append(df_words.tolist()[i+3])

  new_cha.append(df_words.tolist()[i+4])

  new_ratio.append(df_words.tolist()[i+5])

  stock.append(df_words.tolist()[i+6])

  main_price.append(df_words.tolist()[i+7])

  mian_new_cha.append(df_words.tolist()[i+8])

  mian_new_ratio.append(df_words.tolist()[i+9])

  now_df=pd.DataFrame({'时间':data,'现货价格':new_price,'合约代码':code,'合约价格':price,'期货现差':new_cha,

  '期货现差比例':new_ratio,'主力合约代码':stock,'主力合约价格':main_price,'主力合约现差':mian_new_cha,'主力合约现差比例':mian_new_ratio})

  print(now_df)

  now_df.to_excel(r'C:UsersAdministratorDesktop期货交易升贴水.xlsx')

  pyttsx3.speak('期货升贴水数据处理成功')

  #实时期货数据获取,识别

  def real_account_data():

  '''

  利用百度对账户进行实时数据识别获取

  '''

  #返回交易界面

  #return_trader()

  #点击交易资金

  pyautogui.click(x=732,y=520)

  time.sleep(1)

  #截图分析

  pyautogui.screenshot(r'C:UsersAdministratorDesktop期货交易实时期货账户数据.png',region=(429,543,1092-429,895-543))

  options={'language':'chn_eng'}

  aipcor=AipOcr(app_id,api_key,secret_key)

  image=open(r'C:UsersAdministratorDesktop期货交易实时期货账户数据.png','rb')

  image1=image.read()

  text_list=aipcor.general(image1,options=options)

  df1=pd.json_normalize(text_list['words_result'])

  df1.to_excel(r'C:UsersAdministratorDesktop期货交易实时期货账户数据.xlsx')

  df=pd.read_excel(r'C:UsersAdministratorDesktop期货交易实时期货账户数据.xlsx')

  df_words=df['words']

  #列

  clo=[]

  #数据

  data=[]

  for i in range(0,len(df_words.tolist())):

  if i%2==0:

  clo.append(df_words.tolist()<i>)

  else:

  data.append(df_words.tolist()<i>)

  del clo[-1]

  new_df=pd.DataFrame(data[:20],clo)

  new_df.to_excel(r'C:UsersAdministratorDesktop期货交易实时期货账户数据.xlsx')

  #期货锁仓,进行反手操作,及卖出多头,同时买进空头

  def featurns_buy_lock(stock='ni2205',num='1'):

  '''

  看多锁仓,期货锁仓,进行反手操作,及卖出多头,同时买进空头

  看跌同理

  stock='期货代码'

  num=买入的手数

  '''

  #点击输入

  pyttsx3.speak('期货多头开始锁仓')

  pyautogui.click(x=320,y=649)

  #清楚数据

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyautogui.typewrite(stock,interval=0.1)

  pyttsx3.speak('开始输入')

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  #输入买入手数

  #开始清楚

  pyautogui.click(x=470,y=641)

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyttsx3.speak('开始输入')

  pyautogui.typewrite(num,interval=0.1)

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  time.sleep(1)

  pyautogui.click(x=651,y=304)

  #点击锁仓

  pyautogui.click(x=463,y=669)

  featurns_trader_stats()

  #卖出期货多头

  def featurns_buy_sell(stock='cu2205',num='1'):

  '''

  卖出期货多头

  stock='期货代码'

  num=买入的手数

  '''

  #点击输入

  pyttsx3.speak('开始平多')

  pyautogui.click(x=320,y=649)

  #清楚数据

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清楚完成')

  pyttsx3.speak('开始输入')

  pyautogui.typewrite(stock,interval=0.1)

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  #输入买入手数

  #开始清楚

  pyautogui.click(x=470,y=641)

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyautogui.typewrite(num,interval=0.1)

  pyttsx3.speak('开始输入')

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  time.sleep(1)

  #点击平多

  pyautogui.click(x=598,y=723)

  featurns_trader_stats()

  #空头交易

  def featurns_sell_buy_add_featuns(stock='ni2205',num='1'):

  '''

  期货空头增加多头,及对冲

  stock='期货代码'

  num=买入的手数

  '''

  #点击输入

  pyttsx3.speak('期货空头开始加多建仓')

  pyautogui.click(x=320,y=649)

  #清楚数据

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清楚完成')

  pyttsx3.speak('开始输入')

  pyautogui.typewrite(stock,interval=0.1)

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  #输入买入手数

  #开始清楚

  pyautogui.click(x=470,y=641)

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyautogui.typewrite(num,interval=0.1)

  pyttsx3.speak('开始输入')

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  time.sleep(1)

  #点击买入/加多

  pyautogui.click(x=325,y=729)

  featurns_trader_stats()

  #期货空头继续加空

  def featurns_sell_add_sell_futurns(stock='ni2205',num='1'):

  '''

  期货空头加多

  stock='期货代码'

  num=买入的手数

  '''

  #点击输入

  pyttsx3.speak('期货空头开始加多')

  pyautogui.click(x=320,y=649)

  #清楚数据

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyautogui.typewrite(stock,interval=0.1)

  pyttsx3.speak('开始输入')

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  #输入买入手数

  #开始清楚

  pyautogui.click(x=470,y=641)

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyttsx3.speak('开始输入')

  pyautogui.typewrite(num,interval=0.1)

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  time.sleep(1)

  pyautogui.click(x=651,y=304)

  #点击锁仓

  pyautogui.click(x=463,y=669)

  featurns_trader_stats()

  #期货空头平空

  def featurns_sell_sell_featurns(stock='ni2205',num='1'):

  '''

  期货空头平空,卖出期货空头

  stock='期货代码'

  num=买入的手数

  '''

  #点击输入

  pyttsx3.speak('开始平空')

  pyautogui.click(x=320,y=649)

  #清楚数据

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清楚完成')

  pyttsx3.speak('开始输入')

  pyautogui.typewrite(stock,interval=0.1)

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  #输入买入手数

  #开始清楚

  pyautogui.click(x=470,y=641)

  pyttsx3.speak('开始清除')

  for i in range(6):

  pyautogui.press('backspace')

  pyttsx3.speak('清除完成')

  pyautogui.typewrite(num,interval=0.1)

  pyttsx3.speak('开始输入')

  pyautogui.press('enter')

  pyttsx3.speak('输入完成')

  time.sleep(1)

  #点击平多

  pyautogui.click(x=598,y=723)

  featurns_trader_stats()

  #期货多头和期货多头进行比例平仓

  def featurns_buy_and_sell_ratio(stock='ni2205',num='1',ratio='30'):

  '''

  区块链 最新文章
盘点具备盈利潜力的几大加密板块,以及潜在
阅读笔记|让区块空间成为商品,打造Web3云
区块链1.0-比特币的数据结构
Team Finance被黑分析|黑客自建Token“瞒天
区块链≠绿色?波卡或成 Web3“生态环保”标
期货从入门到高深之手动交易系列D1课
以太坊基础---区块验证
进入以太坊合并的五个数字
经典同态加密算法Paillier解读 - 原理、实现
IPFS/Filecoin学习知识科普(四)
上一篇文章      下一篇文章      查看所有文章
加:2022-10-22 21:20:53  更:2022-10-22 21:21:32 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/25 2:34:50-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码