{"info":{"_postman_id":"9d684116-f702-49ec-9666-7dbd644ed6bb","name":"Visualizer Line Graph - Financial","description":"<html><head></head><body><p>This is a ready made Line Graph using ChartJS to help you get started quickly with <a href=\"https://learning.getpostman.com/docs/postman/sending_api_requests/visualizer/\">data visualization in Postman</a>. </p>\n<p>The data here is from <a href=\"https://worldtradingdata.com\">https://worldtradingdata.com</a>. Sign up for a free 250 daily requests to get access to a plethora of stock data, current and historical! </p>\n<p>You will see an object called <code>vizData</code> in the \"Tests tab\". You will have edit bind the data from the response you get to the <code>vizData</code> variable. It has four properties:</p>\n<ul>\n<li><code>symbol</code>: This takes a stock symbol string</li>\n<li><code>stockX</code>: This take an string stock exchange</li>\n<li><code>labels</code>: This takes an array of \"date\" strings that will serve as labels on the data items</li>\n<li><code>data</code>: This takes an array of numbers that form the first dataseries of the chart</li>\n</ul>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"7889102","collectionId":"9d684116-f702-49ec-9666-7dbd644ed6bb","publishedId":"SW7T7Wqp","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2019-11-11T20:27:40.000Z"},"item":[{"name":"Intraday Stock Shares","event":[{"listen":"prerequest","script":{"id":"83f7416b-0997-49d9-bb7a-d55afa380049","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"9cdce10e-aea8-40ea-8384-692ab166defb","exec":["const res = pm.response.json();","","// -----------------------------","// - Structure data for charts -","// -----------------------------","","// EDIT THIS OBJECT TO BIND YOUR DATA","const vizData = {","    ","    symbol: res.symbol,","    stockX: res.stock_exchange_short,","    ","    // Labels take an array of strings","    labels: Object.keys(res.intraday),","    ","    // Data takes an array of numbers","    data: _.map(Object.values(res.intraday), 'volume')","};","","var template = `","<canvas id=\"myChart\" height=\"150\"></canvas>","","<script src=\"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js\"></script>","<script src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js\"></script> ","","<script>","    // Get DOM element to render the chart in","    var ctx = document.getElementById(\"myChart\");","","    var timeFormat = 'YYYY-MM-DD HH:mm:ss';","","\t\tfunction newDate(days) {","\t\t\treturn moment().add(days, 'd').toDate();","\t\t}","","\t\tfunction newDateString(days) {","\t\t\treturn moment().add(days, 'd').format(timeFormat);","\t\t}","","    // Configure Chart JS here.","    // You can customize the options passed to this constructor to","    // make the chart look and behave the way you want","    var myChart = new Chart(ctx, {","        type: \"line\",","        data: {","            labels: [], // We will update this later in pm.getData()","            datasets: [{","                label: '',","                data: [], // We will update this later in pm.getData()","                ","                // Change these colours to customize the chart","                backgroundColor: \"#3e95cd\",","\t\t\t\t\tborderColor: \"#8e5ea2\",","\t\t\t\t\tfill: false,         ","                }]","        },","        options: {","            legend: { display: false },","            title: {","                display: true,","                text: ''","            },","            scales: {","                xAxes: [{","                    type: 'time',","\t\t\t\t\t\ttime: {","\t\t\t\t\t\t\tparser: timeFormat,","\t\t\t\t\t\t\t// round: 'day'","\t\t\t\t\t\t\ttooltipFormat: 'll HH:mm'","\t\t\t\t\t\t},","\t\t\t\t\t\tscaleLabel: {","\t\t\t\t\t\t\tdisplay: true,","\t\t\t\t\t\t\tlabelString: 'Time'","\t\t\t\t\t\t}","                }],","                yAxes: [{","                    display: true,","                    scaleLabel: {","                        display: true,","                        labelString: 'Shares'","                    }","                }]","            }","        }","","    });","","    // Access the data passed to pm.visualizer.set() from the JavaScript","    // code of the Visualizer template","    pm.getData(function (err, value) {","        myChart.options.title.text = value.symbol + \" on \" + value.stockX","        myChart.data.datasets[0].label = value.symbol + \" Share Count\"","        myChart.data.datasets[0].data = value.data;","        myChart.data.labels = value.labels;","        myChart.update();","    });","</script>`;","","pm.visualizer.set(template, vizData);"],"type":"text/javascript"}}],"id":"6586d3e3-bf26-4d6b-b5d1-1b3cb9b3b0d6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://intraday.worldtradingdata.com/api/v1/intraday?symbol=AAPL&range=1&interval=1&api_token=demo","urlObject":{"protocol":"https","path":["api","v1","intraday"],"host":["intraday","worldtradingdata","com"],"query":[{"key":"symbol","value":"AAPL"},{"key":"range","value":"1"},{"key":"interval","value":"1"},{"key":"api_token","value":"demo"}],"variable":[]}},"response":[],"_postman_id":"6586d3e3-bf26-4d6b-b5d1-1b3cb9b3b0d6"}],"event":[{"listen":"prerequest","script":{"id":"09f99762-0ee3-4bc6-bac5-4c3c3396bc04","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"73b1cbea-82b8-4d6e-b687-774d53728f74","type":"text/javascript","exec":[""]}}],"variable":[{"key":"symbol","value":"SNAP"},{"key":"token","value":"demo"}]}