Instead of:
...& Symbol**()** &...
You should be doing:
...& Symbol &...
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to fetch data from Yahoo finance, the code is below
(Symbol as text) as table =>
let
Source = Json.Document(Web.Contents("https://query1.finance.yahoo.com/v8/finance/chart/"&Symbol()&"?region=US&lang=en-US&includePrePost=false&interval=1d&useYfid=true&range=1d&corsDomain=finance.yahoo.com&.tsrc=finance")),
chart = Source[chart],
result = chart[result],
result1 = result{0},
indicators = result1[indicators],
quote = indicators[quote],
quote1 = quote{0},
#"Converted to Table" = Record.ToTable(quote1),
#"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
#"Transposed Table" = Table.Transpose(#"Expanded Value"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{<!-- -->{"high", type number}, {"open", type number}, {"low", type number}, {"close", type number}, {"volume", Int64.Type}}),
#"Reordered Columns" = Table.ReorderColumns(#"Changed Type",{"open", "high", "low", "close", "volume"})
in
#"Reordered Columns"
I have converted it into a function, when I enter a value for a function, it throws the following error.
An error occurred in the ‘’ query. Expression.Error: We cannot convert the value "SBIN.NS" to type Function.
Details:
Value=SBIN.NS
Type=[Type]
Instead of:
...& Symbol**()** &...
You should be doing:
...& Symbol &...