Exemplo n.º 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 test_parse_mb_transactions_data_badseparator_02(self):
        transactionsPath = get_data_path("transactions_bad_separator2.csv")
        with codecs.open(transactionsPath,
                         'r',
                         encoding='utf-8',
                         errors='replace') as srcFile:
            dataFrame = parse_mb_transactions_data(srcFile)

        self.assertEqual(dataFrame["currency"][0], "PLN")
        self.assertEqual(dataFrame["unit_price"][1], 4.42)
Exemplo n.º 3
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)
Exemplo n.º 4
0
    def test_importWalletTransactions_sametime(self):
        transactionsPath = get_data_path("transactions_bad_separator.csv")

        with codecs.open(transactionsPath,
                         'r',
                         encoding='utf-8',
                         errors='replace') as srcFile:
            importedData = parse_mb_transactions_data(srcFile)

        dataObject = DataObject()
        dataObject.importWalletTransactions(importedData)

        wallet: WalletData = dataObject.wallet
        self.assertEqual(wallet.size(), 1)

        trans: TransHistory = wallet["ENT"]
        amount = trans.currentAmount()
        self.assertEqual(amount, 0)
 def data_path():
     return get_data_path( "fin_reps_cal_publ_data.html" )
Exemplo n.º 6
0
 def data_path():
     return get_data_path( "espi_data.html" )
Exemplo n.º 7
0
 def data_path():
     return get_data_path( "isin_map_data.html" )
Exemplo n.º 8
0
 def data_path():
     return get_data_path( "indicators_data.html" )
 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)
Exemplo n.º 10
0
 def data_path():
     return get_data_path("wig20.chart.07-09.txt")
 def data_path():
     return get_data_path( "shortsellings-history.html" )
 def data_path():
     return get_data_path( "shortsellings-current.html" )
Exemplo n.º 13
0
## ============================= main section ===================================

if __name__ != '__main__':
    sys.exit(0)

app = QApplication(sys.argv)
app.setApplicationName("StockMonitor")
app.setOrganizationName("arnet")

# dataframe = DataFrame({'a': ['Mary', 'Jim', 'John'],
#                        'b': [100, 200, 300],
#                        'c': ['a', 'b', 'c']})

dataAccess = GpwCurrentStockData()
dataPath = data.get_data_path("akcje_2020-04-14_15-50.xls")
dataframe = dataAccess.dao.parseWorksheetFromFile(dataPath)

# csvPath = data.get_data_root_path() + "/akcje_2020-04-14_15-50.csv"
# dataframe.to_csv( csvPath, encoding='utf-8', index=False )

setup_interrupt_handling()

widget = StockFullTable()
widget.setColumnVisible(0, False)
widget.setColumnVisible(1, False)
widget.setColumnVisible(3, False)
widget.setColumnVisible(4, False)
widget.setColumnVisible(13, False)
widget.setColumnVisible(14, False)
widget.setColumnVisible(15, False)
Exemplo n.º 14
0
 def data_path():
     return get_data_path("akcje_2021-12-21_20-00.xls")
Exemplo n.º 15
0
 def data_path():
     return get_data_path("a_cgl_intraday_2020-08-17.prn")
 def data_path():
     return get_data_path("dividends_cal_data.html")
Exemplo n.º 17
0
 def data_path():
     return get_data_path("cdr.chart.04-09.txt")