coin_alerts/Brian.cs
2025-01-14 22:55:18 +05:30

61 lines
1.7 KiB
C#

using BinanceExchange.API.Client;
using BinanceExchange.API.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SignalsTest
{
public class Brian
{
private static BinanceClient m_client;
public static BinanceClient Client
{
get
{
if (m_client == null)
{
m_client = new BinanceClient(new ClientConfiguration()
{
ApiKey = Secrets.BINANCE_API_PK,
SecretKey = Secrets.BINANCE_API_SK,
});
}
return m_client;
}
}
public static List<CoinWatch> watches = new List<CoinWatch>();
public static CoinWatch GetCoinWatch(string symbol, KlineInterval interval){
foreach(CoinWatch watch in watches){
if(watch.pair == symbol && watch.interval == interval){
return watch;
}
}
return watches[0];
}
public static CoinWatch GetCoinWatchLongest(string symbol){
CoinWatch match = watches[0];
foreach(CoinWatch watch in watches){
if(watch.pair == symbol){
if(match.pair != watch.pair){
match = watch;
}
if(Utils.GetMinutesForInterval(match.interval) < Utils.GetMinutesForInterval(watch.interval)){
match = watch;
}
}
}
return match;
}
}
}