Esempio n. 1
0
def mainSource():
    #初始全局行情对象
    from myGlobal import gol
    gol._Init()  #先必须在主模块初始化(只在Main模块需要一次即可)
    if (gol._Get_Setting('quoteSource', None) == None):
        #示例数据监控(暂只支持单源,多源需要调整完善)
        import mySource_Sina_Stock
        pQuote = mySource_Sina_Stock.Source_Sina_Stock()

        #添加监听对象
        import myListener_Printer, myListener_Rise_Fall_asInt, myListener_Hourly, myListener_FixedMonitor
        pQuote.addListener(myListener_Printer.Quote_Listener_Printer())
        pQuote.addListener(myListener_Hourly.Quote_Listener_Hourly())
        pQuote.addListener(
            myListener_Rise_Fall_asInt.Quote_Listener_Rise_Fall_asInt())
        #for x in pSets.setUsers:
        #    pQuote.addListener(myListener_FixedMonitor.Quote_Listener_FixedMonitor(x))

        gol._Set_Value('quoteSource', pQuote)  #实例 行情对象
        return pQuote
Esempio n. 2
0
                    self.OnHandleMsg(quoteDatas, strMsg, 5 * x)  # 多次延时提醒
                    print(strMsg)

    #功能是否可用
    def IsEnable(self, quoteDatas):
        return False


#主启动程序--测试
if __name__ == "__main__":
    import time
    import mySource_Sina_Stock
    import myListener_Printer, myListener_Rise_Fall_asInt, myListener_Hourly

    #示例数据监控(暂只支持单源,多源需要调整完善)
    pQuote = mySource_Sina_Stock.Source_Sina_Stock('sz002124')
    pListener = Quote_Listener_FixedMonitor()
    pQuote.addListener(pListener)
    pQuote.addListener(myListener_Printer.Quote_Listener_Printer())

    #添加固定监测项
    key = '天邦股份'
    #pListener._addMonitor(key, myListener_Fixed(10.8, 11.2, 1000, "2018-08-19"))
    #pListener._addMonitor(key, myListener_Fixed(11.8, 11.5, 1000, "2018-08-19"))
    #pListener._addMonitor(key, myListener_Fixed(10.8, 0.03, 1000, "2018-08-19"))
    #pListener._addMonitor(key, myListener_Fixed(11.8, -0.04, 1000, "2018-08-19"))
    pListener._addMonitor(key, myListener_Fixed(5.36, -0.04, 0, "2018-08-19"))
    pListener._addMonitor(key, myListener_Fixed(5.33, 0.06, 0, "2018-08-19"))

    #查询数据
    while True:
Esempio n. 3
0
    #测试
    #key = '建设银行'
    #pListener.DoRecvQuote(0.032, key)
    #pListener.DoRecvQuote(0.041, key)
    #pListener.DoRecvQuote(0.0453, key)
    #pListener.DoRecvQuote(0.0152, key)
    #pListener.DoRecvQuote(0.01, key)
    #pListener.DoRecvQuote(0.0, key)
    #pListener.DoRecvQuote(-0.0051, key)
    #pListener.DoRecvQuote(-0.0152, key)
    #pListener.DoRecvQuote(-0.0453, key)
    #pListener.DoRecvQuote(-0.012, key)
    #pListener.DoRecvQuote(0.0, key)
    #pListener.DoRecvQuote(0.051, key)

    import time
    import mySource_Sina_Stock
    import myListener_Printer, myListener_Hourly

    #示例数据监控(暂只支持单源,多源需要调整完善)
    pQuote = mySource_Sina_Stock.Source_Sina_Stock('sh600060')
    pQuote.addListener(Quote_Listener_Rise_Fall_asInt())
    pQuote.addListener(myListener_Printer.Quote_Listener_Printer())

    #查询数据
    while True:
        pQuote.query()
        time.sleep(3)

    print()