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
Exemple #6
0
        def downloadData(self, filePath):
            url = (
                "https://www.gpw.pl/ajaxindex.php"
                "?action=GPWQuotations&start=showTable&tab=all&lang=PL&type=&full=1&format=html&download_xls=1"
            )

            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",
                                  type(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
Exemple #9
0
from stockmonitor import logger

from stockmonitor.dataaccess import download_html_content


## ============================= main section ===================================


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


logFile = logger.get_logging_output_file()
logger.configure( logFile )

_LOGGER = logging.getLogger(__name__)


_LOGGER.debug( "Starting the application" )


url = "https://www.stockwatch.pl/dywidendy/"

with tempfile.NamedTemporaryFile( mode='w+t' ) as tmpfile:
    output = tmpfile.name
    content = download_html_content( url, output )

    print( "content:" )
    print( content )