Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase speed of previous high low function #43

Merged
merged 4 commits into from
May 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
just testing previous high low
joshyattridge committed May 25, 2024
commit b0025fcd616eb8a0911a32862eb695de3c3d0a19
138 changes: 69 additions & 69 deletions tests/unit_tests.py
Original file line number Diff line number Diff line change
@@ -18,57 +18,57 @@ class TestSmartMoneyConcepts(unittest.TestCase):
# to test each function in the smartmoneyconcepts package
# each function will be called and the result will be compared to the result data

def test_fvg(self):
start_time = time.time()
fvg_data = smc.fvg(df, join_consecutive=True)
fvg_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "fvg_result_data.csv")
)
print("fvg test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(fvg_data, fvg_result_data, check_dtype=False)

def test_swing_highs_lows(self):
start_time = time.time()
swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
swing_highs_lows_result_data = pd.read_csv(
os.path.join(
"test_data", test_instrument, "swing_highs_lows_result_data.csv"
)
)
print("swing_highs_lows test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(swing_highs_lows_data, swing_highs_lows_result_data, check_dtype=False)

def test_bos_choch(self):
start_time = time.time()
swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
bos_choch_data = smc.bos_choch(df, swing_highs_lows_data)
bos_choch_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "bos_choch_result_data.csv")
)
print("bos_choch test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(
bos_choch_data, bos_choch_result_data, check_dtype=False
)

def test_ob(self):
start_time = time.time()
swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
ob_data = smc.ob(df, swing_highs_lows_data)
ob_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "ob_result_data.csv")
)
print("ob test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(ob_data, ob_result_data, check_dtype=False)

def test_liquidity(self):
start_time = time.time()
swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
liquidity_data = smc.liquidity(df, swing_highs_lows_data)
liquidity_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "liquidity_result_data.csv")
)
print("liquidity test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(liquidity_data, liquidity_result_data, check_dtype=False)
# def test_fvg(self):
# start_time = time.time()
# fvg_data = smc.fvg(df, join_consecutive=True)
# fvg_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "fvg_result_data.csv")
# )
# print("fvg test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(fvg_data, fvg_result_data, check_dtype=False)

# def test_swing_highs_lows(self):
# start_time = time.time()
# swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
# swing_highs_lows_result_data = pd.read_csv(
# os.path.join(
# "test_data", test_instrument, "swing_highs_lows_result_data.csv"
# )
# )
# print("swing_highs_lows test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(swing_highs_lows_data, swing_highs_lows_result_data, check_dtype=False)

# def test_bos_choch(self):
# start_time = time.time()
# swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
# bos_choch_data = smc.bos_choch(df, swing_highs_lows_data)
# bos_choch_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "bos_choch_result_data.csv")
# )
# print("bos_choch test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(
# bos_choch_data, bos_choch_result_data, check_dtype=False
# )

# def test_ob(self):
# start_time = time.time()
# swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
# ob_data = smc.ob(df, swing_highs_lows_data)
# ob_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "ob_result_data.csv")
# )
# print("ob test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(ob_data, ob_result_data, check_dtype=False)

# def test_liquidity(self):
# start_time = time.time()
# swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
# liquidity_data = smc.liquidity(df, swing_highs_lows_data)
# liquidity_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "liquidity_result_data.csv")
# )
# print("liquidity test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(liquidity_data, liquidity_result_data, check_dtype=False)

def test_previous_high_low(self):
start_time = time.time()
@@ -81,24 +81,24 @@ def test_previous_high_low(self):
print("previous_high_low test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(previous_high_low_data, previous_high_low_result_data, check_dtype=False)

def test_sessions(self):
start_time = time.time()
sessions = smc.sessions(df, session="London")
sessions_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "sessions_result_data.csv")
)
print("sessions test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(sessions, sessions_result_data, check_dtype=False)

def test_retracements(self):
start_time = time.time()
swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
retracements = smc.retracements(df, swing_highs_lows_data)
retracements_result_data = pd.read_csv(
os.path.join("test_data", test_instrument, "retracements_result_data.csv")
)
print("retracements test time: ", time.time() - start_time)
pd.testing.assert_frame_equal(retracements, retracements_result_data, check_dtype=False)
# def test_sessions(self):
# start_time = time.time()
# sessions = smc.sessions(df, session="London")
# sessions_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "sessions_result_data.csv")
# )
# print("sessions test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(sessions, sessions_result_data, check_dtype=False)

# def test_retracements(self):
# start_time = time.time()
# swing_highs_lows_data = smc.swing_highs_lows(df, swing_length=5)
# retracements = smc.retracements(df, swing_highs_lows_data)
# retracements_result_data = pd.read_csv(
# os.path.join("test_data", test_instrument, "retracements_result_data.csv")
# )
# print("retracements test time: ", time.time() - start_time)
# pd.testing.assert_frame_equal(retracements, retracements_result_data, check_dtype=False)


if __name__ == "__main__":