Now that we've downloaded the JSON and paused it, we need to extract the relevant buy and sell prices, such as here, here, here, here and so forth. This is where I'm going to split the workflow into to one part to identify the best immediate buy price, and the other two identify the best immediate sell price. Let's start with identifying the buy price. If we look at the JSON Name field, we want to extract the field names where it contains, ask or sell. In other words, buying it immediately without having to bid for it. And it looks like we'll have to account for one more condition where our Ask or sell doesn't contain the word quantity or Qt y as by Nance attribute names, both use asked in their price and quantity attributes.
Keeping those conditions in mind. We have to filter only buy, ask, sell and not quantity. Let's drag in a filter tool from the preparation tab. And we're going to write a custom filter. Using the contains function. We want to filter only by JSON name.
So we'll type in contains the conditions we want to set. If the JSON name contains ask or JSON name contains cell and JSON name does not contain Qt y. If you have other exchanges you want to add that are outside of this workshop. You may need to update these filter rules if they use different names. Let's run our work. float and check that we've filtered by ask and sell prices.
Without quantity. We'll add our browse tools here, run our workflow. Awesome, we now have the asking price for each coin on each exchange. The next step is to get the cheapest price of each coin and remove everything else, so we only end up with three records. To do this, we'll use a sword and unique tool. So let's start by dragging the sword tool in from the preparation tab.
And we'll sort by name so we get the coin names from A to Zed, and then we'll sort by JSON value string in ascending order, so we get the prices from lowest to highest. We'll add a browse tool to our sort. And if we run our workflow, we can see that we've sorted each coin by the cheapest Price and because the first record of each coin will be the cheapest. Since we've sorted it that way, we can now drag the unique tool and select the name column as the unique field we want to filter by. Let's add a browse tool to our unique and duplicates. And if we run our workflow we now have three Records, which each show the cheapest asking price for each coin.
Now that we've identified the cheapest asking price, let's copy these three tools to identify the most expensive bid price. I'll just quickly rearrange these hours And we'll drag from the output of our Select tool to the incoming of our filter tool. We'll update the filter to look for bid and buy. And we'll update our JSON value string here to be in descending order, which will give us the expensive process first. And then we'll leave the unique tool alone. And we'll add a browse tool to the end of it with Ctrl Shift B.
And we'll run our workflow with Ctrl R. And we now have three records with the most expensive bid price. We're almost there. In the next video, we're going to combine these prices back together to determine if there's any worthy arbitrage opportunities.