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)
