import pandas as pd
import coint_models as cm
import data_preprocessing as dp

# Parameters

raw_data_path = 'C:/Users/user/Desktop/ASDASD' # Random folder
tickers_list = ['BTC', 'LTC', 'XRP', 'LUNA', 'ADA', 'SOL', 'DOT', 'DOGE', 'TRX', '1000SHIB', 'ETH', 'BNB', 'LINK', 'UNI',
           'ATOM', 'FTM', 'XMR', 'AAVE', 'NEAR', 'THETA', 'MATIC', 'EOS', 'BAT', 'ENJ']
tf = '15m' # '1h', '1d'

window_size = 672  # randomly choosen
max_n_comp = 2 # maxmium components in pairs trading eg. BTC - ETH = 2 components / BTC - ETH - LTC = 3 components
init = 0 # initial start point ( 0 means 2020-01-01 08:00)
alpha = 0.05  # 0.01 / 0.1


# Data Preprocessing
DP = dp.get_data(tickers_list, tf, raw_data_path)
DP.get_raw()
DP.get_file('close')
DP.get_file('volume')

# Load processed data
data = pd.read_csv('crypto_' + tf + '_close' + '.csv', index_col=0)
# Initialize the model
coint_models = cm.get_coint_pairs(data, 3, alpha)
# Get stationary components and hedge ratio
tick_param = coint_models.get_pairs(init, window_size)
