Exemple #1
0
 public static double testeSugestaoAcao()
 {
     Mathematica mathe = new Mathematica();
     List<HistMovimentacao> lstHistMov = HistMovimentacaoAPL.obterHistoricoCompletoPorSimboloDiaAnterior("GOOG");
     double dSugestao = mathe.SugestaoVenda(lstHistMov, 100);
     return dSugestao;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //List<HistMovimentacao> lstHist = new List<HistMovimentacao>();
            //lstHist = HistMovimentacaoAPL.ultimasNegociacoes();

            //List<Acao> listaAcao = new List<Acao>();
            //listaAcao = AcaoAPL.listarAcoes();

            //Dictionary<int, List<HistMovimentacao>> dic = new Dictionary<int, List<HistMovimentacao>>();
            //foreach (Acao item in listaAcao)
            //{
            //    dic.Add(item.ICodigo, lstHist.FindAll(a => a.Acao.ICodigo == item.ICodigo));
            //}

            Mathematica lol = new Mathematica();

            ////Curva de bollinger OK =3
            List<HistMovimentacao> lstLoL = new List<HistMovimentacao>();
            lstLoL = HistMovimentacaoAPL.obterHistoricoCompletoPorSimboloDiaAnterior("AAPL");

            //DateTime.Compare(lstLoL.Max(a => a.DtNegociada), lstLoL.Min(a => a.DtNegociada))
            Chart1.Series.Add(lol.CurvaBollingerInferior(lstLoL,20 , 2));
            Chart1.Series.Add(lol.CurvaBollingerIntermediaria(lstLoL, 20));
            Chart1.Series.Add(lol.CurvaBollingerSuperior(lstLoL, 20, 2));

            //Histograma funciona nice =3
            //Chart1.Series.Add(lol.Histograma(dic[5]));

            //Chart1.Series.Add(lol.LinhaMACD(HistMovimentacaoAPL.obterHistoricoCompletoPorSimbolo("AAPL")));
            //Chart1.Series.Add(lol.LinhaSinal(HistMovimentacaoAPL.obterHistoricoCompletoPorSimbolo("AAPL")));

            //Chart1.Series.Add(lol.VolumeWeightedAvaragePrice(HistMovimentacaoAPL.obterHistoricoCompletoPorSimbolo("GOOG"), "GOOG"));
            //Chart1.Series.Add(lol.VolumeWeightedAvaragePrice(HistMovimentacaoAPL.obterHistoricoCompletoPorSimbolo("AAPL"), "APPL"));

            List<DateTime> asdasdasd = new List<DateTime>();
        }
        protected void sugerirPrecoVenda(string text)
        {
            int iQuantidade = 0;
            string symbol = text;

            Mathematica mathe = new Mathematica();
            List<HistMovimentacao> lstHistMov = new List<HistMovimentacao>();

            lstHistMov = HistMovimentacaoAPL.obterHistoricoCompletoPorSimboloDiaAnterior(symbol);
            decimal dSugestao = Decimal.Parse(mathe.SugestaoVenda(lstHistMov, 1000).ToString());

            MessageBox msb = new MessageBox();

            msb.Alert("Sugestão de Preço", "O sistema sugere que a venda de " + symbol + " seja feita por " + decimal.Round(dSugestao, 2));
            msb.Show();
        }
        protected void compararAcoes(object sender, DirectEventArgs e)
        {
            string lol = e.ExtraParams["selected"].ToString();

            List<HistMovimentacao> HistMov = JsonConvert.DeserializeObject<List<HistMovimentacao>>(lol);
            List<Acao> lstAcao = new List<Acao>();
            lol = "asdasdasd";

            foreach (HistMovimentacao item in HistMov)
            {
                lstAcao.Add(AcaoAPL.obterAcaoPorSimbolo(item.Acao.StrSimbolo));
            }

            Mathematica mathe = new Mathematica();
            mathe.compararAcoes(lstAcao);
        }