// MT5MonkMAM.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"
#include <iostream>

#include <ini/Settings.h>

int main()
{
	std::shared_ptr<tools::logger> logger(new tools::logger("MT5MonkMAM.log", tools::logger::FILE | tools::logger::SCREEN));

	logger->set_level(tools::logger::LVTRACK);

	Settings set("MT5MonkMAM.ini");
	Dictionary dict = set.GetSection("MT5");
	std::string server = dict.GetString("Server");
	UINT64 login = dict.GetInt("Login");
	std::string password = dict.GetString("Password");

	dict = set.GetSection("MAM");
	UINT64 trader = dict.GetInt("Trader");
	std::string groups = dict.GetString("Groups");
	UINT step = dict.GetInt("Step");
	UINT tolerance = dict.GetInt("Tolerance");

	CManagerExtension manager;
	manager.SetTrader(trader);
	manager.SetGroups(groups);
	manager.SetStep(step);
	manager.SetTolerance(tolerance);

	manager.SetLogger(logger);

	CMTStr128 srv;
	CMTStr128 pass;
	srv.Assign(s2ws(server).c_str());
	pass.Assign(s2ws(password).c_str());
	manager.Initialize();
	manager.Connect(srv, login, pass);

	//std::cout << "Connected" << std::endl;

	getchar();

	return 0;
}

