Ejemplo n.º 1
0
        void ShowSummary(Order2GoAddIn.Summary Summary, Account Account)
        {
            var    summary = Summary ?? new Order2GoAddIn.Summary();
            double buyLossPerLotK;
            double sellLossPerLotK;

            SellPL        = summary.SellNetPL;
            SellLots      = summary.SellLots;
            SellLPP       = summary.SellLPP;
            SellPositions = summary.SellPositions;
            SellPips      = (int)(summary.SellDelta / summary.PointSize);
            BuyPL         = summary.BuyNetPL;
            BuyLots       = summary.BuyLots;
            BuyLPP        = summary.BuyLPP;
            BuyPositions  = summary.BuyPositions;
            BuyPips       = (int)(summary.BuyDelta / summary.PointSize);
            var totalPips = (summary.BuyPriceFirst - summary.SellPriceFirst) / fw.GetPipSize(pair);

            BuyPipsToNet    = summary.BuyNetPLPip;
            SellPipsToNet   = summary.SellNetPLPip;
            buyLossPerLotK  = summary.BuyLots > 0 ? summary.BuyNetPL / (summary.BuyLots / 1000) : 0;
            sellLossPerLotK = summary.SellLots > 0 ? summary.SellNetPL / (summary.SellLots / 1000) : 0;
        }
Ejemplo n.º 2
0
        //
        #endregion

        public void LoadOffersInfo()
        {
            GlobalStorage.UseForexContext(context => {
                foreach (var offer in o2g.GetOffers())
                {
                    var pair    = offer.Pair;
                    var dbOffer = context.t_Offer.SingleOrDefault(o => o.Pair == pair);
                    if (dbOffer == null)
                    {
                        context.t_Offer.AddObject(new t_Offer()
                        {
                            Pair = pair, Digits = o2g.GetDigits(pair), PipCost = offer.PipCost, MMR = offer.MMR, PipSize = o2g.GetPipSize(pair)
                        });
                    }
                    else
                    {
                        dbOffer.PipCost = offer.PipCost;
                        dbOffer.MMR     = offer.MMR;
                    }
                    context.SaveChanges();
                }
            });
        }