Exemple #1
0
        def downloadData(self, filePath):
            url = ("https://strefainwestorow.pl/dane/raporty/lista-dat-publikacji-raportow-okresowych/wszystkie"
                   "?sort=asc&order=Data%20publikacji" )

            relPath = os.path.relpath( filePath )
            _LOGGER.debug( "grabbing data from url[%s] as file[%s]", url.split("?", maxsplit=1)[0], relPath )

            try:
                download_html_content( url, filePath )
            except BaseException as ex:
                _LOGGER.exception( "unable to load object data -- %s: %s", fullname(ex), ex, exc_info=False )
                raise
        def downloadData(self, filePath):
            url = self.getDataUrl()

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                download_html_content(url, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
Exemple #3
0
        def downloadData(self, filePath):
            url = "https://gpwbenchmark.pl/ajaxindex.php?action=GPWIndexes&start=showTable&tab=sectorbased&lang=PL"

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                download_html_content(url, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
Exemple #4
0
        def downloadData(self, filePath):
            modeCode = mode_code(self.rangeCode)
            #         currTimestamp = self.dataTime.timestamp()
            url = generate_chart_data_url(self.isin, modeCode)

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                download_html_content(url, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
Exemple #5
0
        def downloadData(self, filePath):
            ## this source does not seem to be viable,
            ## because it lacks a lot of tickers/isin values
            url = "http://infostrefa.com/infostrefa/pl/spolki"

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                download_html_content(url, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
        def downloadData(self, filePath):
            url = self.getDataUrl()

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                response = grab_content(url, "j_idt8-j_idt16")
                with open(filePath, "w", encoding="utf-8") as text_file:
                    text_file.write(response)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
Exemple #7
0
        def downloadData(self, filePath):
            offset = 0
            url = "https://www.gpw.pl/ajaxindex.php" \
                  "?action=GPWEspiReportUnion&start=ajaxSearch&page=komunikaty&format=html&lang=PL&letter=" \
                  "&offset=" + str(offset) + \
                  "&limit="  + str(self.messagesLimit) + \
                  "&categoryRaports%5B%5D=EBI&categoryRaports%5B%5D=ESPI" \
                  "&typeRaports%5B%5D=RB&typeRaports%5B%5D=P&typeRaports%5B%5D=Q" \
                  "&typeRaports%5B%5D=O&typeRaports%5B%5D=R" \
                  "&search-xs=&searchText=&date="

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                download_html_content(url, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise
        def downloadData(self, filePath):
            dateString = self.dataDate.isoformat()
            url = f"https://info.bossa.pl/pub/intraday/mstock/daily/{dateString}-tick.zip"

            #         if self.dataDate == currDate:
            #             ## https://info.bossa.pl/pub/intraday/mstock/daily//tick.zip
            #             return "https://info.bossa.pl/pub/intraday/mstock/daily//tick.zip"
            #         else:
            #             ## https://info.bossa.pl/pub/intraday/mstock/daily//2020-09-28-tick.zip
            #             dateString = self.dataDate.isoformat()
            #             return "https://info.bossa.pl/pub/intraday/mstock/daily//%s-tick.zip" % dateString

            relPath = os.path.relpath(filePath)
            _LOGGER.debug("grabbing data from url[%s] as file[%s]",
                          url.split("?", maxsplit=1)[0], relPath)

            try:
                zipPath = filePath + ".zip"
                download_html_content(url, zipPath)

                ## extract downloaded file
                _LOGGER.debug("extracting zip[%s]", zipPath)
                with tempfile.TemporaryDirectory() as tmpdir:
                    zipMember = "a_cgl.prn"
                    with zipfile.ZipFile(zipPath, 'r') as zip_ref:
                        zip_ref.extract(zipMember, path=tmpdir)
                        tmpFile = os.path.join(tmpdir, zipMember)
                        _LOGGER.debug("moving extracted file[%s] to [%s]",
                                      tmpFile, filePath)
                        shutil.move(tmpFile, filePath)
            except BaseException as ex:
                _LOGGER.exception("unable to load object data -- %s: %s",
                                  fullname(ex),
                                  ex,
                                  exc_info=False)
                raise