Difference between revisions of "Module:Stock tickers/LSE"
Jump to navigation
Jump to search
blackwiki>Svgalbertian |
m (8 revisions imported) |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 14: | Line 14: | ||
if not ticker then | if not ticker then | ||
| − | url = " | + | url = "https://www.londonstockexchange.com/home/homepage.htm" |
return url | return url | ||
end | end | ||
| Line 21: | Line 21: | ||
if otherinput then | if otherinput then | ||
-- If the isin wasn't explicitly passed check if it was the second variable | -- If the isin wasn't explicitly passed check if it was the second variable | ||
| − | if not isin and | + | if not isin and string.len(otherinput) == 12 then |
isin = otherinput | isin = otherinput | ||
-- If the four way key wasn't explicitly passed check if it was the second variable | -- If the four way key wasn't explicitly passed check if it was the second variable | ||
| − | elseif not fourway and | + | elseif not fourway and string.len(otherinput) > 12 then |
fourway = otherinput | fourway = otherinput | ||
end | end | ||
| Line 31: | Line 31: | ||
-- If you have the four way key then you know the isin | -- If you have the four way key then you know the isin | ||
if fourway and not isin then | if fourway and not isin then | ||
| − | isin = | + | isin = string.sub(fourway, 0, 12) |
end | end | ||
-- If you have the four way key you can link direclty to the security | -- If you have the four way key you can link direclty to the security | ||
if fourway then | if fourway then | ||
| − | url = ' | + | url = 'https://www.londonstockexchange.com/exchange/prices-and-markets/stocks/summary/company-summary/' .. fourway .. ".html?lang=en" |
-- If you have the isin you can improve the search results | -- If you have the isin you can improve the search results | ||
elseif isin then | elseif isin then | ||
| − | url = ' | + | url = 'https://www.londonstockexchange.com/exchange/searchengine/search.html?lang=en&x=0&y=0&q=' .. isin |
-- Fallback to a simple ticker search | -- Fallback to a simple ticker search | ||
else | else | ||
| − | url = ' | + | url = 'https://www.londonstockexchange.com/exchange/searchengine/search.html?lang=en&x=0&y=0&q=' .. ticker |
end | end | ||
Latest revision as of 11:08, 29 September 2020
Implements {{London Stock Exchange}}
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.GetURL(frame)
local args = getArgs(frame)
return p._GetURL(args)
end
function p._GetURL(args)
local ticker = args[1]
local isin = args.isin
local fourway = args.fourway
local otherinput = args[2]
if not ticker then
url = "https://www.londonstockexchange.com/home/homepage.htm"
return url
end
-- Handle cases where people don't use the proper paraamter names
if otherinput then
-- If the isin wasn't explicitly passed check if it was the second variable
if not isin and string.len(otherinput) == 12 then
isin = otherinput
-- If the four way key wasn't explicitly passed check if it was the second variable
elseif not fourway and string.len(otherinput) > 12 then
fourway = otherinput
end
end
-- If you have the four way key then you know the isin
if fourway and not isin then
isin = string.sub(fourway, 0, 12)
end
-- If you have the four way key you can link direclty to the security
if fourway then
url = 'https://www.londonstockexchange.com/exchange/prices-and-markets/stocks/summary/company-summary/' .. fourway .. ".html?lang=en"
-- If you have the isin you can improve the search results
elseif isin then
url = 'https://www.londonstockexchange.com/exchange/searchengine/search.html?lang=en&x=0&y=0&q=' .. isin
-- Fallback to a simple ticker search
else
url = 'https://www.londonstockexchange.com/exchange/searchengine/search.html?lang=en&x=0&y=0&q=' .. ticker
end
return url
end
return p