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.
rlesser avatar
rlesser
getNextSSR
Script
getNextSSR - fetch data from Next.js SSR-based sites Many modern websites use Next.js and Server-side Rendering (SSR) to serve their website and the data to populate it. Instead of standard API calls, this manifests in the browser as calls routed through dynamic endpoints. This val handles the url construction and response parsing, giving you access to the endpoint and data. Input websiteUrl - The website's url, like google.com or val.town let getNextSSR: (websiteUrl: string) => Promise<(endpoint: string) => Promise<Record<string, any>>> Returns fetching function - A function that takes in an endpoint and returns the endpoint's response data: Input endpoint - The endpoint string, like results.json or trending.json?page=2 Returns data - The endpoint response data, without NextJS artifacts. Example const fetch = await @rlesser.getNextSSR("example.com"); const data = fetch("results.json"); return data;
0
vladimyr avatar
vladimyr
CFDate
Script
// SPDX-License-Identifier: 0BSD
0
stevekrouse avatar
stevekrouse
importKey
Script
An interactive, runnable TypeScript val by stevekrouse
0
yawnxyz avatar
yawnxyz
embeddingsSearchExample
Script
This is an example of in-memory search, using a combination of lunr, OpenAI embeddings, and cosine similarity
0
saolsen avatar
saolsen
sudoku_solver_human_search
Script
// This is another brute force with backtracking approach.
0
stevekrouse avatar
stevekrouse
upstash
Script
An interactive, runnable TypeScript val by stevekrouse
1
arfan avatar
arfan
geminichat
HTTP
@jsxImportSource https://esm.sh/react@18.2.0
0
vtdocs avatar
vtdocs
resyBot
Script
Resy bot This bot books restaurant reservations via Resy. Use it to snipe reservations at your favorite restaurant! How to use it Set up a scheduled val to call it like this: import { resyBot } from "https://esm.town/v/stevekrouse/resyBot?v=2"; import { email } from "https://esm.town/v/std/email?v=13"; export default async function (interval: Interval) { const bookingInfo = await resyBot( { slug: 'amaro-bar', city: 'ldn', day: '2023-07-05', start: '19:00', end: '21:00', partySize: 2, // Use https://www.val.town/settings/secrets for these! email: Deno.env.get("resyEmail"), password: Deno.env.get("resyPassword"), }) // If the val doesn't error, it successfully made a booking! // Send yourself an email like this: await email({ text: bookingInfo, subject: 'resy bot made a booking for you!' }) } How it works This val makes the same requests that your browser would make when you reserve a slot on Resy (that's why it needs your login info – to request an auth token). When there isn't a matching slot, this val errors and nothing else happens. When a booking is available, this val books it and returns a description of the booking so you can email it to yourself (Resy will also email you). This val will then stop attempting bookings for you until you change one of the arguments you're passing (it concats the non-sensitive arguments and uses this as a key). Credit to @rlesser and @alp for their existing Resy vals (search for resy on here).
7
gaimeri17 avatar
gaimeri17
labLoginUpdateStatus
HTTP
Forked from todepond/labLoginUpdateStatus
0
matt25 avatar
matt25
respectableAmaranthTyrannosaurus
Script
An interactive, runnable TypeScript val by matt25
0
mvaodhan avatar
mvaodhan
showbot
Email
Forked from stevekrouse/renderEmails
0
stevekrouse avatar
stevekrouse
htmlParseEx
Script
An interactive, runnable TypeScript val by stevekrouse
0
saolsen avatar
saolsen
prune_val
Script
Prune a val's versions. Useful if you want to delete a bunch of versions. All versions before keep_since that aren't in keep_versions will be deleted !!! You can run it without passing commit to see a preview of what will happen. Example await prune_val("abcdefg", [3,6,8], 12, true); Could output Val: untitled_peachTakin, Current Version: 15 Deleting Versions: [ 1, 2, 4, 5, 7, 8, 9, 10, 11 ] Deleting Version 1 Deleted Deleting Version 2 Deleted Deleting Version 4 Deleted Deleting Version 5 Deleted Deleting Version 6 Deleted Deleting Version 7 Version already deleted, skipping Deleting Version 8 Deleted Deleting Version 9 Deleted Deleting Version 10 Deleted Deleting Version 11 Deleted
2
roramigator avatar
roramigator
lootGenAPI
HTTP
Loot Generator API How It Works Components The Loot Generator API creates random loot items by combining: 30 adjectives 29 materials 15 item types resulting in 13,050 possible items. Legendary Items Occasionally, a rare legendary item is generated. An item becomes legendary if all three components are rare. Rarity is determined by a threshold: Threshold = max(1,⌊log(length)×0.6⌋) Probability of a legendary item with the default settings: P(Legendary) = 1/13,050 ≈ 0.00766% Only one legendary item is possible: ✨💎 Arcane Diamond Rock . Customization You can expand the lists or adjust the 0.6 multiplier to control rarity.
1
stevekrouse avatar
stevekrouse
jsJamHTML
Script
An interactive, runnable TypeScript val by stevekrouse
0
pranjaldotdev avatar
pranjaldotdev
pushover
Script
// Send a pushover message.
0