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.
stevekrouse avatar
purpleGrouse
@stevekrouse
HTTP (deprecated)
Forked from stevekrouse/robPikeIO
pomdtr avatar
reading_and_writing_blobs
@pomdtr
Script
#example
jdan avatar
latLngOfCity
@jdan
Script
An interactive, runnable TypeScript val by jdan
yawnxyz avatar
openAiHelloWorld
@yawnxyz
Script
// Create a secret named OPENAI_API_KEY at https://www.val.town/settings/environment-variables
stevekrouse avatar
dateMeNotify
@stevekrouse
Script
// Email alerts when new Docs posted to https://DateMe.Directory
nbbaier avatar
sqliteWriter
@nbbaier
Script
SQLite QueryWriter The QueryWriter class is a utility for generating and executing SQL queries using natural language and OpenAI. It provides a simplified interface for interacting with your Val Town SQLite database and generating SQL queries based on user inputs. This val is inspired by prisma-gpt . PRs welcome! See Todos below for some ideas I have. Usage Import the QueryWriter class into your script: import { QueryWriter } from "https://esm.town/v/nbbaier/sqliteWriter"; Create an instance of QueryWriter, providing the desired table and an optional model: const writer = new QueryWriter({ table: "my_table", model: "gpt-4-1106-preview" }); Call the writeQuery() method to generate an SQL query based on a user input string: const userInput = "Show me all the customers with more than $1000 in purchases."; const query = await writer.writeQuery(userInput); Alternatively, use the gptQuery() method to both generate and execute the SQL query: const userInput = "Show me all the customers with more than $1000 in purchases."; const result = await writer.gptQuery(userInput); Handle the generated query or query result according to your application's needs. API new QueryWriter(args: { table: string; model?: string }): QueryWriter Creates a new instance of the QueryWriter class. table : The name of the database table to operate on. model (optional): The model to use for generating SQL queries. Defaults to "gpt-3.5-turbo". apiKey (optional): An OpenAI API key. Defaults to Deno.env.get("OPENAI_API_KEY") . writeQuery(str: string): Promise<string> Generates an SQL query based on the provided user input string. str : The user input string describing the desired query. Returns a Promise that resolves to the generated SQL query. gptQuery(str: string): Promise<any> Generates and executes an SQL query based on the provided user input string. str : The user input string describing the desired query. Returns a Promise that resolves to the result of executing the generated SQL query. Todos [ ] Handle multiple tables for more complex use cases [ ] Edit prompt to allow for more than just SELECT queries [ ] Allow a user to add to the system prompt maybe? [ ] Expand usage beyond just Turso SQLite to integrate with other databases
tmcw avatar
jsonBodyParsing
@tmcw
HTTP (deprecated)
An interactive, runnable TypeScript val by tmcw
tmcw avatar
lodashExample
@tmcw
Script
lodash Lodash is the most popular npm module. It provides helpers for functional programming, common algorithms, and a lot more. Before JavaScript had built-in methods for Array.map , lodash (and underscore before it) provided those methods.
ckersey2 avatar
zodStringToJSON
@ckersey2
Script
Forked from freecrayon/zodStringToJSON
pomdtr avatar
ssr
@pomdtr
Script
Todo [x] extract params from request paths using urlpatterns [ ] add a Form component [ ] add support for Layouts [ ] support other types url in router ("https://val.town/v/user/val" or "owner/val")
willthereader avatar
chat
@willthereader
Script
Forked from stevekrouse/openai
calvinfo avatar
stableDiffusionGet
@calvinfo
Script
An interactive, runnable TypeScript val by calvinfo
stevekrouse avatar
emailGPT3
@stevekrouse
Script
Email with GPT-3 Send an email to stevekrouse.emailGPT3@valtown.email, it will forward it to gpt3, and email you back the response.
vawogbemi avatar
dateme_sqlite
@vawogbemi
Script
Forked from stevekrouse/dateme_sqlite
stevekrouse avatar
exampleTldJSInvalid
@stevekrouse
Script
Forked from stevekrouse/exampleTldJS
tmcw avatar
nanoidExample
@tmcw
Script
nanoid nanoid is like a shorter, more fashionable alternative to UUIDs. Versus UUIDs: They're shorter, with a more customizable alphabet. They use more different characters by default. Unlike UUIDs, there aren't custom types for nanoids in databases Nanoids never contain information. UUIDs sometimes do: some UUIDs contain timestamps and MAC addresses.