コード例 #1
0
def test():
    print("Test StockProxySina")
    stock1 = Stock('01810', '小米集团-W', 'hangkong', 'hk')
    stock2 = Stock('002415', '海康威视', 'shenzhen', 'sz')
    sinaproxy = StockProxySina()
    stock1.addProxy(sinaproxy)
    print(stock1.getFullID() + "\tprice:" + str(stock1.getPrice()) + "\t" +
          str(stock1.getPriceDatetime()))
    stock2.addProxy(sinaproxy)
    print(stock2.getFullID() + "\tprice:" + str(stock2.getPrice()) + "\t" +
          str(stock2.getPriceDatetime()))
コード例 #2
0
ファイル: worker.py プロジェクト: jeckypei/stockMaster
 def addStock(self, config):
     stock = Stock(config["id"], config["name"], config["area"],
                   config["ex"])
     print("  Stock: " + stock.getFullID() + " " + stock.getName())
     self.stockSet[stock.getFullID()] = stock
     stock.setInfo(config)
     pass
コード例 #3
0
ファイル: load.py プロジェクト: fengwu2004/realgood-server
def formatData(lines):

    stock = Stock()

    if len(lines) > 1:

        values = lines[0].split(' ')

        stock.id = values[0]

        i = 1

        while values[i] != '日线':

            stock.name += values[i]

            i += 1

        lines.pop(0)

    if len(lines) <= 1:

        return stock

    for line in lines:

        dayvalue = DayValue()

        values = line.split('\t')

        if getTime(values[0]) < time.strptime('2017/1/01', '%Y/%m/%d'):

            continue

        dayvalue.date = values[0]

        dayvalue.open = float(values[1])

        dayvalue.high = float(values[2])

        dayvalue.low = float(values[3])

        dayvalue.close = float(values[4])

        dayvalue.tradeamount = float(values[5])

        dayvalue.tradevolume = float(values[6])

        stock.dayvalues.append(dayvalue)

    return stock