Esempio n. 1
0
    def test_01_download_file(self):
        target = 'test_ftp_server'
        target = globals().get(target, None)
        r = TEST.init(server=target)

        target = 'test_ftp_file'
        target = globals().get(target, None)
        ret = TEST.GET(r, pwd=target)

        logging.debug(ret)
Esempio n. 2
0
    def test_02_list_remote_directories(self):
        target = 'test_ftp_server'
        target = globals().get(target, None)
        r = TEST.init(server=target)

        target = 'test_ftp_dir'
        target = globals().get(target, None)
        ret = TEST.LIST(r, pwd='symboldirectory')

        logging.info(ret)
Esempio n. 3
0
 def funds(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[7])
     ret = NASDAQ.to_dict(raw)
     ret = map(lambda row: TRANSFORM_FUND.Type(row), ret)
     ret = map(lambda row: TRANSFORM_FUND.Category(row), ret)
     ret = list(ret)
     return ret, raw
Esempio n. 4
0
 def listed(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[9])
     temp = NASDAQ.to_dict(raw)
     ret, test_list = NASDAQ_FILTER.test(temp)
     ret = map(lambda row: TRANSFORM_STOCK.Market(row), ret)
     ret = map(lambda row: TRANSFORM_STOCK.Finance(row), ret)
     return ret, raw
Esempio n. 5
0
 def participants(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[8])
     ret = NASDAQ.to_list(raw)
     ret = map(lambda row: TRANSFORM_PARTICIPANT.Type(row), ret)
     ret = NASDAQ.to_dict('MPID', *ret)
     ret = NASDAQ.to_pandas(**ret)
     return ret, raw
Esempio n. 6
0
    def other(self):
        raw = FTP.GET(self.ftp, pwd=self.file_list[13])
        ret = NASDAQ.to_list(raw)
        logging.debug(len(ret))
        ret = map(lambda row: TRANSFORM_STOCK.Exchange2(row), ret)
        ret = NASDAQ.to_dict('NASDAQ Symbol', *ret)
        logging.debug(len(ret))
        ret = NASDAQ.to_pandas(**ret)

        test = ret[ret['Test Issue'] == 'Y']
        ret = ret[ret['Test Issue'] == 'N']
        logging.debug(test)
        return ret, raw
Esempio n. 7
0
 def __call__(self):
     logging.info(dir(self))
     ret = FTP.LIST(self.ftp, pwd='symboldirectory')
     ret = set(ret)
     file_list = set(NASDAQ.file_list)
     lhs = ret - file_list
     rhs = file_list - ret
     if len(lhs) > 0:
         logging.warn(lhs)
     if len(rhs) > 0:
         logging.warn(rhs)
     for i, name in enumerate(self.file_list):
         logging.info((i, name))
     return ret
Esempio n. 8
0
    def traded(self):
        raw = FTP.GET(self.ftp, pwd=self.file_list[10])
        ret = NASDAQ.to_list(raw)
        ret = map(lambda row: TRANSFORM_STOCK.Market(row), ret)
        ret = map(lambda row: TRANSFORM_STOCK.Finance(row), ret)
        ret = map(lambda row: TRANSFORM_STOCK.Exchange(row), ret)
        ret = NASDAQ.to_dict('Symbol', *ret)
        ret = NASDAQ.to_pandas(**ret)

        keys = ret.filter(regex="Test", axis=1).values.ravel()
        keys = pd.unique(keys)
        logging.info(keys)

        test = ret[ret['Test Issue'] == 'Y']
        ret = ret[ret['Test Issue'] == 'N']
        logging.debug(test)
        return ret, raw
Esempio n. 9
0
 def test_01_(self):
     test = TEST.init()
     logging.info(vars(test))
     logging.info(dir(test))
     logging.info(type(test))
     logging.info(type(test.ftp))
     logging.info(vars(test.ftp))
     ret = FTP.LIST(test.ftp, pwd='symboldirectory')
     ret = set(ret)
     file_list = set(TEST.file_list)
     lhs = ret - file_list
     rhs = file_list - ret
     if len(lhs) > 0:
         logging.warn(lhs)
     if len(rhs) > 0:
         logging.warn(rhs)
     for i, name in enumerate(test.file_list):
         logging.info((i, name))
     logging.info(ret)
Esempio n. 10
0
def main():
    r = FTP.init(server='ftp.nasdaqtrader.com')
    r = FTP.GET(r, pwd='/symboldirectory/mfundslist.txt')
    logging.debug(r)
    n = FTP.LIST(r, pwd='symboldirectory')
    logging.info(n)
Esempio n. 11
0
 def init(cls):
     ftp = FTP.init(server=cls.url)
     file_list = map(lambda x: '/symboldirectory/{}'.format(x),
                     cls.file_list)
     ret = cls(ftp, *file_list)
     return ret
Esempio n. 12
0
 def bonds(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[0])
     ret = NASDAQ.to_dict(raw)
     return ret, raw
Esempio n. 13
0
 def other(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[13])
     temp = NASDAQ.to_dict(raw)
     ret, test_list = NASDAQ_FILTER.test(temp)
     ret = map(lambda row: TRANSFORM_STOCK.Exchange2(row), ret)
     return ret, raw
Esempio n. 14
0
 def bonds(self):
     raw = FTP.GET(self.ftp, pwd=self.file_list[0])
     ret = NASDAQ.to_list(raw)
     ret = NASDAQ.to_dict('Symbol', *ret)
     ret = NASDAQ.to_pandas(**ret)
     return ret, raw