setDepthData method

dynamic setDepthData(
  1. dynamic codeId,
  2. dynamic value
)

Implementation

setDepthData(codeId, value) {
  //数据示例
  // value = {
  //   "asks": [ //卖盘
  //     {"price": "115383", "vol": "0.84"}, //price价格,vol数量(累加的值)
  //   ],
  //   "bids": [ //买盘
  //     {"price": "115382.6", "vol": "1.045"},//price价格,vol数量(累加的值)
  //   ],
  //   transactionPrice:115382.8,//最新成交价
  // }
  if (codeId != currentCodeId) {
    return;
  }
  depthData = value;
  depthDataAll = [
    ...value['bids'] ?? [],
    ...value['asks'] ?? []
  ]; //buy 买盘 sell卖盘
  depthDataAllL = depthDataAll.length;
  depthDataBuyL = value['bids']?.length ?? [].length;
  depthDataSellL = value['asks']?.length ?? [].length;
}