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

Feature/rule value injection #82

Merged
merged 76 commits into from
Jan 14, 2025
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
d902b4f
fixed rule value parameter name
jocon15 Jan 11, 2025
9e2f55e
split additional days into separate functions by rule key and rule value
jocon15 Jan 11, 2025
db65c04
corrected additional days function for candlestick color indicator
jocon15 Jan 11, 2025
da5292e
algorithm additional days now calls rule key and rule value functions…
jocon15 Jan 11, 2025
cf6bf3b
added comments
jocon15 Jan 11, 2025
b61bfba
corrected ema trigger additional days functions
jocon15 Jan 11, 2025
7eff6df
fixed ema exception message
jocon15 Jan 11, 2025
2d541fc
corrected macd trigger additional days functions
jocon15 Jan 11, 2025
36fc09b
fixed docstring
jocon15 Jan 11, 2025
568984e
corrected price trigger additional days functions
jocon15 Jan 11, 2025
cf09e7b
corrected rsi trigger additional days functions
jocon15 Jan 11, 2025
8aa412c
corrected sma trigger additional days functions
jocon15 Jan 11, 2025
d2b13b3
corrected stochastic trigger additional days functions
jocon15 Jan 11, 2025
370c256
corrected stop loss trigger additional days functions
jocon15 Jan 11, 2025
b9aceed
corrected stop profit trigger additional days functions
jocon15 Jan 11, 2025
fc4ed07
corrected volume trigger additional days functions
jocon15 Jan 11, 2025
0de776c
created 2 separate add to data functions
jocon15 Jan 11, 2025
e300a74
algorithm now calls both add to data functions
jocon15 Jan 11, 2025
e468470
fixed rule value parameter name
jocon15 Jan 11, 2025
091cd63
corrected candlestick color trigger add to data functions
jocon15 Jan 11, 2025
1dfcd91
corrected ema trigger add to data functions
jocon15 Jan 11, 2025
4247c90
corrected macd trigger add to data functions
jocon15 Jan 11, 2025
bf8a9a1
fixed an issue where candle stick color trigger would not correctly c…
jocon15 Jan 11, 2025
0381e0c
corrected price trigger add to data functions
jocon15 Jan 11, 2025
85bf197
fixed issue where RSI would not add to data correctly because of its …
jocon15 Jan 11, 2025
4e0f09b
fixed comments in trigger explaining why params are necessary
jocon15 Jan 11, 2025
badb373
fixed comment
jocon15 Jan 11, 2025
47c762d
corrected stochastic trigger add to data functions
jocon15 Jan 11, 2025
96f7984
corrected sma trigger add to data functions
jocon15 Jan 11, 2025
5ce1b33
corrected stop loss trigger add to data functions
jocon15 Jan 11, 2025
714a2cf
corrected stop profit trigger add to data functions
jocon15 Jan 11, 2025
caa9997
corrected volume trigger add to data functions
jocon15 Jan 11, 2025
43945d6
added params in algorithm
jocon15 Jan 11, 2025
2745d8b
created function signature for get value when referenced
jocon15 Jan 11, 2025
71bfc26
created and used rule value injection function
jocon15 Jan 11, 2025
2cdce05
added definition and implementation for candlestick get value when re…
jocon15 Jan 11, 2025
d988a8c
fixed comment
jocon15 Jan 11, 2025
6c73021
added parameter to function signature
jocon15 Jan 11, 2025
d449eed
added definition and implementation for ema get value when referenced…
jocon15 Jan 11, 2025
59bdb8d
fixed docstring
jocon15 Jan 11, 2025
29b229b
added definition and implementation for macd get value when reference…
jocon15 Jan 11, 2025
c8d0cdc
added definition and implementation for price get value when referenc…
jocon15 Jan 11, 2025
ce97ed7
added definition and implementation for rsi get value when referenced…
jocon15 Jan 11, 2025
fb9a3df
added definition and implementation for sma get value when referenced…
jocon15 Jan 11, 2025
a46b9d9
added definition and implementation for stochastic get value when ref…
jocon15 Jan 11, 2025
96a9f8c
fixed definition and implementation for candlestick get value when re…
jocon15 Jan 11, 2025
f823fea
added definition and implementation for stop loss get value when refe…
jocon15 Jan 11, 2025
b7282cd
added definition and implementation for stop profit get value when re…
jocon15 Jan 11, 2025
3271596
added definition and implementation for volume get value when referen…
jocon15 Jan 11, 2025
e2a91a0
fixed exception messages
jocon15 Jan 11, 2025
059a411
removed comment
jocon15 Jan 11, 2025
5e9af61
fixed comments
jocon15 Jan 11, 2025
9b4b415
removed comment
jocon15 Jan 11, 2025
61d4d59
updated tests for candlestick trigger
jocon15 Jan 11, 2025
6790114
removed price emblems from basic trigger check rule value parsing bec…
jocon15 Jan 11, 2025
14ca3c7
fixed test for trigger
jocon15 Jan 11, 2025
b93a6f5
fixed tests for trigger
jocon15 Jan 11, 2025
7966378
fixed tests for ema
jocon15 Jan 11, 2025
947fe94
fixed tests for macd
jocon15 Jan 11, 2025
3896c4a
fixed tests for price
jocon15 Jan 11, 2025
98a7f87
fixed tests for rsi
jocon15 Jan 11, 2025
de62d03
fixed tests for sma
jocon15 Jan 11, 2025
46e3bd1
fixed tests for rsi
jocon15 Jan 11, 2025
aac0b58
fixed tests for stochastic
jocon15 Jan 11, 2025
3049824
fixed tests for stochastic
jocon15 Jan 11, 2025
b434def
fixed tests for stop loss
jocon15 Jan 11, 2025
5a24fa0
fixed tests for stop loss
jocon15 Jan 11, 2025
fb04f1e
fixed tests for stop profit
jocon15 Jan 11, 2025
b5dbe0c
fixed tests for volume
jocon15 Jan 11, 2025
b638ee2
fixed tests for trigger
jocon15 Jan 11, 2025
019a0e6
fixed tests for stochastic
jocon15 Jan 11, 2025
a4ec9ee
fixed signature for get value when referenced function
jocon15 Jan 14, 2025
597791b
reversed the order so that and triggers are handled first in addition…
jocon15 Jan 14, 2025
9829d29
functionalized the duplicated logic for searching a side for addition…
jocon15 Jan 14, 2025
4bda2b9
added log message
jocon15 Jan 14, 2025
b581873
renamed function to be more descriptive
jocon15 Jan 14, 2025
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
Prev Previous commit
Next Next commit
fixed test for trigger
  • Loading branch information
jocon15 committed Jan 11, 2025
commit 14ca3c7ae60cf009936da0f2746f82b379c9231d
21 changes: 20 additions & 1 deletion src/tests/test_ema_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_object():
return EMATrigger('EMA')


def test_additional_days(test_object):
def test_additional_days_from_rule_key(test_object):
# ============= Arrange ==============

# ============= Act ==================
Expand All @@ -29,6 +29,25 @@ def test_additional_days(test_object):
assert True


def test_additional_days_from_rule_value(test_object):
# ============= Arrange ==============

# ============= Act ==================

# ============= Assert ===============
assert test_object.additional_days_from_rule_value('>EMA20') == 20
assert type(test_object.additional_days_from_rule_value('=EMA20')) is int
assert test_object.additional_days_from_rule_value('>EMA50$price') == 50
assert test_object.additional_days_from_rule_value('<EMA50$price') == 50
assert test_object.additional_days_from_rule_value('<=EMA20$slope10') == 20
assert test_object.additional_days_from_rule_value('>=EMA20$slope30') == 30
try:
test_object.additional_days_from_rule_value('>EMA')
assert False
except StrategyIndicatorError:
assert True


@patch('logging.getLogger')
@patch('StockBench.simulation_data.data_manager.DataManager')
def test_add_to_data(data_mocker, logger_mocker, test_object):
Expand Down