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)
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)
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
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
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
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
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
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
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)
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)
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
def bonds(self): raw = FTP.GET(self.ftp, pwd=self.file_list[0]) ret = NASDAQ.to_dict(raw) return ret, raw
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
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