Add data + fix positions

This commit is contained in:
2025-04-24 23:48:28 +07:00
parent 1d14d31af2
commit af89121c40
9 changed files with 549 additions and 9 deletions

View File

@@ -162,16 +162,29 @@ internal static class GmxV2Mappers
{
try
{
var direction = MiscExtensions.ParseEnum<TradeDirection>(gmxPosition.Direction);
var ticker = MiscExtensions.ParseEnum<Ticker>(gmxPosition.Ticker);
var position = new Position("", "",
MiscExtensions.ParseEnum<TradeDirection>(gmxPosition.Direction),
MiscExtensions.ParseEnum<Ticker>(gmxPosition.Ticker),
direction,
ticker,
new MoneyManagement(),
PositionInitiator.User,
gmxPosition.Date,
new User());
position.Open = Map(gmxPosition.Open);
position.TakeProfit1 = Map(gmxPosition.TakeProfit1);
position.StopLoss = Map(gmxPosition.StopLoss);
position.Open = new Trade(position.Date, direction, TradeStatus.Filled, TradeType.Market, ticker,
(decimal)gmxPosition.Quantity, (decimal)gmxPosition.Price, (decimal)gmxPosition.Leverage,
gmxPosition.Open.ExchangeOrderId, "");
if (gmxPosition.TakeProfit1 != null)
{
position.TakeProfit1 = Map(gmxPosition.TakeProfit1);
}
if (gmxPosition.StopLoss != null)
{
position.StopLoss = Map(gmxPosition.StopLoss);
}
position.ProfitAndLoss = new ProfitAndLoss()
{
Net = (decimal)gmxPosition.Pnl