from market_trade.core.decisionManager_v2 import *
from market_trade.core.indicators_v2 import *
from market_trade.core.signals_v2 import *
import market_trade.data.dataloader


sigAgrReq = {
    '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 = decsionManager('Pipa', sigAgrReq)


import pandas as pd

df_candle = pd.read_csv("../../data/EURUSD_price_candlestick.csv")
df_candle["date"] = df_candle["timestamp"]
sigAgrRetroTemplate = {
    'sig_BB':{
        'signalData': None,
        'indicatorData' :{'ind_BB': None}
    },
    'sig_BB_2':{
        'signalData': None,
        'indicatorData' :{'ind_BB': None}
    }
}

retroAns = test.getRetroTrendAns(sigAgrRetroTemplate,df_candle[5000:6000].reset_index(drop=True),40)

test.generateMatrixProbabilityFromDict(retroAns)

sigAgrData = {
    '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.getOnlineAns(sigAgrData, 0.0)