Fix Sell Date in the ClosePositionDialogViewModel
This commit is contained in:
@@ -24,77 +24,6 @@ using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace PortfolioManager.Renderers
|
||||
{
|
||||
|
||||
// ********************************************************************************************************************************
|
||||
// public class TextPlot
|
||||
// {
|
||||
// public TextPlot()
|
||||
// {
|
||||
// }
|
||||
// public TextPlot(String markerText,SKRect boundingRect,Pixel screenCoordinates)
|
||||
// {
|
||||
// BoundingRect = boundingRect;
|
||||
// ScreenCoordinates = screenCoordinates;
|
||||
// MarkerText = markerText;
|
||||
// }
|
||||
// public Pixel ScreenCoordinates { get; set; }
|
||||
// public SKRect BoundingRect { get; set; }
|
||||
// public String MarkerText { get; set; }
|
||||
// }
|
||||
|
||||
// public class TextPlots : List<TextPlot>
|
||||
// {
|
||||
// public TextPlots()
|
||||
// {
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// The coordinate system is based on (0,0) in the upper left
|
||||
// /// </summary>
|
||||
// /// <param name="coordinates"></param>
|
||||
// /// <returns></returns>
|
||||
// public bool PointInRects(String markerText,Pixel screenCoordinates,ref Pixel adjustedScreenCoordinates,float factor)
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"Searching for rectangles in X:{screenCoordinates.X}Y:{screenCoordinates.Y}");
|
||||
// foreach(TextPlot textPlot in this)
|
||||
// {
|
||||
// if(Math.Round(screenCoordinates.X,2) >= Math.Round(textPlot.BoundingRect.Left,2) &&
|
||||
// Math.Round(screenCoordinates.X,2) <= Math.Round(textPlot.BoundingRect.Right,2) &&
|
||||
// Math.Round(screenCoordinates.Y,2) >= Math.Round(textPlot.BoundingRect.Top,2) &&
|
||||
// Math.Round(screenCoordinates.Y,2) <= Math.Round(textPlot.BoundingRect.Bottom,2))
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"The text {markerText} at Point:X:{screenCoordinates.X}:Y:{screenCoordinates.Y} is within Rect:L({textPlot.BoundingRect.Left}),T({textPlot.BoundingRect.Top}),R({textPlot.BoundingRect.Right}),B({textPlot.BoundingRect.Bottom}) with text {textPlot.MarkerText} which is plotted at Coordinates:X:{textPlot.ScreenCoordinates.X} Y:{textPlot.ScreenCoordinates.Y}");
|
||||
// SKRect lowestRect = FindLowestAdjacentRect(textPlot.BoundingRect);
|
||||
// adjustedScreenCoordinates.Y = textPlot.ScreenCoordinates.Y - factor;
|
||||
// adjustedScreenCoordinates.X = screenCoordinates.X;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public void Summary()
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"TextPlots:{Count}");
|
||||
// foreach(TextPlot textPlot in this)
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,$"Rect:L({textPlot.BoundingRect.Left}),T({textPlot.BoundingRect.Top}),R({textPlot.BoundingRect.Right}),B({textPlot.BoundingRect.Bottom}) with text {textPlot.MarkerText} is plotted at Coordinates:X:{textPlot.ScreenCoordinates.X} Y:{textPlot.ScreenCoordinates.Y}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Find the Rectangle with the highest Bottom that lies within the X-plane
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// private SKRect FindLowestAdjacentRect(SKRect rect)
|
||||
// {
|
||||
// List<SKRect> adjacentRects = this.Where(x=> rect.Left >= x.BoundingRect.Left && rect.Right <= x.BoundingRect.Right).Select(x=>x.BoundingRect).ToList();
|
||||
// if(null == adjacentRects || 0==adjacentRects.Count)return new SKRect(){Left=0,Top=0,Right=0,Bottom=0};
|
||||
// adjacentRects = adjacentRects.OrderByDescending(x=>x.Bottom).ToList();
|
||||
// return adjacentRects[0];
|
||||
// }
|
||||
// }
|
||||
|
||||
public class MarkerItem
|
||||
{
|
||||
public MarkerItem(double markerDate, double markerPrice)
|
||||
@@ -131,11 +60,6 @@ namespace PortfolioManager.Renderers
|
||||
{
|
||||
double markerItemDate = markerItem.MarkerDate;
|
||||
double markerItemPrice = markerItem.MarkerPrice;
|
||||
// double minDate = markerItemDate/(1.00+DATE_SPREAD_PCNT/100.0);
|
||||
// double maxDate = markerItemDate*(1.00+DATE_SPREAD_PCNT/100.0);
|
||||
// double minPrice = markerItemPrice/(1.00+PRICE_SPREAD_PCNT/100.0);
|
||||
// double maxPrice = markerItemPrice*(1.00+PRICE_SPREAD_PCNT/100.0);
|
||||
|
||||
double minDate = markerItemDate - offsetDictionary.HorizontalSpread*(DATE_SPREAD_PCNT/100.0);
|
||||
double maxDate = markerItemDate + offsetDictionary.HorizontalSpread*(DATE_SPREAD_PCNT/100.0);
|
||||
double minPrice = markerItemPrice - offsetDictionary.VerticalSpread*(PRICE_SPREAD_PCNT/100.0);
|
||||
@@ -172,9 +96,7 @@ namespace PortfolioManager.Renderers
|
||||
private Prices prices = default;
|
||||
private BollingerBands bollingerBands;
|
||||
private InsiderTransactionSummaries insiderTransactionSummaries = null;
|
||||
// private TextPlots textPlots = new TextPlots();
|
||||
private TextMarkerManager textMarkerManager = new TextMarkerManager();
|
||||
|
||||
private OffsetDictionary offsets = new OffsetDictionary();
|
||||
|
||||
public BollingerBandRenderer(AvaPlot plotter)
|
||||
@@ -268,7 +190,6 @@ namespace PortfolioManager.Renderers
|
||||
}
|
||||
}
|
||||
bollingerBands = BollingerBandGenerator.GenerateBollingerBands(prices);
|
||||
// textPlots.Clear();
|
||||
textMarkerManager.Clear();
|
||||
CalculateOffsets();
|
||||
GenerateBollingerBands();
|
||||
@@ -358,19 +279,8 @@ namespace PortfolioManager.Renderers
|
||||
coordinates = new Coordinates(dates[0].ToOADate() - offsets.Offset(OffsetDictionary.OffsetType.HorizontalOffset3PC),
|
||||
values[0] - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
|
||||
|
||||
coordinates = textMarkerManager.GetBestMarkerLocation(coordinates.X, coordinates.Y, offsets, offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
|
||||
// Pixel screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// Pixel adjScreenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// if(textPlots.PointInRects(sb.ToString(),screenCoordinates,ref adjScreenCoordinates,(float)offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC)))
|
||||
// {
|
||||
// coordinates.Y-=offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC);
|
||||
// }
|
||||
// screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// SKRect markerRect = new SKRect(){Left=(float)screenCoordinates.X,Top=(float)screenCoordinates.Y,Right=(float)screenCoordinates.X+image.Width,Bottom=(float)screenCoordinates.Y+image.Height};
|
||||
// textPlots.Add(new TextPlot(sb.ToString(),markerRect,screenCoordinates));
|
||||
|
||||
imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
|
||||
@@ -423,15 +333,6 @@ namespace PortfolioManager.Renderers
|
||||
limit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
|
||||
coordinates = textMarkerManager.GetBestMarkerLocation(coordinates.X, coordinates.Y,offsets, offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
// Pixel screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// Pixel adjScreenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// if(textPlots.PointInRects(sb.ToString(),screenCoordinates,ref adjScreenCoordinates,(float)offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC)))
|
||||
// {
|
||||
// coordinates.Y-=offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC);
|
||||
// }
|
||||
// screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// SKRect markerRect = new SKRect(){Left=(float)screenCoordinates.X,Top=(float)screenCoordinates.Y,Right=(float)screenCoordinates.X+image.Width,Bottom=(float)screenCoordinates.Y+image.Height};
|
||||
// textPlots.Add(new TextPlot(sb.ToString(),markerRect,screenCoordinates));
|
||||
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
@@ -452,15 +353,6 @@ namespace PortfolioManager.Renderers
|
||||
stopLimit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
|
||||
coordinates = textMarkerManager.GetBestMarkerLocation(coordinates.X, coordinates.Y,offsets, offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
// Pixel screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// Pixel adjScreenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// if(textPlots.PointInRects(sb.ToString(),screenCoordinates,ref adjScreenCoordinates,(float)offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC)))
|
||||
// {
|
||||
// coordinates.Y-=offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC);
|
||||
// }
|
||||
// screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// SKRect markerRect = new SKRect(){Left=(float)screenCoordinates.X,Top=(float)screenCoordinates.Y,Right=(float)screenCoordinates.X+image.Width,Bottom=(float)screenCoordinates.Y+image.Height};
|
||||
// textPlots.Add(new TextPlot(sb.ToString(),markerRect,screenCoordinates));
|
||||
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
@@ -498,15 +390,6 @@ namespace PortfolioManager.Renderers
|
||||
portfolioTrade.Price - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
|
||||
coordinates = textMarkerManager.GetBestMarkerLocation(coordinates.X, coordinates.Y,offsets, offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
|
||||
// Pixel screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// Pixel adjScreenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// if(textPlots.PointInRects(sb.ToString(),screenCoordinates,ref adjScreenCoordinates,(float)offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC)))
|
||||
// {
|
||||
// coordinates.Y-=offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC);
|
||||
// }
|
||||
// screenCoordinates = Plotter.Plot.GetPixel(coordinates);
|
||||
// SKRect markerRect = new SKRect(){Left=(float)screenCoordinates.X,Top=(float)screenCoordinates.Y,Right=(float)screenCoordinates.X+image.Width,Bottom=(float)screenCoordinates.Y+image.Height};
|
||||
// textPlots.Add(new TextPlot(sb.ToString(),markerRect,screenCoordinates));
|
||||
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
@@ -625,7 +508,6 @@ namespace PortfolioManager.Renderers
|
||||
Low = BollingerBandModel.Low(bollingerBands);
|
||||
Close = BollingerBandModel.Close(bollingerBands);
|
||||
SMAN = BollingerBandModel.SMAN(bollingerBands);
|
||||
// Volume = BollingerBandModel.Volume(bollingerBands);
|
||||
|
||||
Scatter scatter = default;
|
||||
{
|
||||
@@ -803,7 +685,6 @@ namespace PortfolioManager.Renderers
|
||||
private CompositeDataSource Low { get; set; } = Empty();
|
||||
private CompositeDataSource Close { get; set; } = Empty();
|
||||
private CompositeDataSource SMAN { get; set; } = Empty();
|
||||
private CompositeDataSource Volume { get; set; } = Empty();
|
||||
private CompositeDataSource LeastSquares { get; set; } = Empty();
|
||||
private CompositeDataSource ZeroPoint { get; set; } = Empty();
|
||||
private CompositeDataSource StopLimits { get; set; } = Empty();
|
||||
|
||||
Reference in New Issue
Block a user