Add changes to all models to eliminate selling and immediately buying back the same security as this is considered a Wash Trade and is illegal.
Some checks failed
Build .NET Project / build (push) Has been cancelled
Some checks failed
Build .NET Project / build (push) Has been cancelled
This commit is contained in:
@@ -378,6 +378,7 @@ namespace MarketData.Generator.Momentum
|
||||
else
|
||||
{
|
||||
Positions slotPositions=ActivePositions[slotIndex];
|
||||
List<String> closedSymbols = slotPositions.ConvertAll(x => x.Symbol); // capture the sell symbols to avoid buying straight back (wash trades)
|
||||
SellPositions(slotPositions,TradeDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"********************* S E L L *********************");
|
||||
slotPositions.Display();
|
||||
@@ -390,7 +391,7 @@ namespace MarketData.Generator.Momentum
|
||||
cashAllocation = Math.Min(CashBalance, (ActivePositions.GetExposure() + CashBalance) / (double)HoldingPeriod);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("CASH ALLOCATION:{0}",Utility.FormatCurrency(cashAllocation)));
|
||||
Positions positions = null;
|
||||
positions=BuyPositions(TradeDate,AnalysisDate,cashAllocation,SymbolsHeld(TradeDate));
|
||||
positions=BuyPositions(TradeDate,AnalysisDate,cashAllocation,new List<String>(SymbolsHeld(TradeDate).Concat(closedSymbols)));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"********************** B U Y ********************");
|
||||
positions.Display();
|
||||
if(CashBalance-positions.Exposure<=0.00)
|
||||
|
||||
Reference in New Issue
Block a user