docker files fixes from liaqat
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using Discord;
|
||||
using Managing.Domain.Statistics;
|
||||
using Managing.Domain.Trades;
|
||||
|
||||
namespace Managing.Infrastructure.Messengers.Discord;
|
||||
|
||||
public static class DiscordHelpers
|
||||
{
|
||||
public static Embed GetTradersEmbed(List<Trader> traders, string title)
|
||||
{
|
||||
var fields = new List<EmbedFieldBuilder>();
|
||||
|
||||
traders = traders.OrderByDescending(t => t.Winrate).ToList();
|
||||
foreach (var trader in traders)
|
||||
{
|
||||
fields.Add(new EmbedFieldBuilder
|
||||
{
|
||||
Name = $"{GetExplorerUrl(trader.Address)}",
|
||||
Value = $"Avg Win / Avg Loss / Winrate / ROI \n {trader.AverageWin:#.##}$ / {trader.AverageLoss:#.##}$ / {trader.Winrate}% / {Convert.ToDecimal(trader.Roi) * 100:#.##}%",
|
||||
});
|
||||
}
|
||||
|
||||
var embed = new EmbedBuilder
|
||||
{
|
||||
Author = new EmbedAuthorBuilder() { Name = "GMX" },
|
||||
Title = $"{title} {DateTime.UtcNow:d}",
|
||||
Color = Color.Gold,
|
||||
Fields = fields,
|
||||
}.Build();
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
public static Embed GetEmbed(string address, string title, List<EmbedFieldBuilder> fields, Color color)
|
||||
{
|
||||
return new EmbedBuilder
|
||||
{
|
||||
Author = new EmbedAuthorBuilder() { Name = address },
|
||||
Title = title,
|
||||
Color = color,
|
||||
Fields = fields,
|
||||
Url = GetExplorerUrl(address)
|
||||
}.Build();
|
||||
}
|
||||
|
||||
private static string GetExplorerUrl(string key)
|
||||
{
|
||||
return $"https://www.tradao.xyz/#/user/{key}/1";
|
||||
}
|
||||
|
||||
internal static Embed GetTradesEmbed(List<Trade> trades, string title)
|
||||
{
|
||||
var fields = new List<EmbedFieldBuilder>();
|
||||
|
||||
foreach (var trade in trades)
|
||||
{
|
||||
fields.Add(new EmbedFieldBuilder
|
||||
{
|
||||
Name = $"{GetExplorerUrl(trade.ExchangeOrderId)}",
|
||||
Value = $"Side / Ticker / Open / Qty / Leverage / LiqPrice \n {trade.Direction} / {trade.Ticker} / {trade.Price:#.##}$ / {trade.Quantity:#.##}$ / x{trade.Leverage:#.##} / {Convert.ToDecimal(trade.Message):#.##}$",
|
||||
});
|
||||
}
|
||||
|
||||
fields.Add(new EmbedFieldBuilder
|
||||
{
|
||||
Name = "Summary",
|
||||
Value = $"Long / Short / \n {trades.Count(t => t.Direction == Common.Enums.TradeDirection.Long)} / {trades.Count(t => t.Direction == Common.Enums.TradeDirection.Short)}"
|
||||
});
|
||||
|
||||
var embed = new EmbedBuilder
|
||||
{
|
||||
Author = new EmbedAuthorBuilder() { Name = "GMX" },
|
||||
Title = $"{title} {DateTime.UtcNow:d}",
|
||||
Color = Color.DarkBlue,
|
||||
Fields = fields,
|
||||
}.Build();
|
||||
|
||||
return embed;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user