| | |
| | | # -*- coding: utf-8 -*- |
| | | import json |
| | | import logging |
| | | import marshal |
| | | import multiprocessing |
| | | import queue |
| | | import threading |
| | |
| | | self.upload_l2_data_task_dict.pop(code) |
| | | |
| | | def __upload_l2_data(self, code, _queue, datas): |
| | | _queue.put_nowait((code, datas, time.time())) |
| | | _queue.put_nowait(marshal.dumps([code, datas, time.time()])) |
| | | |
| | | # 处理订单数据并上传 |
| | | def __run_upload_order_task(self, code): |
| | |
| | | # 下单时间不一致 |
| | | need_update = True |
| | | |
| | | if not need_update and real_place_index_data["val"]["num"] != volume: |
| | | if not need_update and real_place_index_data["val"]["num"] != volume//100: |
| | | # 下单量不一致 |
| | | need_update = True |
| | | |
| | |
| | | continue |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if volume != val["num"]: |
| | | if volume//100 != val["num"]: |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2( |
| | | code, |
| | |
| | | """ |
| | | L2数据监听 |
| | | """ |
| | | import marshal |
| | | import multiprocessing |
| | | import threading |
| | | import time |
| | |
| | | while True: |
| | | # datas_dict = {} |
| | | try: |
| | | if not q.empty(): |
| | | item = q.get() |
| | | self.my_l2_data_callback.OnL2Order(item[0], item[1], item[2]) |
| | | else: |
| | | time.sleep(0.001) |
| | | # if not q.empty(): |
| | | item = q.get() |
| | | item = marshal.loads(item) |
| | | self.my_l2_data_callback.OnL2Order(item[0], item[1], item[2]) |
| | | # else: |
| | | # time.sleep(0.001) |
| | | |
| | | # while not q.empty(): |
| | | # item = q.get() |
| | |
| | | # time.sleep(0.01) |
| | | if not q.empty(): |
| | | item = q.get() |
| | | item = marshal.loads(item) |
| | | self.my_l2_data_callback.OnL2Transaction(item[0], item[1]) |
| | | else: |
| | | time.sleep(0.005) |
| | |
| | | blocks = [] |
| | | try: |
| | | _bks = __getConceptJXBK(code) |
| | | print(_bks) |
| | | if _bks: |
| | | blocks.extend(_bks) |
| | | except: |
| | |
| | | |
| | | try: |
| | | _bks = __getConceptBK(code) |
| | | print(_bks) |
| | | if _bks: |
| | | blocks.extend(_bks) |
| | | except: |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(getCodeBlocks("600822")) |
| | | print(getCodeBlocks("002350")) |