Messtone LLC Manages(Commodities):Endpoint Rates

Messtone Devices Enables Open/High/Low/Close(OHLC) Price Endpoint API request: https://www.commodities-api.com/open-high-low-close/YYYY-MM-DD?access_key=API_KEY & base=USD & symbols=XAU API Response:{“success”:true,”timestamp”:1653931700,”date”:”2022-05-20″,”base”:”XAU”,”symbol”:”USD”,”rates”:{“open”:0.00054346155,”high”:0.00054646956,”low”:0.000540054,”close”:0.00054174699447635},”unit”:”per ounce”} via the Commodities-APIs latest endpoint: //set API Endpoint and API key $endpount=’latest’;$access_key=”API_KEY”;//Initialize CURL:$ch=curl_init(‘https://www.commodities-api.com/api/’.$endpoint.’?access_key=’.$access_key.’ ‘);curl_setopt($ch, CURL_OPT_RETURNTRANSFER,true);//Store the data:$json=curl_exec($ch);curl_close($ch);//Decode JSON response:$exchangeRates=json_decode($json,true);//Access the exchange rate values, e.g.GBP;echo $exchangeRates[‘rates’][‘GBP’];Convert currencies:Here is how to convert currencues using PHP cURL //set API Endpoint, access key,required parameters $endpoint=’convert’;$access_key=’API_KEY’;$from=’USD’;$to=’EUR’;$amoumt=10;//initialize CURL:$ch=curl_init(‘https://www.commodities-api.com/api/’.$endpoint.’?access_key=’$access_key.’&from=’.$from.’&to=’.$to.’&amount=’.$amount.’ ‘);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);//get the JSON data:$json=curl_exec($ch);curl_close($ch);//Decode JSON response:$conversionResult=json_decode(json,true);// access the conversion result echo $conversionResult[‘result’];

https://i.capitalone.com/Jz65ggGYU

Leave a comment