本文整理汇总了C#中Site.getcurrencycode方法的典型用法代码示例。如果您正苦于以下问题:C# Site.getcurrencycode方法的具体用法?C# Site.getcurrencycode怎么用?C# Site.getcurrencycode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site.getcurrencycode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Exchange_Rate_ccy_pair
public Hashtable Exchange_Rate_ccy_pair(int currency1, int currency2)
{
Hashtable hstemp = new Hashtable();
Site sitetemp = new Site();
string strcurrencycodes = sitetemp.getcurrencycode(currency1) + sitetemp.getcurrencycode(currency2);
if (currency1 != currency2)
{
string url = "/prices/market/" + strcurrencycodes+ "?accept_stale=true";
/*
RestClient client = new RestClient(url);
var request = new RestRequest(Method.GET);
request.AddParameter("accept_stale", "true");
// execute the request
RestResponse response = (RestResponse)client.Execute(request);
string responseString = response.Content; // raw content as string
if (responseString.ToLower().Contains("error"))
{
token = update_info_currencycloud_token();
client.BaseUrl = geturl() + "/api/en/v1.0/" + token + "/prices/market/" + strcurrencycodes;
response = (RestResponse)client.Execute(request);
responseString = response.Content; // raw content as string
}*/
string responseString = CallWeb_Request(url, hstemp);
hstemp = JsonConvert.DeserializeObject<Hashtable>(responseString);
hstemp = JsonConvert.DeserializeObject<Hashtable>(hstemp["data"].ToString());
}
else
{
//yyyyMMdd-HH:mm:ss
hstemp.Add("bid_price_timestamp", DateTime.Now.ToString("yyyyMMdd-HH:mm:ss"));
hstemp.Add("bid_price",0.9998);
hstemp.Add("broker_bid",0.9958);
hstemp.Add("offer_price_timestamp",DateTime.Now.ToString("yyyyMMdd-HH:mm:ss"));
hstemp.Add("offer_price",1.0002);
hstemp.Add("broker_offer",1.0052);
hstemp.Add("market_price",1);
hstemp.Add("value_date",DateTime.Now.ToString("yyyyMMdd"));
hstemp.Add("quote_condition","open");
hstemp.Add("real_market",strcurrencycodes);
hstemp.Add("ccy_pair",strcurrencycodes);
}
return hstemp;
}