55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using BinanceExchange.API.Enums;
|
|
using BinanceExchange.API.Models.WebSocket;
|
|
using SignalsTest;
|
|
|
|
class Program
|
|
{
|
|
static ManualResetEvent _quitEvent = new ManualResetEvent(false);
|
|
|
|
private static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("Initializing Messiah");
|
|
Messenger.instance.ScheduleMessage("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);
|
|
// }
|
|
Brian.watches = new List<CoinWatch>();
|
|
int i=0;
|
|
foreach(KeyValuePair<string, List<KlineInterval>> symbol in CoinsList.symbols){
|
|
foreach(KlineInterval interval in symbol.Value){
|
|
CoinWatch btcWatch = new CoinWatch(symbol.Key, i, interval);
|
|
btcWatch.PriceUpdated += CoinWatch_OnPriceUpdate;
|
|
|
|
Brian.watches.Add(btcWatch);
|
|
i++;
|
|
}
|
|
}
|
|
CheckSuccess();
|
|
_quitEvent.WaitOne();
|
|
}
|
|
|
|
|
|
async static void CheckSuccess(){
|
|
await Task.Delay(160000);
|
|
|
|
List<string> failedList = new List<string>();
|
|
string commasList = "";
|
|
foreach(CoinWatch coin in Brian.watches){
|
|
if(!coin.kickstarted){
|
|
failedList.Add(coin.pair);
|
|
commasList += $"{coin.pair}[{coin.interval}]" + ", ";
|
|
}
|
|
}
|
|
string msg = $"Reboot complete: {failedList.Count} Failed out of {Brian.watches.Count}. Failed list: \n{commasList}";
|
|
Console.WriteLine(msg);
|
|
Messenger.instance.ScheduleMessage(msg);
|
|
}
|
|
|
|
private static void CoinWatch_OnPriceUpdate(Object? sender,BinanceTradeData data)
|
|
{
|
|
// Console.WriteLine(data.BestAskPrice);
|
|
}
|
|
} |