-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataIngestionTest.py
58 lines (47 loc) · 1.66 KB
/
DataIngestionTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
Testing DataIngestion
"""
import numpy as np
import pandas as pd
from datetime import datetime
from DataIngestion import DataIngestion as di
TEST_TICKER = 'GOOGL'
TEST_DATE = '2019-May-31'
def test_get_whisper_numbers(klass):
df = klass.get_whisper_numbers()
assert isinstance(df, pd.DataFrame)
assert np.all(df.columns == ['tickers', 'eps', 'ew_revenue', 'ew_curr_eps_est', 'ew_eps'])
def test_get_rsi_frame(klass):
rsi = klass.get_rsi_frame()
def test_insider_trading(klass):
df = klass.get_insider_trading('NDSN')
test_df = pd.DataFrame()
assert_frame_equal(df.head(), test_df.head())
df = klass.get_insider_trading(['TWTR', 'SNAP'])
test_df = pd.DataFrame()
assert_frame_equal(df.head(), test_df.head())
def test_get_yahoo_statistics(klass):
df = klass.get_yahoo_statistics()
assert isinstance(df, pd.DataFrame)
assert df.shape == (59, 1)
def test_get_earning_calender(klass):
df = klass.get_earning_calender()
assert isinstance(df, pd.DataFrame)
assert np.all(df.columns == ['consensus_eps', 'analysts', 'EPS', 'suprise_pct',
'tickers', 'mc_obj', 'market_cap', 'reported_date', 'name'])
def test_get_hl52_stocks(klass):
ldf, hdf = klass.get_hl52_stocks()
assert isinstance(ldf, pd.DataFrame)
assert isinstance(hdf, pd.DataFrame)
def test_get_zacks_numbers(klass):
zdf = klass.get_zacks_numbers(tickers=TEST_TICKER)
import pdb; pdb.set_trace()
if __name__ == '__main__':
klass = di(tickers=[TEST_TICKER], date=TEST_DATE)
#test_get_rsi_frame(klass)
#test_insider_trading(klass)
#test_get_hl52_stocks(klass)
#test_get_yahoo_statistics(klass)
#test_get_earning_calender(klass)
test_get_whisper_numbers(klass)
#test_get_zacks_numbers(klass)