欢迎光临散文网 会员登陆 & 注册

量化合约/合约量化/秒合约/永续合约/合约跟单/现货期权期货/交易所系统开发技术详细

2023-02-26 10:26 作者:bili_16249894763  | 我要投稿

  量化合约指的是目标或任务具体明确,可以清晰度量。根据不同情况,表现为数量多少,具体的统计数字,范围衡量,时间长度等等。所谓量化就是把经过抽样得到的瞬时值将其幅度离散,即用一组规定的电平,把瞬时抽样值用最接近的电平值来表示。经过抽样的图像,只是在空间上被离散成为像素(样本)的阵列。而每个样本灰度值还是一个由无穷多个取值的连续变化量,必须将其转化为有限个离散值,赋予不同码字才能真正成为数字图像。这种转化称为量化。


  def handle_bar(context,bar_dict):


  ...


  if newPrice>=context.nextSellPrice:


  logger.info("执行高抛交易,对应价格:{}".format(newPrice))


  amount=context.portfolio.positions[context.s1].quantity


  if amount>=context.tradeNumber:开发模式I35流程7O98设计O7I8


  logger.info("执行高抛交易,对应数量:{}".format(context.tradeNumber))


  order_shares(context.s1,-context.tradeNumber)


  plot("S",newPrice)


  elif amount>=100:


  logger.info("执行高抛交易,对应数量:{}".format(amount))


  order_shares(context.s1,-amount)


  plot("S",newPrice)


  calc_next_trade_price(context,newPrice)


  obj={案例及源码:MrsFu123


  "nextSellPrice":context.nextSellPrice,


  "nextBuyPrice":context.nextBuyPrice,


  "curTradePrice":context.curTradePrice


  }


  context.buyTradeList.append(obj)


  if newPrice<=context.nextBuyPrice:


  logger.info("执行低吸交易,对应价格:{}".format(newPrice))


  amount=int(context.portfolio.cash/newPrice/100.0)*100


  if amount>=context.tradeNumber:


  logger.info("执行低吸交易,对应数量:{}".format(context.tradeNumber))


  order_shares(context.s1,context.tradeNumber)


  plot("B",newPrice)


  calc_next_trade_price(context,newPrice)


  obj={


  "nextSellPrice":context.nextSellPrice,


  "nextBuyPrice":context.nextBuyPrice,


  "curTradePrice":context.curTradePrice


  }


  context.sellTradeList.append(obj)


量化合约/合约量化/秒合约/永续合约/合约跟单/现货期权期货/交易所系统开发技术详细的评论 (共 条)

分享到微博请遵守国家法律