marketTrade/market_trade/tests/test_decision.py
Mark 92eb7db4c5 refactor: update test file to use new standardized method names
Update test_decision.py to work with refactored core modules.

Changes:
- Removed wildcard imports, using explicit imports:
  - from decisionManager_v2 import DecisionManager
  - from indicators_v2 import ind_BB
  - from signals_v2 import sig_BB
- Updated method calls to use snake_case naming:
  - test.getRetroTrendAns() → test.get_retro_trend_answer()
  - test.generateMatrixProbabilityFromDict() → test.generate_matrix_probability_from_dict()
  - test.getOnlineAns() → test.get_online_answer()
- Updated variable names to snake_case:
  - sigAgrReq → sig_agr_req
  - sigAgrRetroTemplate → sig_agr_retro_template
  - retroAns → retro_ans
  - sigAgrData → sig_agr_data
- Improved spacing and formatting for PEP 8 compliance

The test file now follows the same coding standards as the refactored
core modules and maintains compatibility with all renamed methods.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 18:38:42 +01:00

65 lines
1.7 KiB
Python

from market_trade.core.decisionManager_v2 import DecisionManager
from market_trade.core.indicators_v2 import ind_BB
from market_trade.core.signals_v2 import sig_BB
import market_trade.data.dataloader
sig_agr_req = {
'sig_BB': {
'className': sig_BB,
'params': {'source': 'close', 'target': 'close'},
'indicators': {
'ind_BB': {
'className': ind_BB,
'params': {'MeanType': 'SMA', 'window': 30, 'valueType': 'close', 'kDev': 2.5}
}
}
},
'sig_BB_2': {
'className': sig_BB,
'params': {'source': 'close', 'target': 'close'},
'indicators': {
'ind_BB': {
'className': ind_BB,
'params': {'MeanType': 'SMA', 'window': 30, 'valueType': 'close', 'kDev': 2}
}
}
}
}
test = DecisionManager('Pipa', sig_agr_req)
import pandas as pd
df_candle = pd.read_csv("../../data/EURUSD_price_candlestick.csv")
df_candle["date"] = df_candle["timestamp"]
sig_agr_retro_template = {
'sig_BB': {
'signalData': None,
'indicatorData': {'ind_BB': None}
},
'sig_BB_2': {
'signalData': None,
'indicatorData': {'ind_BB': None}
}
}
retro_ans = test.get_retro_trend_answer(sig_agr_retro_template, df_candle[5000:6000].reset_index(drop=True), 40)
test.generate_matrix_probability_from_dict(retro_ans)
sig_agr_data = {
'sig_BB': {
'signalData': df_candle[990:1000],
'indicatorData': {'ind_BB': df_candle[:1000]}
},
'sig_BB_2': {
'signalData': df_candle[990:1000],
'indicatorData': {'ind_BB': df_candle[:1000]}
}
}
test.get_online_answer(sig_agr_data, 0.0)