Exemplo n.º 1
0
    def GetFittingData2(self, overlayData, defaultValue):
        dataLen = len(self.Data)
        result = JSComplierHelper.CreateArray(dataLen)
        i, j = 0, 0
        while i < dataLen:
            date = self.Data[i].Date
            if j >= len(overlayData):
                result[i] = SingleData()
                result[i].Date = date
                result[i].Value = defaultValue
                i += 1
                continue

            overlayDate = overlayData[j].Date

            if overlayDate == date:
                item = SingleData()
                item.Date = overlayData[j].Date
                item.Value = overlayData[j].Value
                result[i] = item
                j += 1
                i += 1
            elif overlayDate < date:
                j += 1
            else:
                result[i] = SingleData()
                result[i].Date = date
                result[i].Value = defaultValue
                i += 1

        return result
Exemplo n.º 2
0
    def GetFittingFinanceData(self, financeData):
        dataLen = len(self.Data)
        financeLen = len(financeData)
        result = JSComplierHelper.CreateArray(dataLen)

        i, j = 0, 0
        while i < dataLen:
            date = self.Data[i].Date
            if j + 1 < financeLen:
                if financeData[j].Date < date and financeData[j +
                                                              1].Date <= date:
                    j += 1
                    continue

            item = SingleData()
            item.Date = date
            if j < financeLen:
                item.Value = financeData[j].Value
                item.TestData = financeData[j].Date  # 财务日期 调试用
            else:
                item.Value = None
                item.TestData = None

            result[i] = item

            i += 1

        return result
Exemplo n.º 3
0
    def GetFittingMarketValueData(self, financeData):
        dataLen = len(self.Data)
        financeLen = len(financeData)
        result = JSComplierHelper.CreateArray(dataLen)

        i, j = 0, 0
        while i < dataLen:
            date = self.Data[i].Date
            price = self.Data[i].Close

            if j + 1 < financeLen:
                if financeData[j].Date < date and financeData[j +
                                                              1].Date <= date:
                    j += 1
                    continue

            item = SingleData()
            item.Date = date
            item.Value = financeData[j].Value * price  # 市值计算 收盘价*股数
            item.TestDate = financeData[j].Date  # 财务日期 调试用
            result[i] = item

            i += 1

        return result
Exemplo n.º 4
0
    def GetValue(self):
        dataLen = len(self.Data)
        result = JSComplierHelper.CreateArray(dataLen)

        for i in range(dataLen):
            if self.Data[i] and self.Data[i].Value != None:
                result[i] = self.Data[i].Value

        return result
Exemplo n.º 5
0
 def GetTime(self):
     result = JSComplierHelper.CreateArray(len(self.Data))
     for i in range(len(self.Data)):
         result[i] = self.Data[i].Time
     return result