I’m attempting to create a macOS shortcut (with the Shortcuts app) that fetches some inventory quotes.
Based on this internet web page, right here is the right way to use the JSON construction:
- Open the Shortcuts app
- Click on on the
+
signal to create a brand new shortcut - Add motion
Get contents of URL
- Insert desired URL
- Add motion
Get dictionary from enter
(which mechanically will get the dictionary from the URL) - Add motion
Get dictionary worth
- In discipline
key
insertreality
- Add
Present end result
which is able to mechanically set the variable title toDictionary Worth
- Add motion
Present end result
- Then click on on the play button
- Authorise entry
- A pop-up message seems.
I appeared up how Yahoo! Finance the API seems to be like due to this different internet web page which reveals the next API construction:
{
"quoteSummary": {
"end result": [
{
"financialData": {
"maxAge": 86400,
"currentPrice": {
"raw": 144.49,
"fmt": "144.49"
},
"targetHighPrice": {
"raw": 214,
"fmt": "214.00"
},
"targetLowPrice": {
"raw": 122,
"fmt": "122.00"
},
"targetMeanPrice": {
"raw": 176.69,
"fmt": "176.69"
},
"targetMedianPrice": {
"raw": 176,
"fmt": "176.00"
},
"recommendationMean": {
"raw": 1.9,
"fmt": "1.90"
},
"recommendationKey": "buy",
"numberOfAnalystOpinions": {
"raw": 41,
"fmt": "41",
"longFmt": "41"
},
"totalCash": {
"raw": 48304001024,
"fmt": "48.3B",
"longFmt": "48,304,001,024"
},
"totalCashPerShare": {
"raw": 3.036,
"fmt": "3.04"
},
"ebitda": {
"raw": 130541002752,
"fmt": "130.54B",
"longFmt": "130,541,002,752"
},
"totalDebt": {
"raw": 132480000000,
"fmt": "132.48B",
"longFmt": "132,480,000,000"
},
"quickRatio": {
"raw": 0.709,
"fmt": "0.71"
},
"currentRatio": {
"raw": 0.879,
"fmt": "0.88"
},
"totalRevenue": {
"raw": 394328014848,
"fmt": "394.33B",
"longFmt": "394,328,014,848"
},
"debtToEquity": {
"raw": 261.446,
"fmt": "261.45"
},
"revenuePerShare": {
"raw": 24.317,
"fmt": "24.32"
},
"returnOnAssets": {
"raw": 0.21214001,
"fmt": "21.21%"
},
"returnOnEquity": {
"raw": 1.75459,
"fmt": "175.46%"
},
"grossProfits": {
"raw": 170782000000,
"fmt": "170.78B",
"longFmt": "170,782,000,000"
},
"freeCashflow": {
"raw": 90215251968,
"fmt": "90.22B",
"longFmt": "90,215,251,968"
},
"operatingCashflow": {
"raw": 122151002112,
"fmt": "122.15B",
"longFmt": "122,151,002,112"
},
"earningsGrowth": {
"raw": 0.048,
"fmt": "4.80%"
},
"revenueGrowth": {
"raw": 0.081,
"fmt": "8.10%"
},
"grossMargins": {
"raw": 0.43310001,
"fmt": "43.31%"
},
"ebitdaMargins": {
"raw": 0.33105,
"fmt": "33.11%"
},
"operatingMargins": {
"raw": 0.30289,
"fmt": "30.29%"
},
"profitMargins": {
"raw": 0.2531,
"fmt": "25.31%"
},
"financialCurrency": "USD"
}
}
],
"error": null
}
}
And listed below are the steps I made to get as we speak’s AAPL inventory valuation:
- Open the Shortcuts app
- Click on on the
+
signal to create a brand new shortcut - Add motion
Get contents of URL
- Insert URL
https://query1.finance.yahoo.com/v11/finance/quoteSummary/AAPL
- Add motion
Get dictionary from enter
(which mechanically will get the dictionary from the URL) - Add motion
Get dictionary worth
- In discipline
key
insertfinancialData
- Add motion
Set variable
- Set discipline
Variable Identify
tofinancialDataVar
- Add motion
Get dictionary worth
- In discipline
key
insertcurrentPrice
- Add motion
Set variable
- Set discipline
Variable Identify
tocurrentPriceVar
- Add motion
Get dictionary worth
- In discipline
key
insertuncooked
- Add motion
Set variable
- Set discipline
Variable Identify
torawVar
- Add motion
Textual content
- Within the textual content discipline, add on beneath the opposite:
financialDataVar
,currentPriceVar
, andrawVar
- Add motion
Present alert
- As a substitute of
Do you wish to proceed?
insertTextual content
Clicking on the play button exhibits a pop-up window, however, sadly, with none content material.
My questions:
- What steps do I’ve to do to be able to get AAPL present inventory value once I click on on the play button?
- Is there a option to ask the person to enter their very own ticker (say MSFT, or TSLA, and so on.)?