-
Notifications
You must be signed in to change notification settings - Fork 3
Improved sim with trader personalities #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
finnfujimura
wants to merge
24
commits into
main
Choose a base branch
from
improved-sim
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
35e4759
Bump bot deps: rand for maker, transaction-parser for taker
finnfujimura f5fe830
taker: add MarketSnapshot/ExecutionProfile and stateful
finnfujimura 45b1f19
taker: rewire archetype defaults to ExecutionProfile presets
finnfujimura 89cdd58
taker: plumb execution-profile knobs through agent config
finnfujimura 4af62ea
taker: cache snapshot per tick, log per-agent execution
finnfujimura 61b9573
maker: switch external price anchor to S5/12-candle window
finnfujimura c106d48
maker: add maker-style presets (tight/balanced/defensive) and
finnfujimura 0d0dabd
maker: add local-book signals, hit detection, dynamic spread,
finnfujimura 70e9ca2
maker: refresh resting liquidity on quote-TTL timeout
finnfujimura 8e822c2
taker: only advance parent orders after successful submit
finnfujimura e591b0f
taker: restore fetch_market_snapshot and Arc-based
finnfujimura 3636dfa
funding per agent takers during init
finnfujimura 495becd
frontend: label transaction log fills with trader personality
finnfujimura 985d435
new taker compose with mounted keypairs
finnfujimura be06414
gitignore: re-ignore keypairs/
finnfujimura 7a8f1e8
Update services/.gitignore
finnfujimura 7eab7f0
maker-bot: rename price_jitter_bps -> price_jitter_pct to match its s…
finnfujimura 2c75370
maker-bot: fix jitter unit naming and tighten validation bounds
finnfujimura 2468e5e
Update frontend/src/components/TransactionLog.tsx
finnfujimura c25d3e4
taker-bot: treat unknown spread as wide so the spread gate
finnfujimura 220247c
maker-bot: name the rolling-window length and
finnfujimura 60dff1e
initialization_helper: honor --force when (re)generating
finnfujimura 456269e
services/.gitignore: document keypairs/ and
finnfujimura 23f6212
docs: describe taker archetypes, maker styles, and the agent
finnfujimura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import fs from "node:fs/promises"; | ||
| import path from "node:path"; | ||
| import { NextResponse } from "next/server"; | ||
|
|
||
| export type AgentRegistryEntry = { | ||
| name: string; | ||
| kind: "maker" | "taker"; | ||
| pubkey: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Returns the trader registry written by `services/shared/examples/initialization_helper.rs`. | ||
| * | ||
| * The frontend uses this to label each fill in the transaction log with the | ||
| * personality (maker, retail-1, whale-1, etc.) that submitted the trade. | ||
| * | ||
| * Returns an empty array when the file is missing — e.g. when the frontend is | ||
| * run against devnet/testnet/mainnet rather than the local helper script. | ||
| */ | ||
| export async function GET() { | ||
| const filePath = path.join( | ||
| process.cwd(), | ||
| "..", | ||
| "services", | ||
| "taker-bot", | ||
| "agents.json", | ||
| ); | ||
| try { | ||
| const raw = await fs.readFile(filePath, "utf8"); | ||
| const parsed = JSON.parse(raw) as AgentRegistryEntry[]; | ||
| return NextResponse.json(parsed); | ||
| } catch { | ||
| return NextResponse.json([]); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| "use client"; | ||
|
|
||
| import type { Address } from "@solana/addresses"; | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { useMemo } from "react"; | ||
| import { | ||
| type AgentRegistryEntry, | ||
| fetchAgentRegistry, | ||
| } from "@/lib/queries/fetch-agent-registry"; | ||
|
|
||
| export function useAgentRegistry() { | ||
| const query = useQuery({ | ||
| queryKey: ["agent-registry"], | ||
| queryFn: fetchAgentRegistry, | ||
| // The registry is rewritten on every `run-services-on-localnet.sh --force`, | ||
| // so a long stale time is fine — refetch on remount is enough. | ||
| staleTime: Number.POSITIVE_INFINITY, | ||
| }); | ||
|
|
||
| const byPubkey = useMemo(() => { | ||
| const map = new Map<Address, AgentRegistryEntry>(); | ||
| for (const entry of query.data ?? []) { | ||
| map.set(entry.pubkey, entry); | ||
| } | ||
| return map; | ||
| }, [query.data]); | ||
|
|
||
| return { entries: query.data ?? [], byPubkey }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { Address } from "@solana/addresses"; | ||
|
|
||
| export type AgentRegistryEntry = { | ||
| name: string; | ||
| kind: "maker" | "taker"; | ||
| pubkey: Address; | ||
| }; | ||
|
|
||
| export async function fetchAgentRegistry(): Promise<AgentRegistryEntry[]> { | ||
| const res = await fetch("/api/agents"); | ||
| if (!res.ok) return []; | ||
| return (await res.json()) as AgentRegistryEntry[]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,9 @@ | ||
| config.toml | ||
| keypair.json | ||
| # Per-agent keypair directory written by `services/shared/examples/initialization_helper.rs` | ||
| # when bootstrapping localnet (one file per taker agent). Regenerate by re-running the | ||
| # helper; pass `--force` to overwrite existing files. | ||
| keypairs/ | ||
| # Generated agent registry (`{name, kind, pubkey}` array) consumed by the frontend | ||
| # for fill labeling. Written by the same initialization_helper run that funds the agents. | ||
| taker-bot/agents.json | ||
|
finnfujimura marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.