量化合约系统开发(案例项目)丨合约量化系统开发(方案成熟)

简介:  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

  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 its performance.

  AI can be divided into two categories:weak AI and strong AI.Weak AI(also known as narrow AI)refers to AI systems that can only show human intelligence in specific task areas.For example,voice recognition system,auto drive system,etc.Strong artificial intelligence(also known as generalized artificial intelligence)refers to an artificial intelligence system that can display human-like intelligence in various task fields like humans.

  ERC20代币兑换ERC20代币的函数入口和ERC20代币兑换ETH的函数入口类似,不同的是ERC20代币兑换ERC20代币的函数入口在调用进行兑换的业务函数前会先用创建自身的工厂合约实现的getExchange函数来获取目标代币所在的兑换合约地址,然后再向目标兑换合约地址发送兑换请求,将在本合约兑换得到的ETH兑换成目标代币。

  函数入口调用到的函数就两种,分别是根据输入代币计算输出代币的tokenToTokenInput,以及根据输出代币计算输入代币的tokenToTokenOutput。

  下面先看tokenToTokenInput。

  private

  def tokenToTokenInput(tokens_sold:uint256,min_tokens_bought:uint256,min_eth_bought:uint256(wei),deadline:timestamp,buyer:address,recipient:address,exchange_addr:address)->uint256:
  assert(deadline>=block.timestamp and tokens_sold>0)and(min_tokens_bought>0 and min_eth_bought>0)

  assert exchange_addr!=self and exchange_addr!=ZERO_ADDRESS

  
  token_reserve:uint256=self.token.balanceOf(self)#获得支付代币的储备量

  #用getInputPrice计算所能兑换到的ETH

  eth_bought:uint256=self.getInputPrice(tokens_sold,token_reserve,as_unitless_number(self.balance))

  wei_bought:uint256(wei)=as_wei_value(eth_bought,'wei')#将单位转换成wei

  assert wei_bought>=min_eth_bought

相关文章
|
11月前
|
存储 安全 区块链
秒合约系统开发|量化合约跟单系统开发(成熟源码)案例
但是也只是在非常具体的情况下。可扩展性问题使得它并不能被广泛的应用
|
数据挖掘 机器人 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)是指计算机系统在完成类似人类智力所需的任务时所表现出来的能力。它是一种复杂的技术,通过将大量的数据输入到算法中进行学习,不断调整和改进自己的算法,从而不断优化其性能。
|
区块链
合约量化系统开发(项目及方案)丨合约量化系统开发(详细及源码)
  智能合约(Smart contract)是依托计算机在网络空间运行的合约,它以信息化方式传播、验证或执行合同,由计算机读取、执行,具备自助的特点。而区块链的去中心化,数据的防篡改,决定了智能合约更加适合于在区块链上来实现
|
存储 5G
量化合约系统开发(策略源码)丨合约量化系统开发(成熟项目)
 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
|
人工智能 并行计算 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
量化合约项目系统开发技术丨合约量化系统开发流程方案
量化合约项目系统开发技术丨合约量化系统开发流程方案
142 0
|
传感器 存储 安全
what合约量化系统开发源码搭建丨量化合约系统开发技术搭建
what合约量化系统开发源码搭建丨量化合约系统开发技术搭建
|
机器学习/深度学习 数据可视化 Linux
ppt量化合约系统开发丨合约量化系统开发丨量化合约策略开发方案
ppt量化合约系统开发丨合约量化系统开发丨量化合约策略开发方案
110 0