Back to APIs list
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.
savedNamedPlaygrounds
@kaleidawave
HTTP (deprecated)
For the future playground for the Ezno type checker: https://github.com/kaleidawave/ezno/pull/115 Can save an id for a content and recall content from an id (thus acting as a sort of compressor) Inspired by how the https://play.rust-lang.org/ shares playgrounds. (However uses a SQL-lite db hosted by Valtown rather than GitHub gists)
dm
@stevekrouse
Script
DM Me! Ever wanted to message someone about their val but you couldn't find their contact info? Want to allow folks on Val Town to contact you without exposing your email address? Boy do I have the over-engineered solution for you! This is a userspace, authenticated protocol for Val Town direct messages. Protocol Expose a dm function on your namespace that that accepts messages and some authentication data (described below). The easiest way to accomplish this is to fork this val. What you choose to do with direct messages is totally up to you. At the moment, I email myself your message and save it to a private array val. You could forward it along to yourself some other way, batch up messages to get a daily summary email if you're Mr. Popular, or send them to /dev/null if you're Mr. Antisocial. Authentication This protocol uses my Val Town public key auth scheme , so you'll need to follow the first two steps of that blog post – (1) generate a keypair and (2) publish your public key – to authenticate to this function. Usage You can call this function via the @stevekrouse.runValAPIAuth helper: @stevekrouse.runValAPIAuth({
val: "@stevekrouse.dm",
args: ["hi steve!"],
keys: @me.exportedKeys,
}); Example: https://www.val.town/v/stevekrouseTest.untitled_tealMinnow
parse_email
@std
Script
Parse email A small wrapper around email-addresses , an RFC 5322 email address parser. Usage import { parseAddressList } from "https://esm.town/v/std/parse_email";
console.log(parseAddressList('Steve <steve@val.town>, tom@val.town')); Should output: [
{
parts: {
name: {
name: "display-name",
tokens: "'Steve ",
semantic: "'Steve",
children: [ [Object] ]
},
address: {
name: "addr-spec",
tokens: "steve@val.town",
semantic: "steve@val.town",
children: [ [Object] ]
},
local: {
name: "local-part",
tokens: "steve",
semantic: "steve",
children: [ [Object] ]
},
domain: {
name: "domain",
tokens: "val.town",
semantic: "val.town",
children: [ [Object] ]
},
comments: [
{ name: "cfws", tokens: " ", semantic: " ", children: [Array] }
]
},
type: "mailbox",
name: "'Steve",
address: "steve@val.town",
local: "steve",
domain: "val.town",
comments: "",
groupName: null
},
{
parts: {
name: null,
address: {
name: "addr-spec",
tokens: " tom@val.town'",
semantic: "tom@val.town'",
children: [ [Object] ]
},
local: {
name: "local-part",
tokens: " tom",
semantic: "tom",
children: [ [Object] ]
},
domain: {
name: "domain",
tokens: "val.town'",
semantic: "val.town'",
children: [ [Object] ]
},
comments: [
{ name: "cfws", tokens: " ", semantic: "", children: [Array] }
]
},
type: "mailbox",
name: null,
address: "tom@val.town'",
local: "tom",
domain: "val.town'",
comments: "",
groupName: null
}
]