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.
![neverstew avatar](https://secure.gravatar.com/avatar/109fa713caf4e083c57622b7c6dad365.jpg?s=200&d=identicon)
neverstew
migrate
Script
Val Town Migrations By calling this val, you can easily handle migrations in your Val Town Turso Database. Getting started Make sure you have your Val Town API Token saved in your secrets. See more about authentication to understand how to generate a token. Make sure you've set up your turso database 👆Fork this val How it works Each time the val is run, a new migration will be created and tracked in your database in the migrations table. There will be one migration per val, per version. You can do anything you want in the function passed to migrate ; create or alter tables, populate data... whatever! Migrating backwards Vals don't have the concept of decreasing versions and neither does this migration tool. Made a mistake? Write a new version of your val to fix it!
0
nbbaier
sqliteDump
Script
SQLite Dump Util A utility function that generates SQL statements to dump the data and schema of tables in a SQLite database. Usage This example specifically dumps the users table and logs the output: import { sqliteDump } from "https://esm.town/v/nbbaier/sqliteDump";
const dump = await sqliteDump(["users"]);
console.log(dump) You can optionally specify a callback to handle the result. The example below dumps the users table and emails it using std/email . import { email } from "https://esm.town/v/std/email";
import { sqliteDump } from "https://esm.town/v/nbbaier/sqliteDump";
await sqliteDump(["users"], async (res) => {
await email({ text: res });
}); Function Signature function sqliteDump(tables?: string[], callback?: ((result: string) => string | void | Promise<void>) | undefined): Promise<string | void> Parameters tables : (Optional) Array of table names to include in the dump. If not provided, all tables will be included. callback : (Optional) An (potentially async) callback function to process the dump result. The callback receives the dump string as its argument.
2
![petermillspaugh avatar](https://images.clerk.dev/oauth_github/img_2TFg9SMWVOcMJQ588IzCEa1VVhI.jpeg)
petermillspaugh
sendNewsletterReminder
Cron
Val Town email subscriptions: newsletter reminder Cousin Val to @petermillspaugh/emailSubscription for emailing yourself a reminder to send your next newsletter. Since this Val is public, anyone can run it. I've commented out the function body that actually emails me to prevent anyone from spamming me, but you can fork this as a private Val to set a cron reminder.
0