Update position saving and update
This commit is contained in:
@@ -689,8 +689,8 @@ public class EvmManager : IEvmManager
|
||||
quantity,
|
||||
price,
|
||||
leverage ?? 1.0m,
|
||||
account.Key,
|
||||
""
|
||||
"", // ExchangeOrderId should be empty for requested trades
|
||||
"" // Empty message for now
|
||||
);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -750,7 +750,7 @@ public class EvmManager : IEvmManager
|
||||
quantity,
|
||||
price,
|
||||
leverage ?? 1,
|
||||
response.Hash,
|
||||
response.Hash, // This should be the actual transaction hash/order ID
|
||||
""
|
||||
);
|
||||
|
||||
@@ -819,7 +819,7 @@ public class EvmManager : IEvmManager
|
||||
if (position == null)
|
||||
return null;
|
||||
|
||||
// TODO: Map the position object to a Trade object
|
||||
// Map the position object to a Trade object
|
||||
var trade = new Trade(
|
||||
position.Date,
|
||||
MiscExtensions.ParseEnum<TradeDirection>(position.Direction),
|
||||
@@ -829,8 +829,8 @@ public class EvmManager : IEvmManager
|
||||
(decimal)position.Quantity,
|
||||
(decimal)position.Price,
|
||||
(decimal?)position.Leverage,
|
||||
account.Key,
|
||||
position.ExchangeOrderId
|
||||
position.ExchangeOrderId, // Use the actual exchange order ID from the position
|
||||
"" // Empty message for now
|
||||
);
|
||||
|
||||
return trade;
|
||||
|
||||
@@ -171,9 +171,11 @@ internal static class GmxV2Mappers
|
||||
PositionInitiator.User,
|
||||
gmxPosition.Date,
|
||||
new User());
|
||||
// For the Open trade, use the Open trade's ExchangeOrderId if available, otherwise use a new GUID
|
||||
var openExchangeOrderId = gmxPosition.Open?.ExchangeOrderId ?? Guid.NewGuid().ToString();
|
||||
position.Open = new Trade(position.Date, direction, TradeStatus.Filled, TradeType.Market, ticker,
|
||||
(decimal)gmxPosition.Quantity, (decimal)gmxPosition.Price, (decimal)gmxPosition.Leverage,
|
||||
gmxPosition.Open.ExchangeOrderId, "");
|
||||
openExchangeOrderId, "");
|
||||
|
||||
if (gmxPosition.TakeProfit1 != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user