Пример #1
0
    def test_100(self):
        ft = FactorTable(conn, cik_dt='datetime', cik_iid='code', strict_cik=False)
        ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['size'], cik_dt='date', cik_iid='ip')

        # ft.set_cik_dt([datetime.datetime.now()])
        res = ft.fetch(reduced=True, add_limit=True)
        self.assertEqual(res.shape[0], 100)
Пример #2
0
 def test_add_factor_order1(self):
     ft = FactorTable(conn, strict_cik=False)
     ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['size'], cik_dt='date', cik_iid='ip')
     ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['idx'], cik_dt='date', cik_iid='ip')
     ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['norefer'], cik_dt='date', cik_iid='ip')
     s = ft.fetch(reduced=True, add_limit=True)
     self.assertTupleEqual(s.shape, (100, 3))
     self.assertListEqual(s.columns.tolist(), ['size', 'idx', 'norefer', ])
Пример #3
0
    def test_add_factor_from_ft(self):
        ft = FactorTable(conn, cik_dt='datetime', cik_iid='code', strict_cik=False)
        ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['size'], cik_dt='date', cik_iid='ip')

        ft2 = FactorTable(conn, cik_dt='datetime', cik_iid='code', strict_cik=False)
        ft2.add_factor('select * from EDGAR_LOG.edgar_log', factor_names=['norefer', 'size'], cik_dt='date',
                       cik_iid='ip')
        ft.add_factor(ft2, factor_names=['norefer'], cik_dt='cik_dt', cik_iid='cik_iid')

        res = ft.fetch(reduced=True, add_limit=True)
        self.assertEqual(res.shape[0], 100)
Пример #4
0
# coding=utf-8

from ClickSQL.factor_table.factortable import FactorTable

from test.conn import conn

ft = FactorTable(conn, cik_dt='datetime', cik_iid='code', strict_cik=False)

if __name__ == '__main__':
    ft.add_factor('EDGAR_LOG.edgar_log', factor_names=['size', 'ip', 'norefer'], )
    query_func = ft._node
    print(query_func('desc EDGAR_LOG.edgar_log'))
    # Node.add_factor('EDGAR_LOG.edgar_log', factor_names='cik', cik_dt='date', cik_iid='ip')
    # Node.add_factor('test.test2', factor_names='test2', cik_dt='cik_dt', cik_iid='cik_iid')
    # f = ft.fetch(reduced=True, add_limit=True)

    # ft2 = FactorTable(conn, cik_dt='datetime', cik_iid='code', strict_cik=False)
    # ft.set_cik_dt([datetime.datetime.now()])
    # res = ft.fetch(reduced=True, add_limit=True)

    # print(res)
    pass