合约量化开发(稳定版)丨合约量化系统开发策略及分析丨合约量化系统demo源码

130 阅读1分钟

For quantitative trading, the most important thing is the establishment of models. Generally speaking, using modern statistical and mathematical methods, computer technology is used to find laws that can bring excess returns from massive historical data to formulate strategies, and mathematical models are used to verify and solidify these laws and strategies, and then strictly implement them through programmed trading

  在Join函数中可以写策略逻辑:开仓、平仓等。

  def Join(self):

  lastPrice=0#上根k线的收盘价

  while True:

  if self.status==0:开发需求I35逻辑7O98案例O7I8

  if not self.md_queue.empty():

  makeData=self.md_queue.get(True)

  #撤单

  if self.local_position_dict:关于区块链项目技术开发唯:MrsFu123,代币发行、dapp智能合约开发、链游开发、多链钱包开发

  交易所开发、量化合约开发、互助游戏开发、Nft数字藏品开发、众筹互助开发、元宇宙开发、swap开发、

  链上合约开发、ido开发、商城开发等,开发过各种各样的系统模式,更有多种模式、制度、案例、后台等,成熟技术团队,欢迎实体参考。

  if self.local_position_dict[self.tickData['InstrumentID']]['Volume']!=0:

  self.req_remove(self.tickData)

  print(f"====={makeData}")

  #亏损超8个点止损,回撤6个点止损

  for instrument_id,position in self.local_position_dict.items():

  if self.symbol_close[instrument_id]==1:

  if instrument_id not in self.md_dict.keys():

  break

  if position['Volume']!=0 and position['Direction']==b'0':

  self.sell_close(b'',instrument_id,makeData['LastPrice']-6,1)

  print(f"卖平仓:{lastPrice},{makeData['LastPrice']}")

  else:开发需求I59详细2OO7开发3O69

  self.buy_close(b'',instrument_id,makeData['LastPrice']+6,1)

  print(f"买平仓:{lastPrice},{makeData['LastPrice']}")

  if lastPrice!=0:

  sleep(1)#时间是59s的时候休眠1s,0s时开仓

  if makeData['LastPrice']>=lastPrice:

  self.buy_open(b'',b'p2209',makeData['LastPrice']+6,1)

  print(f"买开仓:{lastPrice},{makeData['LastPrice']}")

  else:

  self.sell_open(b'',b'p2209',makeData['LastPrice']-6,1)

  print(f"卖开仓:{lastPrice},{makeData['LastPrice']}")

  lastPrice=makeData['LastPrice']

  #初始化为最新价

  self.HighPrice=makeData['LastPrice']

  self.LowPrice=makeData['LastPrice']

  else:

  sleep(1)

  #止盈止损

  self.check_position()