Google Finance와 같은 API를 통해 환율을 얻으려면 어떻게해야하나요? [닫은]
이제 Google Finance API를 찾아서 살펴보기 시작했지만 포트폴리오, 거래, 포지션 및 내가 모르는 기타 정보에 대한 많은 정보를 찾았습니다.
잘못된 문서를보고 있습니까? GF에서 환율 피드를 받으려면 어떻게해야합니까? 이것도 가능합니까?
편집하다
좀 더 명확하게하기 위해. 나는 기술적 인 것에 관심이없고 어떤 코드도 원하지 않는다.
모든 답변에 감사드립니다.
무료 통화 변환기
- 30 분마다 업데이트되는 요금
- 이제 무료 서버에 API 키가 필요합니다.
샘플 전환 URL은 다음과 같습니다. http://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=y
후손을 위해 그들은 다른 가능한 대답과 함께 있습니다.
야후 금융 API단종 2017-11-06메시지와 함께 2017-11-06 현재 중단
이 서비스가 Yahoo 서비스 약관을 위반하여 사용되고 있다는 점에 주목했습니다. 따라서 서비스가 중단됩니다. 미래의 모든 시장 및 주식 데이터 연구에 대해서는 finance.yahoo.com을 참조하십시오.
요청 : http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=USDINR=X
이 CSV는 Curry 라는 jQuery 플러그인에서 사용되었습니다 . Curry는 (2017-08-29) 이후 안정성 문제로 인해 fixer.io를 대신 사용했습니다. CSV 이상이 필요한 경우 유용 할 수 있습니다.( 덕분에 Keyo에 ) 야후 쿼리 언어 는 XML 또는 JSON 한 번에 통화의 전체 무리를 얻을 수 있습니다. 데이터는 두 번째 (유럽 중앙 은행에 오래된 데이터가 있음)에 의해 업데이트되고 주말에 중지됩니다. 가입 할 필요가 없습니다.
여기는
YQL 쿼리 빌더, 검색어를 테스트하고 URL을 복사 할 수있는 위치 : (NO LONGER AVAILABLE)
오픈 소스 환율 API
개인 사용 무료 (한달에 1000 회 발생)
무료 계정에서는 "기본"( "USD"에서)을 변경할 수 없습니다
. 등록이 필요합니다.
요청 : http://openexchangerates.org/latest.json
응답 :{ "disclaimer": "This data is collected from various providers ...", "license": "all code open-source under GPL v3 ...", "timestamp": 1323115901, "base": "USD", "rates": { "AED": 3.66999725, "ALL": 102.09382091, "ANG": 1.78992886, // 115 more currency rates here ... } }통화 계층 API
월간 조회수 250 회 무료 계획
무료 계정에서는 "소스"( "USD"에서)를 변경할 수 없습니다
. 등록이 필요합니다.
설명서 : currencylayer.com/documentation
JSON 응답 :{ [...] "timestamp": 1436284516, "source": "USD", "quotes": { "USDAUD": 1.345352401, "USDCAD": 1.27373397, "USDCHF": 0.947845302, "USDEUR": 0.91313905, "USDGBP": 0.647603397, // 168 world currencies } }Fixer.io API (유럽 중앙 은행 데이터)
월간 조회수 1,000 회 무료 계획
무료 계정에서는 "소스"( "USD"에서)를 변경할 수 없습니다. 등록이 필요합니다.이 API 엔드 포인트는 더 이상 사용되지 않으며 2018 년 6 월 1 일부터 작동이 중단됩니다. 자세한 내용은 https://github.com/fixerAPI/fixer#readme를 참조하십시오.
웹 사이트 : http://fixer.io/
요청 예 : http://api.fixer.io/latest?base=USD
매일 하나의 값만 수집유럽 중앙 은행 피드
문서 : http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html#dev
요청 : http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
XML 응답 :<Cube> <Cube time="2015-07-07"> <Cube currency="USD" rate="1.0931"/> <Cube currency="JPY" rate="133.88"/> <Cube currency="BGN" rate="1.9558"/> <Cube currency="CZK" rate="27.100"/> </Cube>exchangeratesapi.io
웹 사이트에 따르면 :
환율 API는 유럽 중앙 은행이 발행 한 현재 및 과거 환율에 대한 무료 서비스입니다
이 서비스는 fixer.io와 호환되며 API 키가 필요하지 않아 사용이 매우 쉽습니다. 예를 들어 CURL을 사용하지만 자주 사용하는 요청 도구를 사용할 수 있습니다.> curl https://api.exchangeratesapi.io/latest?base=GBP&symbols=USD {"base":"GBP","rates":{"USD":1.264494191},"date":"2019-05-29"}CurrencyApi.net
월별 1250 회 히트 무료 계획
기본 통화는 무료 계정에서 USD로 설정됩니다
. 등록이 필요합니다.
설명서 : currencyapi.net/documentation
JSON 응답 :{ "valid": true, "timestamp": 1567957373, "base": "USD", "rates": { "AED": 3.673042, "AFN": 77.529504, "ALL": 109.410403, // 165 currencies + some cryptos } }
ECB (European Central Bank)에도 내가 아는 가장 안정적인 무료 피드가 있습니다. 약 28 개의 통화가 포함되어 있으며 매일 업데이트됩니다.
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
더 많은 형식과 도구는 ECB 참조 페이지를 참조하십시오. http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
Yahoo에는 YQL 기능이있어 XML 또는 JSON으로 한 번에 전체 통화를 얻을 수 있습니다. ECB에 오래된 데이터가 있고 분 단위로 주말에 데이터가 최신 상태임을 알았습니다.
쿼리를 테스트하고 URL을 복사 할 수있는 쿼리 빌더는 다음과 같습니다.
한 통화를 다른 통화로 변환하기 위해 무료이며 간단한 API가 필요한 경우 free.currencyconverterapi.com을 사용해보십시오 .
면책 조항, 나는 웹 사이트의 저자이며 다른 웹 사이트 중 하나에 사용합니다.
이 서비스는 상용 응용 프로그램에서도 무료로 사용할 수 있지만 보증은 제공하지 않습니다. 성능상의 이유로 값은 1 시간마다 업데이트됩니다.
A sample conversion URL is: http://free.currencyconverterapi.com/api/v6/convert?q=EUR_PHP&compact=ultra&apiKey=sample-api-key which will return a json-formatted value, e.g. {"EUR_PHP":60.849184}
I got this content from http://www.scriptarticle.com/2012/05/03/get-live-currency-rates-and-currency-conversion-using-php-and-apis/
<?php
function get_currency($from_Currency, $to_Currency, $amount) {
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$url = "http://www.google.com/finance/converter?a=$amount&from=$from_Currency&to=$to_Currency";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('bld>', $rawdata);
$data = explode($to_Currency, $data[1]);
return round($data[0], 2);
}
// Call the function to get the currency converted
echo get_currency('USD', 'INR', 1);
?>
Here are some exchange APIs with PHP example.
[ Open Exchange Rates API ]
Provides 1,000 requests per month free. You must register and grab the App ID. The base currency USD for free account. Check the supported currencies and documentation.
// open exchange URL // valid app_id * REQUIRED *
$exchange_url = 'https://openexchangerates.org/api/latest.json';
$params = array(
'app_id' => 'YOUR_APP_ID'
);
// make cURL request // parse JSON
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $exchange_url . '?' . http_build_query($params),
CURLOPT_RETURNTRANSFER => true
));
$response = json_decode(curl_exec($curl));
curl_close($curl);
if (!empty($response->rates)) {
// convert 150 USD to JPY ( Japanese Yen )
echo $response->rates->JPY * 150;
}
150 USD = 18039.09015 JPY
[ Currency Layer API ]
Provides 1,000 requests per month free. You must register and grab the Access KEY. Custom base currency is not supported in free account. Check the documentation.
$exchange_url = 'http://apilayer.net/api/live';
$params = array(
'access_key' => 'YOUR_ACCESS_KEY',
'source' => 'USD',
'currencies' => 'JPY',
'format' => 1 // 1 = JSON
);
// make cURL request // parse JSON
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $exchange_url . '?' . http_build_query($params),
CURLOPT_RETURNTRANSFER => true
));
$response = json_decode(curl_exec($curl));
curl_close($curl);
if (!empty($response->quotes)) {
// convert 150 USD to JPY ( Japanese Yen )
echo '150 USD = ' . $response->quotes->USDJPY * 150 . ' JPY';
}
150 USD = 18036.75045 JPY
You can try geoplugin
Beside the geolocation done by IP (but the IP is the provider IP, so not so accurate), they return currencies also and have a currency converter: see examples.
They have 111 currencies updated.
If you're looking for a ruby based solution for this problem, I recommend using the Google Calculator method a solution similar to the following: http://j.mp/QIC564
require 'faraday'
require 'faraday_middleware'
require 'json'
# Debug:
# require "pry"
country_code_src = "USD"
country_code_dst = "INR"
connection = Faraday.get("http://www.google.com/ig/calculator?hl=en&q=1#{country_code_src}=?#{country_code_dst}")
currency_comparison_hash = eval connection.body #Google's output is not JSON, it's a hash
dst_currency_value, *dst_currency_text = *currency_comparison_hash[:rhs].split(' ')
dst_currency_value = dst_currency_value.to_f
dst_currency_text = dst_currency_text.join(' ')
puts "#{country_code_dst} -> #{dst_currency_value} (#{dst_currency_text} to 1 #{country_code_src})"
Here is one simple PHP Script which gets exchange rate between GBP and USD
<?php
$amount = urlencode("1");
$from_GBP0 = urlencode("GBP");
$to_usd= urlencode("USD");
$Dallor = "hl=en&q=$amount$from_GBP0%3D%3F$to_usd";
$US_Rate = file_get_contents("http://google.com/ig/calculator?".$Dallor);
$US_data = explode('"', $US_Rate);
$US_data = explode(' ', $US_data['3']);
$var_USD = $US_data['0'];
echo $to_usd;
echo $var_USD;
echo '<br/>';
?>
Google currency rates are not accurate google itself says ==> Google cannot guarantee the accuracy of the exchange rates used by the calculator. You should confirm current rates before making any transactions that could be affected by changes in the exchange rates. Foreign currency rates provided by Citibank N.A. are displayed under licence. Rates are for information purposes only and are subject to change without notice. Rates for actual transactions may vary and Citibank is not offering to enter into any transaction at any rate displayed.
For all newbie guys searching for some hint about currency conversion, take a look at this link. Datavoila
C #의 내 프로젝트와 관련하여 많은 도움이되었습니다. 사이트가 사라질 경우를 대비하여 아래 코드를 추가하겠습니다. 아래 단계를 자신의 프로젝트에 추가하십시오. 형식에 대해 죄송합니다.
const string fromCurrency = "USD";
const string toCurrency = "EUR";
const double amount = 49.95;
// For other currency symbols see http://finance.yahoo.com/currency-converter/
// Clear the output editor //optional use, AFAIK
Output.Clear();
// Construct URL to query the Yahoo! Finance API
const string urlPattern = "http://finance.yahoo.com/d/quotes.csv?s={0}{1}=X&f=l1";
string url = String.Format(urlPattern, fromCurrency, toCurrency);
// Get response as string
string response = new WebClient().DownloadString(url);
// Convert string to number
double exchangeRate =
double.Parse(response, System.Globalization.CultureInfo.InvariantCulture);
// Output the result
Output.Text = String.Format("{0} {1} = {2} {3}",
amount, fromCurrency,
amount * exchangeRate, toCurrency);
'IT' 카테고리의 다른 글
| UILabel에 작은 아이콘을 포함시키는 방법 (0) | 2020.06.23 |
|---|---|
| UIViewContentModeScaleAspectFit와 UIViewContentModeScaleToFill의 차이점은 무엇입니까? (0) | 2020.06.23 |
| getter 전용 속성을 재정의하고 setter를 추가 할 수없는 이유는 무엇입니까? (0) | 2020.06.23 |
| MVVM 템플릿의 좋은 예 (0) | 2020.06.23 |
| MongoDB 그룹 수 선택 기준 (0) | 2020.06.22 |
