US Congress Stock Trading API examples & templates
Use these vals as a playground to view and fork US Congress Stock Trading API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
stevekrouse
wikidata
Script
Query Wikidata via SPARQL Usage // get the death date for a person
@stevekrouse.wikidata(`SELECT ?person ?personLabel ?death_date WHERE {
?person rdfs:label "Henry Kissinger"@en;
wdt:P31 wd:Q5 . # Ensure the entity is a human
OPTIONAL {
?person wdt:P570 ?death_date . # Try to find a date of death
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}`) Learn more https://agg-shashank.medium.com/an-introduction-to-using-wikidata-apis-a678ee6d2968
0
![wilt avatar](https://secure.gravatar.com/avatar/95316a1d4fbd8be9c802a4e1e92fb9e9.jpg?s=200&d=identicon)
wilt
pug
Script
Pug HTML Template Renderer This function is equivalent to pug.render - it takes a Pug template string and renders it to an HTML string. import(npm:pug) doesn't work in Val.Town due to Pug's usage of new Function , which is forbidden for security reasons, so this function uses Val.Town's eval API instead. Example const myEndpoint = async (req: express.Request, res: express.Response) => {
const html = await @wilt.pug("p Hello #{name}!", {name: "Pug"});
res.status(200);
res.send(html);
}
0