using BinanceExchange.API.Models.WebSocket;
using SignalsTest;

class Program
{
    static ManualResetEvent _quitEvent = new ManualResetEvent(false);

    static List<CoinWatch> watches = new List<CoinWatch>();
    private static void Main(string[] args)
    {
        Console.WriteLine("Initializing Messiah");
        Messenger.instance.SendMessage("Rebooted bot");
        for (int i=0; i < CoinsList.symbols.Count; i++){
            CoinWatch btcWatch = new CoinWatch(CoinsList.symbols[i], i);
            btcWatch.PriceUpdated += CoinWatch_OnPriceUpdate;

            watches.Add(btcWatch);
        }
        CheckSuccess();
        _quitEvent.WaitOne();
    }


    async static void CheckSuccess(){
        await Task.Delay(120000);

        List<string> failedList = new List<string>();
        string commasList = "";
        foreach(CoinWatch coin in watches){
            if(!coin.kickstarted){
                failedList.Add(coin.pair);
                commasList += coin.pair + ", ";
            }
        }
        string msg = $"{failedList.Count} Failed out of {watches.Count}. Failed list: \n{commasList}";
        Console.WriteLine(msg);
        Messenger.instance.SendMessage(msg);
    }

    private static void CoinWatch_OnPriceUpdate(Object? sender,BinanceTradeData data)
    {
        // Console.WriteLine(data.BestAskPrice);
    }
}