mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-05 21:38:24 +08:00
27 lines
622 B
C++
27 lines
622 B
C++
"""
|
|
This pattern is used to allow a single broadcaster to publish messages to many subscribers,
|
|
which may choose to limit which messages they receive.
|
|
"""
|
|
import datetime
|
|
import time
|
|
import pynng
|
|
from hikyuu.gui.collect import *
|
|
|
|
address = "ipc:///tmp/pubsub.ipc"
|
|
|
|
|
|
def get_current_date():
|
|
return str(datetime.datetime.now())
|
|
|
|
|
|
pub_sock = pynng.Pub0()
|
|
pub_sock.listen(address)
|
|
while True:
|
|
#date = get_current_date()
|
|
records = get_spot_parallel(['sh000001', 'sz000001'])
|
|
print(len(records))
|
|
buf = create_fb_spot(records)
|
|
pub_sock.send(bytes(buf))
|
|
#pub_sock.send(date.encode())
|
|
time.sleep(3)
|