量化合约系统开发(策略源码)丨合约量化系统开发(成熟项目)

简介:  With the continuous progress of information technology and communication technology,we have entered the era of intelligent industry.In this era,the application of various intelligent technologies is driving the upgrading and transformation of industry,and new generation information technologies suc

  With the continuous progress of information technology and communication technology,we have entered the era of intelligent industry.In this era,the application of various intelligent technologies is driving the upgrading and transformation of industry,and new generation information technologies such as artificial intelligence technology,5G technology,and industrial internet technology are continuously promoting the progress and development of the era.

  直接调用onnx库load接口,已经把onnx计算图解析了,然后用解析后的原始计算图初始化『量化计算图』BaseGraph

  graph=parser.build(file_path)

  这个parser方法命名可能是借鉴是onnx库的parse吧:

  一共有三种parse:OnnxParser、CaffeParser、NativeImporter,先看看OnnxParser是如何实现的。

  这应该是以一个字典key-value格式存储的,这方面具体的细节以后再研究研究~

  之前说过在量化的全流程中,所有信息都是由BaseGraph这个类保存和管理的。先用graph_pb.name新建一个量化图:

  graph=BaseGraph(name=graph_pb.name,built_from=NetworkFramework.ONNX)

  接下来就是向这个新建的graph里面填充我们想要的东西,首先要设置每个opset的属性,这个属性里包括domain和version,注意这个设置是op粒度的。

  graph._detail[GRAPH_OPSET_ATTRIB]=self.convert_opsets_to_str(opsets)

  graph._detail['ir_version']=model_pb.ir_version

  onnx_import_opset=DEFAULT_OPSET_VERSION

  for opset in graph._detail[GRAPH_OPSET_ATTRIB]:

  if opset['domain']==DEFAULT_OPSET_DOMAIN or opset['domain']=='':

  onnx_import_opset=opset['version']

  break

  然后遍历每个节点,然后进行初始化参数。所谓初始化参数initialize_params()就是把对应节点的is_parameter设置为TRUE,表示这个节点是有参数的:

  def initialize_params(self,graph:BaseGraph,initializer:Dict[str,Any])->BaseGraph:

  for var in graph.variables.values():

  if var.name in initializer:

  for dest_op in var.dest_ops:

  assert isinstance(dest_op,Operation)

  dest_op.parameters.append(var)

  var.value=initializer[var.name]

  var.is_parameter=True

  return graph

  之前说过这里主要是载入并初始化量化计算图,还不涉及具体计算图优化。但是会做一步移除无需量化的节点:

  self.de_inplace(graph)

相关文章
|
9月前
|
机器学习/深度学习 数据采集 监控
合约量化系统开发策略详细丨合约量化系统开发规则指南/成熟技术/案例设计/方案项目/源码功能
合约量化系统的开发策略指的是设计和实现用于执行自动化交易的策略的方法和原则
|
10月前
|
存储 人工智能 数据建模
量化合约开发源码案例丨量化合约系统开发(详细及策略)
self._last_bar_start_minute=None#最后一次更新bar的时间   self._isNewBar=False#是否有新bar   self._ma20=None   #当前订单,dict,字典   self._current_orders={}
|
数据挖掘 机器人 API
量化合约系统开发(源码)合约量化系统开发(技术方案)
stock_weights=[]      num_assets=len(selected)
合约量化/量化合约开发源码说明,量化合约/合约量化系统开发(成熟及方案)丨运营版
  Quantitative trading refers to the use of advanced mathematical models instead of subjective judgments,and the use of computer technology to select multiple"high probability"events that can bring excess returns from huge historical data to formulate strategies,greatly reducing the impact of inves
|
人工智能 算法 PyTorch
量化合约系统开发(成熟技术)丨合约量化系统开发(项目策略)及源码详解
  人工智能(Artificial Intelligence,简称AI)是指计算机系统在完成类似人类智力所需的任务时所表现出来的能力。它是一种复杂的技术,通过将大量的数据输入到算法中进行学习,不断调整和改进自己的算法,从而不断优化其性能。
|
计算机视觉 Python
量化合约源码丨合约量化系统开发(成熟技术)及详细策略
  What is the term"follow orders",which means placing orders with traders(professionals with trading experience/market analysis)and setting stop loss risk controls to avoid losses as much as possible;The tracking system has gradually become one of the standard configurations for contract trading,and
|
前端开发 数据挖掘 API
量化合约系统开发方案丨量化合约系统实现案例源码
量化合约系统开发是指开发一种能够自动化执行交易策略的软件系统,该系统能够根据预设的规则和条件自动执行交易,从而实现量化交易。
|
人工智能
量化合约系统开发(案例项目)丨合约量化系统开发(方案成熟)
 Artificial intelligence(AI)refers to the ability of computer systems to perform tasks similar to human intelligence.It is a complex technology,which constantly adjusts and improves its own algorithm by inputting a large amount of data into the algorithm for learning,so as to continuously optimize i
|
区块链
合约量化系统开发(项目及方案)丨合约量化系统开发(详细及源码)
  智能合约(Smart contract)是依托计算机在网络空间运行的合约,它以信息化方式传播、验证或执行合同,由计算机读取、执行,具备自助的特点。而区块链的去中心化,数据的防篡改,决定了智能合约更加适合于在区块链上来实现
|
人工智能 并行计算 PyTorch
合约量化系统开发(开发运营版)丨合约量化系统开发(策略及源码)
Artificial intelligence can be divided into two categories:weak artificial intelligence and strong artificial intelligence.Weak AI(also known as narrow AI)refers to AI systems that can only exhibit human intelligence in specific task areas.For example,voice recognition system,auto drive system,etc.S