// A portfolio import for a wealth app: each holding's identifier checked and recognized, ISINs
// made for holdings known only by CUSIP or SEDOL, and ISINs pulled out of a broker's statement.
//
//   quillo run securities_ids.qwe      then open http://localhost:8080/holdings and http://localhost:8080/id/US0378331005

use "securities_ids.qwer"

route GET /id/:id = security_id_check(id, "")

let HOLDINGS = ["US0378331005", "037833100", "0263494", "BBG000BLNNH6", "US0378331006", "DE0007164600"]

route GET /holdings = {
    checked: HOLDINGS | map((h) => { let r = security_id_check(h, ""); r.valid ? `${h}: ${r.type}` : `${h}: ${r.error}` }),
    apple_from_cusip: isin_from("037833100", "US")?,
    bae_from_sedol: isin_from("0263494", "GB")?,
    sap_from_wkn: isin_from("716460", "DE")?,
    statement: isin_find("Bought 10 Apple Inc (US0378331005) and 5 SAP SE, ISIN DE0007164600; sold IE00B4L5Y983 iShares Core MSCI World."),
}
