Jump to content

maxv

New Members
  • Posts

    2
  • Joined

  • Last visited

maxv's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My purpose is to get quote price of quote symbol 'crge' I try json_decode to data from yahoo finance api: I need the value of "regularMarketPrice" (in this case it should return "1.965") Actual result I get is empty... $url=' $https://query1.finance.yahoo.com/v11/finance/quoteSummary/crge?modules=Price'; $data=url_get_contents($url); $arr=json_decode($data,true); $price=$arr["regularMarketPrice"]; echo $price; url_get_contents return this json string: {"quoteSummary":{"result":[{"price":{"maxAge":1,"preMarketChangePercent":{"raw":0.0856624,"fmt":"8.57%"},"preMarketChange":{"raw":0.1649,"fmt":"0.16"},"preMarketTime":1663594102,"preMarketPrice":{"raw":2.0899,"fmt":"2.0899"},"preMarketSource":"FREE_REALTIME","postMarketChange":{},"postMarketPrice":{},"regularMarketChangePercent":{"raw":0.020779263,"fmt":"2.08%"},"regularMarketChange":{"raw":0.04000008,"fmt":"0.0400"},"regularMarketTime":1663600903,"priceHint":{"raw":4,"fmt":"4","longFmt":"4"},"regularMarketPrice":{"raw":1.965,"fmt":"1.9650"},"regularMarketDayHigh":{"raw":2.06,"fmt":"2.0600"},"regularMarketDayLow":{"raw":1.96,"fmt":"1.9600"},"regularMarketVolume":{"raw":234185,"fmt":"234.19k","longFmt":"234,185.00"},"averageDailyVolume10Day":{},"averageDailyVolume3Month":{},"regularMarketPreviousClose":{"raw":1.925,"fmt":"1.9250"},"regularMarketSource":"FREE_REALTIME","regularMarketOpen":{"raw":2.06,"fmt":"2.0600"},"strikePrice":{},"openInterest":{},"exchange":"NGM","exchangeName":"NasdaqGM","exchangeDataDelayedBy":0,"marketState":"REGULAR","quoteType":"EQUITY","symbol":"CRGE","underlyingSymbol":null,"shortName":"Charge Enterprises, Inc.","longName":"Charge Enterprises, Inc.","currency":"USD","quoteSourceName":"Nasdaq Real Time Price","currencySymbol":"$","fromCurrency":null,"toCurrency":null,"lastMarket":null,"volume24Hr":{},"volumeAllCurrencies":{},"circulatingSupply":{},"marketCap":{"raw":405100480,"fmt":"405.10M","longFmt":"405,100,480.00"}}}],"error":null}}
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.