fix signal and get position during closing
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Globalization;
|
||||||
using Managing.Core;
|
using Managing.Core;
|
||||||
using Managing.Domain.Candles;
|
using Managing.Domain.Candles;
|
||||||
using Managing.Domain.Users;
|
using Managing.Domain.Users;
|
||||||
@@ -34,7 +35,7 @@ namespace Managing.Domain.Strategies
|
|||||||
StrategyType = strategyType;
|
StrategyType = strategyType;
|
||||||
User = user;
|
User = user;
|
||||||
|
|
||||||
Identifier = $"{StrategyType}-{direction}-{ticker}-{candle?.Close}-{date:yyyyMMdd-HHmmss}";
|
Identifier = $"{StrategyType}-{direction}-{ticker}-{candle?.Close.ToString(CultureInfo.InvariantCulture)}-{date:yyyyMMdd-HHmmss}";
|
||||||
SignalType = signalType;
|
SignalType = signalType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -660,7 +660,9 @@ public class EvmManager : IEvmManager
|
|||||||
{
|
{
|
||||||
account = account.Key,
|
account = account.Key,
|
||||||
ticker = ticker.ToString(),
|
ticker = ticker.ToString(),
|
||||||
direction = direction.ToString(),
|
direction = direction == TradeDirection.Long
|
||||||
|
? TradeDirection.Short.ToString()
|
||||||
|
: TradeDirection.Long.ToString(),
|
||||||
});
|
});
|
||||||
trade = new Trade(
|
trade = new Trade(
|
||||||
DateTime.UtcNow,
|
DateTime.UtcNow,
|
||||||
|
|||||||
@@ -157,9 +157,7 @@ export async function increaseOrderHelper(
|
|||||||
externalSwapQuote: undefined,
|
externalSwapQuote: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const createSltpEntries: SidecarSlTpOrderEntryValid[] = [
|
const createSltpEntries: SidecarSlTpOrderEntryValid[] = []
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
let stopLossDecreaseAmounts: DecreasePositionAmounts | undefined;
|
let stopLossDecreaseAmounts: DecreasePositionAmounts | undefined;
|
||||||
if (params.stopLossPrice) {
|
if (params.stopLossPrice) {
|
||||||
@@ -183,8 +181,8 @@ export async function increaseOrderHelper(
|
|||||||
indexPrice: params.stopLossPrice,
|
indexPrice: params.stopLossPrice,
|
||||||
collateralPrice: 0n,
|
collateralPrice: 0n,
|
||||||
acceptablePrice: params.isLong ? 2n ** 256n - 1n : 0n,
|
acceptablePrice: params.isLong ? 2n ** 256n - 1n : 0n,
|
||||||
acceptablePriceDeltaBps: acceptablePriceInfo.acceptablePriceDeltaBps,
|
acceptablePriceDeltaBps: acceptablePriceInfo.acceptablePriceDeltaBps + 50n,
|
||||||
recommendedAcceptablePriceDeltaBps: 0n,
|
recommendedAcceptablePriceDeltaBps: 50n,
|
||||||
estimatedPnl: 0n,
|
estimatedPnl: 0n,
|
||||||
estimatedPnlPercentage: 0n,
|
estimatedPnlPercentage: 0n,
|
||||||
realizedPnl: 0n,
|
realizedPnl: 0n,
|
||||||
@@ -257,8 +255,8 @@ export async function increaseOrderHelper(
|
|||||||
indexPrice: params.takeProfitPrice, // Keep original trigger price for indexPrice
|
indexPrice: params.takeProfitPrice, // Keep original trigger price for indexPrice
|
||||||
collateralPrice: 0n, // Consider if this needs calculation
|
collateralPrice: 0n, // Consider if this needs calculation
|
||||||
acceptablePrice: acceptablePriceInfo.acceptablePrice,
|
acceptablePrice: acceptablePriceInfo.acceptablePrice,
|
||||||
acceptablePriceDeltaBps: acceptablePriceInfo.acceptablePriceDeltaBps,
|
acceptablePriceDeltaBps: acceptablePriceInfo.acceptablePriceDeltaBps + 50n, // Add 0.5% buffer to acceptable price impact
|
||||||
recommendedAcceptablePriceDeltaBps: 0n,
|
recommendedAcceptablePriceDeltaBps: 50n, // Set recommended buffer to 0.5%
|
||||||
estimatedPnl: 0n,
|
estimatedPnl: 0n,
|
||||||
estimatedPnlPercentage: 0n,
|
estimatedPnlPercentage: 0n,
|
||||||
realizedPnl: 0n,
|
realizedPnl: 0n,
|
||||||
|
|||||||
Reference in New Issue
Block a user