Ejemplo n.º 1
0
        private string GetValueText(StonkValues value)
        {
            string l = "";

            l += value.Symbol + ",";
            l += value.Time.ToString() + ",";
            l += value.AskPrice.ToString() + ",";
            l += value.BidPrice.ToString();
            return(l);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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
            });
        }