예제 #1
0
def testQuoteDiffValuesInformer():
    inform = QuoteDiffValuesInformer('510050', [-0.009,-0.019,-0.029], [0.009, 0.019, 0.029], '10.0')
    qd = QuoteData()
    qd.id = '510050'
    qd.lastPrice = '10.0'
    qd.preClose = '10.0'
    qd.lowPrice = '0'
    qd.highPrice = '0'
    for v in ['10.001', '10.010', '10.020', '10.030', '10.040', '9.990', '9.980', '9.970', '9.960', '10.0']:
        qd.lastPrice = v
        inform.OnRecvQuote(qd)
        sleep(3)
예제 #2
0
def testQuoteDiffValuesInformer():
    inform = QuoteDiffValuesInformer('510050', [-0.009, -0.019, -0.029],
                                     [0.009, 0.019, 0.029], '10.0')
    qd = QuoteData()
    qd.id = '510050'
    qd.lastPrice = '10.0'
    qd.preClose = '10.0'
    qd.lowPrice = '0'
    qd.highPrice = '0'
    for v in [
            '10.001', '10.010', '10.020', '10.030', '10.040', '9.990', '9.980',
            '9.970', '9.960', '10.0'
    ]:
        qd.lastPrice = v
        inform.OnRecvQuote(qd)
        sleep(3)
예제 #3
0
        self.outfile = open(self.filename, 'a+')
        self.outfile.write(QuoteData.csvHead())
        self.outfile.close()

    def OnRecvQuote(self, quoteData):
        if cmp(self.stockid, quoteData.id) == 0 :
            self.outfile = open(self.filename, 'a+')
            self.outfile.write(quoteData.toCSVString())
            self.outfile.close()

#def testQuoteSaveToCSV():
if __name__ == '__main__':
    d = QuoteData()
    d.name = "ETF300"
    d.id = "510300"
    d.lastPrice = "2.130"
    d.preClose = "2.108"
    d.openPrice = "2.084"
    d.lowPrice = "2.078"
    d.highPrice = "2.160"
    d.date = "2014-04-03"
    d.time = "15:05:03"
    inform = QuoteSaveToCSV("510300")
    inform.OnRecvQuote(d)
    d.lastPrice = "2.530"
    inform.OnRecvQuote(d);
    sleep(5)
    d.lastPrice = "1.981"
    inform.OnRecvQuote(d);
    
예제 #4
0
        self.outfile = open(self.filename, 'a+')
        self.outfile.write(QuoteData.csvHead())
        self.outfile.close()

    def OnRecvQuote(self, quoteData):
        if cmp(self.stockid, quoteData.id) == 0:
            self.outfile = open(self.filename, 'a+')
            self.outfile.write(quoteData.toCSVString())
            self.outfile.close()


#def testQuoteSaveToCSV():
if __name__ == '__main__':
    d = QuoteData()
    d.name = "ETF300"
    d.id = "510300"
    d.lastPrice = "2.130"
    d.preClose = "2.108"
    d.openPrice = "2.084"
    d.lowPrice = "2.078"
    d.highPrice = "2.160"
    d.date = "2014-04-03"
    d.time = "15:05:03"
    inform = QuoteSaveToCSV("510300")
    inform.OnRecvQuote(d)
    d.lastPrice = "2.530"
    inform.OnRecvQuote(d)
    sleep(5)
    d.lastPrice = "1.981"
    inform.OnRecvQuote(d)