예제 #1
0
 public void payment_convert_currency_CC(Payment paymenttemp)
 {
     //Execute trade with CC
     External_APIs.CurrencyCloud cc = new External_APIs.CurrencyCloud();
     cc.Trade_Execute(paymenttemp.Payments_Key);
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     External_APIs.CurrencyCloud cc = new External_APIs.CurrencyCloud();
        Hashtable hstemp = cc.Exchange_Rate_ccy_pair(2,1);
 }
예제 #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;
        }