Exemplo n.º 1
0
        private void CmbxProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            string         product  = CmbxProduct.Text;
            ProductSetting settings = Manager.ForexConfiguration.ProductSettings[product];

            this.UpdateAmount();
        }
 public void AddProductSetting(ProductSetting productSetting, int concernId, int userId)
 {
     productSetting.CreationDate = DateTime.Now;
     productSetting.ConcernId    = concernId;
     productSetting.Creator      = userId;
     _context.ProductSettings.Add(productSetting);
     _context.SaveChanges();
 }
        public JsonResult AddCategory(ProductSetting productSetting)
        {
            var concernId = Convert.ToInt32(Session["ConcernId"]);
            var userId    = Convert.ToInt32(Session["UserId"]);

            _product.AddProductSetting(productSetting, concernId, userId);
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public void UpdateItemsProducts()
        {
            if (Manager == null || !Manager.IsLoadedConfiguration)
            {
                return;
            }

            Dictionary <string, ProductSetting> Settings = Manager.ForexConfiguration.ProductSettings;
            List <string> Products = new List <string>();
            bool          active   = false;
            bool          popular  = false;

            this.Invoke((MethodInvoker)(() =>
            {
                active = ChbxActive.Checked;
                popular = ChbxPopular.Checked;
            }));

            foreach (KeyValuePair <string, ProductSetting> KVP in Settings)
            {
                string         product  = KVP.Key;
                ProductSetting settings = KVP.Value;

                if (active && !settings.Active)
                {
                    continue;
                }

                if (popular && !settings.IsPopularMarket)
                {
                    continue;
                }

                //if (!settings.QuickPair || !settings.Subscribed)  continue;

                Products.Add(product);
            }

            if (Products.Count <= 0)
            {
                return;
            }

            this.Invoke((MethodInvoker)(() =>
            {
                string sProduct = CmbxProduct.Text;
                CmbxProduct.Items.Clear();
                CmbxProduct.Items.AddRange(Products.ToArray());
                if (!CmbxProduct.Items.Contains(sProduct))
                {
                    CmbxProduct.SelectedIndex = 0;
                }
                else
                {
                    CmbxProduct.Text = sProduct;
                }
            }));
        }
Exemplo n.º 5
0
        /// <summary>
        /// This function updates amount textbox (TbxAmount.Text) on TradingControl based on current product settings
        /// </summary>
        private void UpdateAmount()
        {
            string product = CmbxProduct.Text;

            if (System.String.IsNullOrEmpty(product) || Manager == null || !Manager.IsLoadedConfiguration)
            {
                return;
            }

            ProductSetting settings = Manager.ForexConfiguration.ProductSettings[product];
            int            lots     = Asmodat.Abbreviate.Integer.Parse(TbxLots.Text, 1, 1, int.MaxValue);

            TbxAmount.Text = (lots * int.Parse(settings.OrderSize)).ToString();
        }
Exemplo n.º 6
0
        public ProductSettingPage()
        {
            this.InitializeComponent();

            // x86/x64でもリモート環境と同じWindowサイズで起動する
            ApplicationView.PreferredLaunchViewSize = new Size {
                Width = 800, Height = 480
            };
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;


            p           = new ProductSetting(this);
            DataContext = p;
        }
Exemplo n.º 7
0
        public void DealClose(string confirmation, int tolerance, int expiration)
        {
            if (System.String.IsNullOrEmpty(confirmation))
            {
                return;
            }

            Deal deal = this.GetDealByConfirmationNumber(confirmation);


            if (deal == null)
            {
                return;
            }



            string product = deal.Product;


            if (!IsReady || !ForexConfiguration.ProductSettings.ContainsKey(product) || !ForexRates.Data.ContainsKey(product))
            {
                return;
            }

            ProductSetting Settings = ForexConfiguration.ProductSettings[product];
            Rate           rate     = ForexRates.GetRate(product);

            DealRequest DRequest = new DealRequest(expiration);

            DRequest.Product            = deal.Product;
            DRequest.Amount             = Math.Abs(int.Parse(deal.Contract)); //It can be negative if positionis short
            DRequest.ConfirmationNumber = deal.ConfirmationNumber;
            DRequest.DealSequence       = deal.DealSequence;
            DRequest.DealReference      = deal.DealReference;
            DRequest.Contract           = deal.Contract;
            DRequest.ASK       = rate.OFFER;
            DRequest.BID       = rate.BID;
            DRequest.BuySell   = deal.BuySell;// DRequest.Buy = !DRequest.Buy; //Reverse Order for closing purpouses
            DRequest.Buy       = !DRequest.Buy;
            DRequest.Close     = true;
            DRequest.Rate      = deal.Rate;
            DRequest.Tolerance = tolerance;

            this.Save(DRequest);
        }
Exemplo n.º 8
0
        private void Update(string product)
        {
            ProductSetting PSettings = CEDC_Configuration.GetProductSetting(TOKEN, product).Output[0];

            if (DATA.ContainsKey(product))
            {
                while (!DATA.TryUpdate(product, PSettings, DATA[product]))
                {
                    ;
                }
            }
            else
            {
                while (!DATA.TryAdd(product, PSettings))
                {
                    ;
                }
            }
        }
Exemplo n.º 9
0
        public void DealRequest(bool TFBuySell, Rate rate, int amount, int tolerance, int expiration = 1000)
        {
            string product = rate.Pair;

            if (!IsReady || !ForexConfiguration.ProductSettings.ContainsKey(product) || !ForexRates.Data.ContainsKey(product))
            {
                return;
            }

            ProductSetting Settings = ForexConfiguration.ProductSettings[product];
            DealRequest    DRequest = new DealRequest(expiration);

            DRequest.Product   = product;
            DRequest.Executed  = false;
            DRequest.Buy       = TFBuySell;
            DRequest.Close     = false;
            DRequest.ASK       = rate.OFFER;
            DRequest.BID       = rate.BID;
            DRequest.Amount    = amount; //DRequest.Lots = (lots * int.Parse(Settings.OrderSize)).ToString();
            DRequest.Tolerance = tolerance;


            this.Save(DRequest);
        }