Create a dashboard using Postman Flows

Many people find dashboards useful for visualizing and simplifying large amounts of data. For example, you might create an internet of things dashboard that displays information about your home's thermostat, door locks, security cameras, and environmental sensors. Or you might want a dashboard that compares a stock's price to a market index to evaluate the stock's performance. The dashboard could visualize data with a true/false display and a line chart.

This tutorial shows you how to create this stock performance dashboard using test data from a Postman mock server.

You can see the completed Flow here.

Goal

Create a Flow that quantifies a stock's performance by comparing it to a market index.

Prerequisites

Creating the Flow

  1. Begin by forking (copying) the stocks collection and the stocks-tutorial environment from the Utility Flows workspace to your workspace. In your fork of the stocks-tutorial environment, replace <your-api-key> with your Polygon.io API key and select Save.

    • Create a new Flow and connect three Send Request blocks to the Start block.
    Add three Send blocks
    • In the first two Send Request blocks, select the get the close price request. In the third Send Request block, select the get stock SMA request.

    • In the first Send Request block, select the stocks-tutorial environment. Flows prompts you to select the same environment for the other two Send Request blocks. Select Update All.

    Select the environment
    • Add a String block to assign the VOO market index to the ticker variable in the first request. The Flow will compare your stock's performance to this index to check if your stock is outperforming the market.

    • Add another String block to assign AAPL to the ticker variables in the second and third Send Request blocks.

    Dashboard Flow - step 1
  2. Connect an Evaluate block to the first Send Request block. Change value to benchmark and select body.

    • In the FQL window, enter ((benchmark.close - benchmark.open) / benchmark.open) * 100. This will get a percentage of the difference between the VOO index's open and close price.

    • Connect another Evaluate block to the Evaluate block you created. In the FQL window, enter value2 > value1. You'll add value2 in a later step.

    • Connect an Output block to the value2 > value1 Evaluate block and select Boolean from the dropdown list.

    Dashboard Flow - step 2
  3. Go back to the second Send Request block and connect an Evaluate block to it. In this new Evaluate block, change value1 to yours and select body. In the FQL window, enter ((yours.close - yours.open) / yours.open) * 100 to get a percentage of the difference between this stock's open and close price.

    • Connect this block's Result output to the key input on the value2 > value1 block. Flows automatically renames the variable value2.
    Dashboard Flow - step 3
  4. Connect the yours Evaluate block to a new Output block and select Gauge from the dropdown list. Set the Gauge output block's minimum value to -5 and its maximum value to 5.

    Configure the gauge
    • Connect the AAPL String block with to an Output block and rename the Output block Your ticker.
    Dashboard Flow - step 4
  5. Go back the third Send Request block and connect a Select block to it. In the Select block, select body.results.values. Connect an Evaluate block to the Select block and rename value1 to list. In the FQL window, enter $reverse(list). This arranges the dates in the results in chronological order.

    • Connect a For block to the $reverse(list) Evaluate block, then connect an Evaluate block to the For block. In the Evaluate block, change value1 to item. In the FQL window, enter $month(item.timestamp) & '-' & $day(item.timestamp). This converts timestamps in the results to a readable date format. Connect a Collect block to the Evaluate block's Result output.

    • Connect another Evaluate block to the $reverse(list) Evaluate block and rename value1 to list. In the FQL window, enter list.value.

    Dashboard Flow - step 5
  6. Create a List block and add two Select blocks to it. Connect the list.value Evaluate block to the List block's 0 input. Connect the Collect block's List output to the List block's 1 input.

    Add a List block
    • Connect the List block's output to an Output block. select Line Chart from the dropdown list and rename the block Simple moving average.
    Dashboard Flow - step 6
  7. Run the Flow and check your dashboard of Output blocks to see your stock ticker, if your stock is outperforming or underperforming the market, how much it's outperforming or underperforming, and a chart showing the stock's simple moving average.

    Run the Flow

Last modified: 2023/08/07