Beispiel #1
0
        public void payment_insert_actual_quote(Payment paymenttemp)
        {
            int paymentkey = paymenttemp.Payments_Key;
            Quote quotetemp = new Quote();
            //Get & Store actual quote
            if (paymenttemp.Treasury_type == 1)
            {
                quotetemp = getQuote(paymenttemp.Sell_amount, paymenttemp.Sell_currency, paymenttemp.Buy_currency, true);
            }
            else
            {
                quotetemp = getQuote(paymenttemp.Sell_amount, paymenttemp.Sell_currency, paymenttemp.Buy_currency, false);
            }

            StoredProcedure sp_UpdateQuotes = Peerfx_DB.SPs.UpdateQuotes(0, quotetemp.Sellamount, paymenttemp.Sell_currency, quotetemp.Buyamount, paymenttemp.Buy_currency, quotetemp.Peerfx_Rate, quotetemp.Peerfx_Servicefee, null, null, 0);
            sp_UpdateQuotes.Execute();
            int quote_key = Convert.ToInt32(sp_UpdateQuotes.Command.Parameters[9].ParameterValue.ToString());
            Peerfx_DB.SPs.UpdatePaymentsActualQuote(paymenttemp.Payments_Key, quote_key).Execute();
        }
Beispiel #2
0
        protected void LoadRatesFillinfo(Quote quotetemp)
        {
            hdbuyrate.Value = quotetemp.Peerfx_Rate.ToString();
            hdsellcurrencysymbol.Value = sitetemp.GetCurrencySymbol(ddlsellcurrency.SelectedItem.Text) + " ";
            hdbuycurrencysymbol.Value = sitetemp.GetCurrencySymbol(ddlbuycurrency.SelectedItem.Text) + " ";
            hdservicefee.Value = quotetemp.Peerfx_Servicefee.ToString("F");
            hdbuyamount.Value = quotetemp.Buyamount.ToString("F");

            lblrate.Text = hdbuyrate.Value;
            lblservicefee.Text = hdbuycurrencysymbol.Value + hdservicefee.Value;
            lblyouget.Text = hdbuycurrencysymbol.Value + hdbuyamount.Value;
            txtbuy.Value = Convert.ToDouble(quotetemp.Buyamount);
            txtsell.Value = Convert.ToDouble(quotetemp.Sellamount);

            SetMinSellValue();

            /*lblconfirmquotereceiveamount.Text = lblyouget.Text;
            lblconfirmquoteservicefee.Text = lblservicefee.Text;
            lblconfirmquoteyouget.Text = lblyouget.Text;
            lblconfirmquoteexchangerate.Text = lblrate.Text;

            lblalreadyconfirmedquotesenderamount2.Text = hdsellcurrencysymbol.Value + txtsell.Text;
            lblalreadyconfirmedquotesenderamount.Text = lblalreadyconfirmedquotesenderamount2.Text;
             */
        }
Beispiel #3
0
        public Quote getQuote_reverse(decimal buyamount, int sellcurrency, int buycurrency,Boolean ispremium)
        {
            Quote quotetemp = new Quote();
            External_APIs.CurrencyCloud cc = new External_APIs.CurrencyCloud();
            Hashtable hstemp = cc.Exchange_Rate_ccy_pair(sellcurrency, buycurrency);

            if (!hstemp.ContainsValue("error"))
            {
                quotetemp.Bid_Price_Timestamp = getcurrencyclouddate(hstemp["bid_price_timestamp"].ToString());
                quotetemp.Bid_Price = Convert.ToDecimal(hstemp["bid_price"]);
                quotetemp.Broker_Bid = Convert.ToDecimal(hstemp["broker_bid"]);
                quotetemp.Offer_Price_Timestamp = getcurrencyclouddate(hstemp["offer_price_timestamp"].ToString());
                quotetemp.Offer_Price = Convert.ToDecimal(hstemp["offer_price"]);
                quotetemp.Broker_Offer = Convert.ToDecimal(hstemp["broker_offer"]);
                quotetemp.Market_Price = Convert.ToDecimal(hstemp["market_price"]);
                quotetemp.Value_Date = getcurrencyclouddate(hstemp["value_date"].ToString());
                quotetemp.Quote_Condition = hstemp["quote_condition"].ToString();
                quotetemp.Real_Market = hstemp["real_market"].ToString();
                quotetemp.Ccy_Pair = hstemp["ccy_pair"].ToString();
                quotetemp.Buycurrency = buycurrency;
                quotetemp.Sellcurrency = sellcurrency;

                //calculate Peerfx servicefee & rate

                if (buyamount > 0)
                {
                    quotetemp.Buyamount = buyamount;
                    decimal peerfxservicefee = 0;
                    decimal sellamount = 0;
                    decimal peerfxrate = 0;

                    Fees fees = new Fees();
                    //Calculate peerfx service fee
                    if (ispremium)
                    {
                        fees = getFeesPremium(sellcurrency, buycurrency);
                    }
                    else
                    {
                        fees = getFees(sellcurrency, buycurrency);
                    }

                    //peerfxrate
                    peerfxrate = quotetemp.Broker_Bid;
                    if (fees.Fee_Percentage != 0)
                    {
                        peerfxservicefee += (buyamount * fees.Fee_Percentage);
                    }

                    //peerfx service fee
                    if (fees.Fee_Base != 0)
                    {
                        peerfxservicefee += fees.Fee_Base;
                    }
                    if (fees.Fee_Addon != 0)
                    {
                        peerfxservicefee += fees.Fee_Addon;
                    }
                    if (fees.Fee_Min != 0)
                    {
                        if (fees.Fee_Min > peerfxservicefee)
                        {
                            peerfxservicefee = fees.Fee_Min;
                        }
                    }
                    if (fees.Fee_Max != 0)
                    {
                        if (fees.Fee_Max < peerfxservicefee)
                        {
                            peerfxservicefee = fees.Fee_Max;
                        }
                    }

                    //calculate buyingamount
                    sellamount = buyamount / peerfxrate;
                    sellamount = sellamount + peerfxservicefee;

                    //assign values
                    quotetemp.Peerfx_Servicefee = decimal.Round(peerfxservicefee, 2);
                    quotetemp.Peerfx_Rate = peerfxrate;
                    quotetemp.Sellamount = decimal.Round(sellamount, 2);
                }
            }
            return quotetemp;
        }