Skip to content

How To Get Sugar Rates Using JSON API

Nowadays, not most people know how important API are for the investment business, especially in products like sugar. Here, we explain to you how to get this technology and how it can be useful to you.

But first, let’s talk about sugar and why is it a good decision to invest in it. This commodity is one of the most important ones in the world since it’s the main carbohydrate in the majority of sweet meals. Sugar is present in our everyday life and it comes in a variety of forms. During 2009 and 2018, its output rose by 14% because of the demand increase. Because of all this, we can clearly notice that sugar is a great investment, you only have to do it right. 

To get a good income, you’ll need to stay updated on different types of rates after having invested in sugar. The achieve that, you can use an API, which is an interface that allows you to get information after sending a request. The API gathers data from another website and delivers it to you immediately. Sounds great, right? 

How To Get Sugar Rates Using JSON API

Most of the time, API responses are done in JavaScript Object Notation (JSON) format. This is a text-based structured data format based on key-value pairs and ordered lists. Despite the fact that JSON is developed from JavaScript, it is supported natively or via libraries in the majority of major programming languages. JSON is frequently, but not always, used to communicate data between online clients and web servers.

How Can I Get This Information?

To get the API in JSON format, you need to find a good software that provides you with it. There are a few online, but for this example, we will use Commodities-API, one of the most complete ones.

So, to get the API you need to:

1. Enter www.commodities-API.com and sign in to get your own API key. 

2. Search for the symbols of sugar (SUGAR) and the currency you wish to obtain the price in.

3. Use these symbols to find the commodity and currency in the list. Once you choose them, make the API call.

4. The website will return you an API in various programming languages that you can adapt and use however you like.

And that’s it! It’s just as simple as that.

How To Get Sugar Rates Using JSON API

The answer in JSON will look something like this:

({
"success": true,
"timestamp": 1519296206,
"base": "SUGAR",
"date": "2018-09-10",
"rates": {
"AUD": 1.566015,
"CAD": 1.560132,
"CHF": 1.154727,
"CNY": 7.827874,
"GBP": 0.882047,
"JPY": 132.360679,
"USD": 1.23396,
[...]
}
})  

Where Does This Information Come From?

Commodities-API collects data from banks and stock exchanges and uses it to offer you with the most up-to-date and secure data. Furthermore, it uses bank-grade 256-bit SSL encryption to ensure the security of your connection at all times. The API only provides midpoint data for commodities and currency rates. The midpoint is determined by taking the average median rate of Bid and Ask for a certain time period.


Also published on Medium.

Published inAppsTechnology
%d bloggers like this: