Changes
This commit is contained in:
@@ -19,7 +19,7 @@ namespace MarketData.MarketDataModel
|
|||||||
public PortfolioTrades Trades { get; set; }
|
public PortfolioTrades Trades { get; set; }
|
||||||
}
|
}
|
||||||
// ************************************************************************************
|
// ************************************************************************************
|
||||||
public class GainLossSummaryItemDetail: GainLossSummaryItem
|
public class GainLossSummaryItemDetail : GainLossSummaryItem
|
||||||
{
|
{
|
||||||
public GainLossSummaryItemDetail()
|
public GainLossSummaryItemDetail()
|
||||||
{
|
{
|
||||||
@@ -46,6 +46,5 @@ namespace MarketData.MarketDataModel
|
|||||||
public double PercentDistanceFromAllTimeGainLossPercent{get;set;}
|
public double PercentDistanceFromAllTimeGainLossPercent{get;set;}
|
||||||
public Price LatestPrice{get;set;}
|
public Price LatestPrice{get;set;}
|
||||||
public double PriceChange{get;set;}
|
public double PriceChange{get;set;}
|
||||||
public bool HasStopLimit{get;set;}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,11 +302,15 @@ namespace Navigator.Renderers
|
|||||||
if(bollingerBandGraphs.ContainsKey((int)Band.Low))yExtents.Add(bollingerBandGraphs[(int)Band.Low].GetYExtent());
|
if(bollingerBandGraphs.ContainsKey((int)Band.Low))yExtents.Add(bollingerBandGraphs[(int)Band.Low].GetYExtent());
|
||||||
if(bollingerBandGraphs.ContainsKey((int)Band.Close))yExtents.Add(bollingerBandGraphs[(int)Band.Close].GetYExtent());
|
if(bollingerBandGraphs.ContainsKey((int)Band.Close))yExtents.Add(bollingerBandGraphs[(int)Band.Close].GetYExtent());
|
||||||
if(bollingerBandGraphs.ContainsKey((int)Band.SMAN))yExtents.Add(bollingerBandGraphs[(int)Band.SMAN].GetYExtent());
|
if(bollingerBandGraphs.ContainsKey((int)Band.SMAN))yExtents.Add(bollingerBandGraphs[(int)Band.SMAN].GetYExtent());
|
||||||
double maxDataExtent=yExtents.Count>0?yExtents.Max(x=>x):0;
|
if(null!=portfolioTradesWithParityPrice&&null!=portfolioTradesWithParityPrice.ParityPrice)
|
||||||
if(null!=portfolioTradesWithParityPrice&&null!=portfolioTradesWithParityPrice.ParityPrice&&portfolioTradesWithParityPrice.ParityPrice.Close>maxDataExtent)
|
|
||||||
{
|
{
|
||||||
maxDataExtent=portfolioTradesWithParityPrice.ParityPrice.Close;
|
yExtents.Add(portfolioTradesWithParityPrice.ParityPrice.Close);
|
||||||
}
|
}
|
||||||
|
if(null!=stopLimit)
|
||||||
|
{
|
||||||
|
yExtents.Add(stopLimit.StopPrice);
|
||||||
|
}
|
||||||
|
double maxDataExtent=yExtents.Count>0?yExtents.Max(x=>x):0;
|
||||||
return maxDataExtent;
|
return maxDataExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,11 +326,16 @@ namespace Navigator.Renderers
|
|||||||
if(bollingerBandGraphs.ContainsKey((int)Band.Low))yExtents.Add(bollingerBandGraphs[(int)Band.Low].GetYExtentMin());
|
if(bollingerBandGraphs.ContainsKey((int)Band.Low))yExtents.Add(bollingerBandGraphs[(int)Band.Low].GetYExtentMin());
|
||||||
if(bollingerBandGraphs.ContainsKey((int)Band.Close))yExtents.Add(bollingerBandGraphs[(int)Band.Close].GetYExtentMin());
|
if(bollingerBandGraphs.ContainsKey((int)Band.Close))yExtents.Add(bollingerBandGraphs[(int)Band.Close].GetYExtentMin());
|
||||||
if(bollingerBandGraphs.ContainsKey((int)Band.SMAN))yExtents.Add(bollingerBandGraphs[(int)Band.SMAN].GetYExtentMin());
|
if(bollingerBandGraphs.ContainsKey((int)Band.SMAN))yExtents.Add(bollingerBandGraphs[(int)Band.SMAN].GetYExtentMin());
|
||||||
double minDataExtent=yExtents.Count>0?yExtents.Min(x=>x):0;
|
|
||||||
if(null!=portfolioTradesWithParityPrice&&null!=portfolioTradesWithParityPrice.ParityPrice&&portfolioTradesWithParityPrice.ParityPrice.Close<minDataExtent)
|
if(null!=portfolioTradesWithParityPrice&&null!=portfolioTradesWithParityPrice.ParityPrice)
|
||||||
{
|
{
|
||||||
minDataExtent=portfolioTradesWithParityPrice.ParityPrice.Close;
|
yExtents.Add(portfolioTradesWithParityPrice.ParityPrice.Close);
|
||||||
}
|
}
|
||||||
|
if(null!=stopLimit)
|
||||||
|
{
|
||||||
|
yExtents.Add(stopLimit.StopPrice);
|
||||||
|
}
|
||||||
|
double minDataExtent=yExtents.Count>0?yExtents.Min(x=>x):0;
|
||||||
return minDataExtent;
|
return minDataExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
Navigator/Services/DataStore/IDataStore.cs
Normal file
24
Navigator/Services/DataStore/IDataStore.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Navigator.Services
|
||||||
|
{
|
||||||
|
public interface IDataStore<T>
|
||||||
|
{
|
||||||
|
Task<bool> AddItemAsync(T item);
|
||||||
|
|
||||||
|
bool AddItem(T item);
|
||||||
|
|
||||||
|
Task<bool> UpdateItemAsync(T item);
|
||||||
|
|
||||||
|
Task<bool> DeleteItemAsync(string id);
|
||||||
|
|
||||||
|
bool DeleteItem(string id);
|
||||||
|
|
||||||
|
Task<T> GetItemAsync(string id);
|
||||||
|
|
||||||
|
T GetItem(string id);
|
||||||
|
|
||||||
|
Task<IEnumerable<T>> GetItemsAsync(bool forceRefresh = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
78
Navigator/Services/DataStore/MockDataStore.cs
Normal file
78
Navigator/Services/DataStore/MockDataStore.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Navigator.Models;
|
||||||
|
|
||||||
|
namespace Navigator.Services
|
||||||
|
{
|
||||||
|
public class MockDataStore : IDataStore<Item>
|
||||||
|
{
|
||||||
|
readonly List<Item> items;
|
||||||
|
|
||||||
|
public MockDataStore()
|
||||||
|
{
|
||||||
|
items = new List<Item>();
|
||||||
|
//items = new List<Item>()
|
||||||
|
// {
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "First item", Description="This is an item description." },
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "Second item", Description="This is an item description." },
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "Third item", Description="This is an item description." },
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "Fourth item", Description="This is an item description." },
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "Fifth item", Description="This is an item description." },
|
||||||
|
// new Item { Id = Guid.NewGuid().ToString(), Text = "Sixth item", Description="This is an item description." }
|
||||||
|
// };
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddItemAsync(Item item)
|
||||||
|
{
|
||||||
|
items.Add(item);
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddItem(Item item)
|
||||||
|
{
|
||||||
|
items.Add(item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateItemAsync(Item item)
|
||||||
|
{
|
||||||
|
var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
|
||||||
|
items.Remove(oldItem);
|
||||||
|
items.Add(item);
|
||||||
|
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DeleteItemAsync(string id)
|
||||||
|
{
|
||||||
|
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
|
||||||
|
items.Remove(oldItem);
|
||||||
|
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteItem(string id)
|
||||||
|
{
|
||||||
|
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
|
||||||
|
items.Remove(oldItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Item> GetItemAsync(string id)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item GetItem(string id)
|
||||||
|
{
|
||||||
|
return items.FirstOrDefault(s => s.Id==id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user