private string GetValueText(StonkValues value) { string l = ""; l += value.Symbol + ","; l += value.Time.ToString() + ","; l += value.AskPrice.ToString() + ","; l += value.BidPrice.ToString(); return(l); }
public StonkValues GetValue(string s) { var l = s.Split(','); var symb = l[0]; var time = DateTime.Parse(l[2]); var ask = double.Parse(l[3]); var bid = double.Parse(l[4]); StonkValues val = new StonkValues(symb, time, ask, bid); return(val); }
public Comparison Coordinate(StonkValues v1) { Comparison Comp = new Comparison(); Comp.Values[0] = Symbol == "AAPL" ? 1 : 0; Comp.Values[1] = Symbol == "QQQ" ? 1 : 0; Comp.Values[2] = Symbol == "VTI" ? 1 : 0; Comp.Values[3] = (this.Time - v1.Time).TotalHours; Comp.Values[4] = (v1.Time.Hour + (v1.Time.Minute / 60)) / 24.0; Comp.Values[6] = (v1.AskPrice - this.AskPrice) / this.AskPrice; Comp.Values[7] = (v1.BidPrice - this.BidPrice) / this.BidPrice; return(Comp); }
public static double[] GetMax(List <StonkValues> vals, StonkValues val) { double[] output = new double[3]; var max = vals.OrderByDescending(x => x.AskPrice).ToList().Take((int)Math.Ceiling(vals.Count() * 0.1)); var min = vals.OrderBy(x => x.AskPrice).ToList().Take((int)Math.Ceiling(vals.Count() * 0.1)); if (max.Any(x => x.AskPrice < val.AskPrice)) { return new double[3] { 0, 1, 0 } } ; if (min.Any(x => x.AskPrice > val.AskPrice)) { return new double[3] { 0, 0, 1 } } ; return(new double[3] { 1, 0, 0 }); }