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:
@@ -388,6 +388,7 @@ namespace MarketData.Generator.CMMomentum
|
||||
else
|
||||
{
|
||||
Positions slotPositions = ActivePositions[slotIndex];
|
||||
List<String> slotSymbols = slotPositions.ConvertAll(x=>x.Symbol); // capture sell symbols to exclude from purchases to eliminate wash trades
|
||||
SellPositions(slotPositions, TradeDate);
|
||||
DisplaySales(slotPositions, TradeDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, "********************* S E L L *********************");
|
||||
@@ -396,8 +397,8 @@ namespace MarketData.Generator.CMMomentum
|
||||
CashBalance += slotPositions.MarketValue;
|
||||
ActivePositions[slotIndex].Clear();
|
||||
DisplayBalance();
|
||||
double cashAllocation = Math.Min(CashBalance, (ActivePositions.GetExposure() + CashBalance) / HoldingPeriod); // Even out the cash allocation so that no one slot eats up all the cash
|
||||
Positions positions=BuyPositions(slotIndex,TradeDate,AnalysisDate,cashAllocation,SymbolsHeld());
|
||||
double cashAllocation = Math.Min(CashBalance, (ActivePositions.GetExposure() + CashBalance) / HoldingPeriod); // Even out the cash allocation so that no one slot eats up all the cash
|
||||
Positions positions=BuyPositions(slotIndex,TradeDate,AnalysisDate,cashAllocation,new List<String>(SymbolsHeld().Concat(slotSymbols)));
|
||||
DisplayPurchases(positions, TradeDate);
|
||||
AddToWatchList(positions);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"********************** B U Y ********************");
|
||||
|
||||
Reference in New Issue
Block a user