示例#1
0
    def test_getWalletState_recent(self):
        dataobject = DataObject()
        dataobject.matchTransactionsRecent()

        dataPath = data.get_data_path("akcje_2021-12-21_20-00.xls")
        dataobject.gpwCurrentSource.stockData.dao.storage = WorksheetStorageMock(
        )
        dataobject.gpwCurrentSource.stockData.dao.parseWorksheetFromFile(
            dataPath)

        ## CDP curr price: 360.0 (from recent_data_TKO.xls)
        dataobject.wallet.add("CDR", -1, 300.0,
                              datetime.datetime(2020, 10, 6, 15, 41, 33))
        dataobject.wallet.add("CDR", 1, 260.0,
                              datetime.datetime(2020, 10, 5, 15, 41, 33))
        dataobject.wallet.add("CDR", 1, 200.0,
                              datetime.datetime(2020, 10, 4, 15, 41, 33))

        walletVal, walletProfit, change, gain, overallProfit = dataobject.getWalletState(
            False)
        self.assertEqual(walletVal, 191.36)
        self.assertEqual(walletProfit, -8.64)
        self.assertEqual(change, '-0.87%')
        self.assertEqual(gain, 40.0)
        self.assertEqual(overallProfit, 31.36)
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = DividendsCalendarData()

        def data_path():
            return get_data_path("dividends_cal_data.html")

        self.dataAccess.dao.getDataPath = data_path  # type: ignore
        self.dataAccess.dao.storage = WorksheetStorageMock()
        self.dataAccess.dao.parseWorksheetFromFile(data_path())
示例#3
0
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = MetaStockIntradayData()

        def data_path():
            return get_data_path("a_cgl_intraday_2020-08-17.prn")

        self.dataAccess.dao.getDataPath = data_path  # type: ignore
        self.dataAccess.dao.downloadData = lambda filePath: None  ## empty lambda function
        self.dataAccess.dao.storage = WorksheetStorageMock()
示例#4
0
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = GpwIsinMapData()

        def data_path():
            return get_data_path( "isin_map_data.html" )

        self.dataAccess.dao.getDataPath = data_path           # type: ignore
        self.dataAccess.dao.storage = WorksheetStorageMock()
        self.dataAccess.dao.parseWorksheetFromFile( data_path() )
示例#5
0
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = GpwCurrentIndexIntradayData("PL9999999987")

        def data_path():
            return get_data_path("wig20.chart.07-09.txt")

        self.dataAccess.dao.getDataPath = data_path  # type: ignore
        self.dataAccess.dao.storage = WorksheetStorageMock()
        self.dataAccess.dao.parseWorksheetFromFile(data_path())
示例#6
0
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = GpwCurrentStockIntradayData("PLOPTTC00011")

        def data_path():
            return get_data_path("cdr.chart.04-09.txt")

        self.dataAccess.dao.getDataPath = data_path  # type: ignore
        self.dataAccess.dao.downloadData = lambda filePath: None  ## empty lambda function
        self.dataAccess.dao.storage = WorksheetStorageMock()
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = HistoryShortSellingsData()

        def data_path():
            return get_data_path( "shortsellings-history.html" )

        self.dataAccess.dao.getDataPath = data_path           # type: ignore
        self.dataAccess.dao.storage = WorksheetStorageMock()
        self.dataAccess.dao.parseWorksheetFromFile( data_path() )
def make_intraday( isin, rangeCode ):
    dataAccess = GpwCurrentIndexIntradayData( isin, rangeCode )

    def data_path():
        return get_data_path( "wig20.chart.07-09.txt" )

    dataAccess.getDataPath = data_path           # type: ignore
    dataAccess.storage = WorksheetStorageMock()
    dataAccess.dao.parseWorksheetFromFile( data_path() )
    return dataAccess
    def _loadData(self):
        dataAccess = MetaStockIntradayData()

        def data_path():
            return get_data_path( "a_cgl_intraday_2020-08-17.prn" )

        dataAccess.dao.getDataPath = data_path                      # type: ignore
        dataAccess.dao.downloadData = lambda filePath: None         ## empty lambda function
        dataAccess.dao.storage = WorksheetStorageMock()
        return dataAccess.getWorksheetData( True )
示例#10
0
    def setUp(self):
        ## Called before testfunction is executed
        self.dataAccess = GpwCurrentStockData()

        def data_path():
            return get_data_path("akcje_2021-12-21_20-00.xls")

        self.dataAccess.dao.getDataPath = data_path  # type: ignore
        self.dataAccess.dao.storage = WorksheetStorageMock()
        self.dataAccess.dao.parseWorksheetFromFile(data_path())
示例#11
0
 def test_getWalletStock(self):
     dataobject = DataObject()
     dataPath = data.get_data_path("recent_data_TKO.xls")
     dataobject.gpwCurrentSource.stockData.dao.storage = WorksheetStorageMock(
     )
     dataobject.gpwCurrentSource.stockData.dao.parseWorksheetFromFile(
         dataPath)
     dataobject.wallet.add("CDR", 1, 300.0)
     stock = dataobject.getWalletStock()
     self.assertEqual(stock is not None, True)
    def _loadData(self, isin):
#         name, isin   = paramsList
        intradayData = GpwCurrentStockIntradayData( "PLOPTTC00011" )

        def data_path():
            return get_data_path( "cdr.chart.04-09.txt" )

        intradayData.dao.getDataPath = data_path           # type: ignore
        intradayData.dao.storage = WorksheetStorageMock()
        worksheet = intradayData.dao.parseWorksheetFromFile( data_path() )
        return worksheet
示例#13
0
def prepare_dataobject():
    data = DataObject()
    dataAccess = GpwCurrentStockIntradayData("PLOPTTC00011")

    def data_path():
        return get_data_path("cdr.chart.04-09.txt")

    dataAccess.dao.getDataPath = data_path  # type: ignore
    dataAccess.dao.downloadData = lambda filePath: None  ## empty lambda function
    dataAccess.dao.storage = WorksheetStorageMock()

    #     data.gpwStockIntradayData.set( "PLOPTTC00011", dataAccess )
    #     data.gpwStockIntradayData.set( "CRD", dataAccess )
    return data
 def test_parseWorksheetFromFile(self):
     filePath = get_data_path( "global_indexes_data.html" )
     self.dataAccess.dao.storage = WorksheetStorageMock()
     currData = self.dataAccess.dao.parseWorksheetFromFile( filePath )
     dataLen = len( currData )
     self.assertEqual(dataLen, 48)