| | |
| | | FirstLevelSellOrderVolumes): |
| | | # 传入:时间,现价,成交总量,买1,买2,买3,买4,买5,卖1,卖2,卖3,卖4,卖5 |
| | | try: |
| | | buys = [(pDepthMarketData['BidPrice1'], pDepthMarketData['BidVolume1']), |
| | | (pDepthMarketData['BidPrice2'], pDepthMarketData['BidVolume2']), |
| | | (pDepthMarketData['BidPrice3'], pDepthMarketData['BidVolume3']), |
| | | (pDepthMarketData['BidPrice4'], pDepthMarketData['BidVolume4']), |
| | | (pDepthMarketData['BidPrice5'], pDepthMarketData['BidVolume5'])] |
| | | for i in range(6, 11): |
| | | if not pDepthMarketData[f"BidVolume{i}"]: |
| | | break |
| | | buys.append((pDepthMarketData[f'BidPrice{i}'], pDepthMarketData[f'BidVolume{i}'])) |
| | | |
| | | sells = [ |
| | | (pDepthMarketData['AskPrice1'], pDepthMarketData['AskVolume1']), |
| | | (pDepthMarketData['AskPrice2'], pDepthMarketData['AskVolume2']), |
| | | (pDepthMarketData['AskPrice3'], pDepthMarketData['AskVolume3']), |
| | | (pDepthMarketData['AskPrice4'], pDepthMarketData['AskVolume4']), |
| | | (pDepthMarketData['AskPrice5'], pDepthMarketData['AskVolume5']) |
| | | ] |
| | | for i in range(6, 11): |
| | | if not pDepthMarketData[f"AskVolume{i}"]: |
| | | break |
| | | sells.append((pDepthMarketData[f'AskPrice{i}'], pDepthMarketData[f'AskVolume{i}'])) |
| | | |
| | | d = {"dataTimeStamp": pDepthMarketData['DataTimeStamp'], "securityID": pDepthMarketData['SecurityID'], |
| | | "lastPrice": pDepthMarketData['LastPrice'], |
| | | "totalVolumeTrade": pDepthMarketData['TotalVolumeTrade'], |
| | | "totalValueTrade": pDepthMarketData['TotalValueTrade'], |
| | | "totalAskVolume": pDepthMarketData['TotalAskVolume'], |
| | | "avgAskPrice": pDepthMarketData["AvgAskPrice"], |
| | | "buy": [(pDepthMarketData['BidPrice1'], pDepthMarketData['BidVolume1']), |
| | | (pDepthMarketData['BidPrice2'], pDepthMarketData['BidVolume2']), |
| | | (pDepthMarketData['BidPrice3'], pDepthMarketData['BidVolume3']), |
| | | (pDepthMarketData['BidPrice4'], pDepthMarketData['BidVolume4']), |
| | | (pDepthMarketData['BidPrice5'], pDepthMarketData['BidVolume5'])], |
| | | "sell": [ |
| | | (pDepthMarketData['AskPrice1'], pDepthMarketData['AskVolume1']), |
| | | (pDepthMarketData['AskPrice2'], pDepthMarketData['AskVolume2']), |
| | | (pDepthMarketData['AskPrice3'], pDepthMarketData['AskVolume3']), |
| | | (pDepthMarketData['AskPrice4'], pDepthMarketData['AskVolume4']), |
| | | (pDepthMarketData['AskPrice5'], pDepthMarketData['AskVolume5']) |
| | | ]} |
| | | "buy": buys, |
| | | "sell": sells} |
| | | market_code_dict[pDepthMarketData['SecurityID']] = time.time() |
| | | self.l2_data_upload_manager.add_market_data(d) |
| | | except: |