coin_alerts/Extensions.cs
2025-01-12 18:35:52 +05:30

18 lines
635 B
C#

using BinanceExchange.API.Models.Response;
public static class Extensions{
public static bool isGreen(this KlineCandleStickResponse candle){
return candle.Close > candle.Open;
}
public static float getShadowRatio(this KlineCandleStickResponse candle){
decimal shadowLen = candle.High-candle.Low;
decimal candleLen = Math.Abs(candle.Open-candle.Close);
return (float)(candleLen/(shadowLen==0 ? 1 :shadowLen)); //Prevent commiting suicide
}
public static float getCandleLength(this KlineCandleStickResponse candle){
return (float)Math.Abs(candle.Open-candle.Close);
}
}