As demonstrated in video 11.1, where we use the binance API to download price information in JSON format. We're going to do the same thing here. But for all exchanges, we'll take it one step further and parse that JSON into two columns, one column, where we have the attribute name and another column with the attribute value. This is otherwise known as a key pair. Let's start by going to the connectors tab and dragging in the download tool. Now configuration for this one is pretty straightforward.
We just need to tell it which field has the URL we want to download. And in this example, it's URL. If we run our workflow, after we add a browse tool now see two new columns have been added to our table. download data. which contains our price information in JSON. And the download headers, which tells us if we got a successful response 200 means we did.
Because we only want the buy and sell prices from download data, ie the bid and ask price. We need a way to extract those two pieces of data. And the easiest way to do that is to add a JSON path tool from the developer tab. What this will do is take each of the attribute names like symbol, bid price, bid quantity, etc. and put that into one column and then take their respective values and put that into another column, creating a key pair value. This might be hard to visualize, so let's just drag in the JSON pause tool.
And we'll specify which field has our JSON data in it which is download data at a browse tool And run our workflow. And as you can see, the JSON name and JSON value string have been created containing our attribute names and attribute values. Now that we've parsed our JSON into a table format, we can now extract the buy and sell prices with a filter tool, which we'll do in the next video. But before moving on to that, let's just quickly tidy up our data. Although I can't see any anomalies in here. Sometimes random white spaces can be added in JSON.
So let's just drag in a data cleansing tool from the preparation tab. And remove or replace nulls with blanks and zeros and tick leading and trailing white spaces. And lastly, we'll get rid of the URL and download headers columns since we don't need those anymore. So we'll go to the preparation tab and select a select tool, and untick the URL and download headers or add a browse tool again. And if we run our workflow, we should end up with a table like this which is going to help us find arbitrage opportunities.