Пример #1
0
#################################### MAIN #####################################

token = '488376978:AAFvFovR-Zin9VXR-AhCs0RRXXP149s_rdk'
bot = telegram.Bot(token=token)
chat_id = -1001142683257

tf = timeframe()

prefix = '.lmx'
magic_number = 123456
ip_add_1 = '127.0.0.100'
ip_add_2 = '127.0.0.200'
ip_1 = 'tcp://' + ip_add_1
ip_2 = 'tcp://' + ip_add_2

broker1 = bk(ip_1, magic_number)
broker2 = bk(ip_2, magic_number)

broker1.get_acct_info()
print(broker1.company)
txt = broker1.company
Log(txt)

prev_time = None
curr_time = None

Symbols = ['EURUSD', 'GBPUSD', 'AUDUSD', 'NZDUSD', 'USDJPY', 'USDCHF','USDCAD', \
                   'EURJPY', 'GBPJPY', 'AUDJPY', 'NZDJPY', 'CHFJPY','CADJPY',\
                   'EURGBP', 'GBPAUD', 'GBPNZD', 'GBPCHF', 'GBPCAD', \
                   'EURAUD', 'EURNZD', 'EURCHF', 'EURCAD', \
                   'AUDCHF', 'AUDCAD', 'CADCHF', \
Пример #2
0
            score_matrix[i, j] = score
            pvalue_matrix[i, j] = pvalue
            if pvalue < 0.05:
                pairs.append((keys[i], keys[j]))
    return score_matrix, pvalue_matrix, pairs

def zscore(series):
    return (series - series.mean()) / np.std(series)

# ******************************************************************************************
#initialization
magic_number = 123456
ip_add_1 = '127.0.0.100'
ip_1 = 'tcp://'+ ip_add_1

broker1 = bk(ip_1, magic_number)

broker1.get_acct_info()
print(broker1.company)

#get data and put in pandas dataframe
symb = ['EURUSD.lmx','GBPUSD.lmx','AUDUSD.lmx', 'USDJPY.lmx', 'NZDUSD.lmx','USDCAD.lmx','USDCHF.lmx'\
        ,'GBPJPY.lmx','EURJPY.lmx','AUDJPY.lmx', 'NZDJPY.lmx', 'CADJPY.lmx', 'CHFJPY.lmx']
#symb = ['EURUSD.lmx','GBPUSD.lmx','AUDUSD.lmx']
total_c = 4000
timeframe = timeframe.M5
price_df = get_data(symb, total_c, timeframe)

#convert datetime to local datetime
local_tz = timezone('Asia/Kuala_Lumpur')
mt4_tz = timezone('GMT')