diff --git a/README.md b/README.md index d98f9dc..ea8417a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Quant Companion -The unified **Quant Alchemy** workbench — strategy performance analytics, a +The unified **Quant Alchemy** workbench: strategy performance analytics, a trading journal, and position sizing with liquidation analysis, in one app. This app merges three previously separate projects: -| Tool | Route | Formerly | -| --- | --- | --- | -| Performance Analytics | `/analytics` | quant-companion (SolidJS) | -| Trading Journal | `/journal` | trading-journal (React + Convex) | +| Tool | Route | Formerly | +| ------------------------ | ------------- | -------------------------------------- | +| Performance Analytics | `/analytics` | quant-companion (SolidJS) | +| Trading Journal | `/journal` | trading-journal (React + Convex) | | Position Size Calculator | `/calculator` | position-size-calculator (static HTML) | Plus a gamification layer (`/achievements`): XP, alchemy-themed ranks @@ -23,14 +23,19 @@ disciplined trading habits. - Tailwind CSS v4 + shadcn/ui components - Plotly for charts, Papa Parse + SheetJS for CSV/XLSX import +SheetJS CE is pinned to the vendor's official 0.20.3 tarball because the npm +registry package stops at the vulnerable 0.18.5 release. See the +[SheetJS installation guide](https://docs.sheetjs.com/docs/getting-started/installation/frameworks/). + ## Development ```bash pnpm install -pnpm dev # frontend — http://localhost:3000 +pnpm dev # frontend at http://localhost:3000 pnpm dev:convex # Convex backend (first run configures the deployment) -pnpm build # deploys Convex, then the production build (what Vercel runs) +pnpm build # deploys Convex only in Vercel production; UI-only elsewhere pnpm build:ui # production build only, no Convex deploy +pnpm brand:assets # regenerate favicons, app icons, and the social card pnpm lint # eslint pnpm test # vitest pnpm generate-routes # regenerate the route tree after adding routes @@ -39,7 +44,7 @@ pnpm generate-routes # regenerate the route tree after adding routes ## Environment Committed templates `.env.local.tpl` / `.env.production.tpl` follow the -1Password `op://` convention — generate a real env file with: +1Password `op://` convention. Generate a real env file with: ```bash pnpm run env:generate:local # op inject -i .env.local.tpl -o .env.local @@ -57,40 +62,40 @@ environments (`vercel env add …`). ## Convex backend -`convex/` holds the trades schema and functions (Clerk-authenticated via -`identity.subject`). To bring it up: +`convex/` holds the trades schema and functions. Every journal operation is +scoped by Clerk's stable `identity.tokenIdentifier`. To bring it up: -1. `pnpm dev:convex` — first run creates/links the Convex deployment and +1. `pnpm dev:convex`: first run creates or links the Convex deployment and generates `convex/_generated`. 2. In the Clerk dashboard, create a JWT template named `convex`, then set `CLERK_JWT_ISSUER_DOMAIN` on the Convex deployment (see https://docs.convex.dev/auth/clerk). -The journal UI currently persists to localStorage; switching its data plane to -these Convex functions is the intended next step (see `src/lib/journal.ts`). +The journal UI reads and writes these Convex functions through +`ConvexProviderWithClerk`. Imports use stable source keys, so the same file can +be imported again without duplicating a trade. ## Data & privacy -Local-first: analytics uploads are processed entirely in the browser, and the -journal + gamification progress persist in `localStorage`, namespaced per -Clerk user id (`qc::journal`, `qc::progress`). The journal -supports lossless JSON export/import for backup and migration. The only -server-side calls are Clerk auth and the price-lookup server function -(`src/lib/prices.ts`), which keeps API keys off the client. +Analytics uploads are processed entirely in the browser. Journal entries sync +to an account-scoped Convex database. Gamification progress and analytics +header mappings remain in browser storage. The journal supports lossless JSON +export/import for backup and migration. -To move the journal to a hosted database later, replace the `load`/`persist` -pair in `src/lib/journal.ts` and make the operations async — the operation -semantics intentionally mirror the original Convex backend. +Live prices and benchmark bars use authenticated server functions in +`src/lib/prices.ts`, so provider keys never reach the client. New account access +goes through Clerk's waitlist at `/waitlist`. ## Architecture notes -- `src/lib/stats.ts`, `monteCarlo.ts`, `invalidation.ts`, `headerMappings.ts` — +- `src/lib/stats.ts`, `monteCarlo.ts`, `invalidation.ts`, `headerMappings.ts`: analytics math ported from the original app (Solid signals → TanStack Store) -- `src/lib/journal.ts` — journal store with close/split P&L math -- `src/lib/gamification.ts` — XP, ranks, streaks, achievements -- `src/lib/positionSize.ts` — position sizing + liquidation math -- `src/components/Plot.tsx` — client-only, code-split Plotly wrapper -- `src/routes/journal.tsx` — Clerk-protected via `beforeLoad` server function +- `src/lib/journal.ts`: validated JSON/JSONL import, portable export, and stable + import keys +- `src/lib/gamification.ts`: XP, ranks, streaks, achievements +- `src/lib/positionSize.ts`: position sizing and liquidation math +- `src/components/Plot.tsx`: client-only, code-split Plotly wrapper +- `src/routes/journal.tsx`: Clerk-protected Convex journal UI The legacy Chrome-extension build (TradingView page scraping) was retired with the SolidJS app; the git history (`main` prior to this replacement) retains it. diff --git a/brand/brand.json b/brand/brand.json new file mode 100644 index 0000000..f7bf3cc --- /dev/null +++ b/brand/brand.json @@ -0,0 +1,16 @@ +{ + "name": "Quant Companion", + "tagline": "Turn market lead into gold, one disciplined trade at a time.", + "description": "Strategy analytics, a private trading journal, and position sizing in the Quant Alchemy trading workbench.", + "ogSubtitle": "Strategy analytics · Trading journal · Risk sizing", + "url": "www.quant-companion.quantalchemy.io", + "themeColor": "#0A0D16", + "background": "#0A0D16", + "ink": "#E9ECF8", + "ink2": "#A7AECB", + "ink3": "#707897", + "fonts": { + "display": "brand/fonts/Fraunces-Italic.ttf", + "body": "brand/fonts/InstrumentSans.ttf" + } +} diff --git a/brand/fonts/Fraunces-Italic.ttf b/brand/fonts/Fraunces-Italic.ttf new file mode 100644 index 0000000..2ddf59a Binary files /dev/null and b/brand/fonts/Fraunces-Italic.ttf differ diff --git a/brand/fonts/InstrumentSans.ttf b/brand/fonts/InstrumentSans.ttf new file mode 100644 index 0000000..3589b81 Binary files /dev/null and b/brand/fonts/InstrumentSans.ttf differ diff --git a/brand/fonts/LICENSE-Fraunces.txt b/brand/fonts/LICENSE-Fraunces.txt new file mode 100644 index 0000000..e0a3ac7 --- /dev/null +++ b/brand/fonts/LICENSE-Fraunces.txt @@ -0,0 +1,93 @@ +Copyright 2018 The Fraunces Project Authors (https://github.com/undercasetype/Fraunces) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/brand/fonts/LICENSE-Instrument-Sans.txt b/brand/fonts/LICENSE-Instrument-Sans.txt new file mode 100644 index 0000000..d41633c --- /dev/null +++ b/brand/fonts/LICENSE-Instrument-Sans.txt @@ -0,0 +1,93 @@ +Copyright 2022 The Instrument Sans Project Authors (https://github.com/Instrument/instrument-sans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/brand/mark.svg b/brand/mark.svg new file mode 100644 index 0000000..cf773ea --- /dev/null +++ b/brand/mark.svg @@ -0,0 +1,18 @@ + + Quant Companion + + + + + + + + + + + + + + + + diff --git a/convex/schema.ts b/convex/schema.ts index 1d621c9..b00fcc3 100644 --- a/convex/schema.ts +++ b/convex/schema.ts @@ -1,11 +1,16 @@ +import { authTables } from '@convex-dev/auth/server' import { defineSchema, defineTable } from 'convex/server' import { v } from 'convex/values' -// Mirrors src/lib/journal.ts JournalTrade. userId is the Clerk user id -// (identity.subject) — Clerk owns user records, so there is no users table. +// Mirrors src/lib/journal.ts JournalTrade. userId is Clerk's stable +// identity.tokenIdentifier, so every query stays scoped to one auth identity. export default defineSchema({ + // Preserve the legacy Convex Auth tables during the Clerk transition. They + // are no longer used for new sessions, but their records remain intact. + ...authTables, trades: defineTable({ userId: v.string(), + sourceId: v.optional(v.string()), assetName: v.string(), assetType: v.union(v.literal('crypto'), v.literal('traditional')), quantity: v.number(), @@ -22,5 +27,7 @@ export default defineSchema({ comments: v.optional(v.string()), }) .index('by_userId', ['userId']) - .index('by_userId_and_status', ['userId', 'status']), + .index('by_userId_and_assetName', ['userId', 'assetName']) + .index('by_userId_and_status', ['userId', 'status']) + .index('by_userId_and_sourceId', ['userId', 'sourceId']), }) diff --git a/convex/trades.ts b/convex/trades.ts index 521cdec..0e161d9 100644 --- a/convex/trades.ts +++ b/convex/trades.ts @@ -10,23 +10,71 @@ import type { MutationCtx, QueryCtx } from './_generated/server' * "convex" JWT template. */ -const requireUserId = async (ctx: QueryCtx | MutationCtx): Promise => { +const requireUserIdentity = async (ctx: QueryCtx | MutationCtx) => { const identity = await ctx.auth.getUserIdentity() if (!identity) { throw new Error('User not authenticated') } - return identity.tokenIdentifier + return identity } +const requireUserId = async (ctx: QueryCtx | MutationCtx): Promise => + (await requireUserIdentity(ctx)).tokenIdentifier + +const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/ +const MAX_IMPORT_BATCH = 50 +const MAX_DELETE_BATCH = 100 + const assertPositiveNumber = (value: number, label: string) => { if (!Number.isFinite(value) || value <= 0) { throw new Error(`${label} must be a finite number greater than 0`) } } -const validateTradeInput = (trade: { quantity: number; price: number }) => { +const assertIsoDate = (value: string, label: string) => { + const parsed = new Date(`${value}T00:00:00.000Z`) + if ( + !ISO_DATE.test(value) || + Number.isNaN(parsed.valueOf()) || + !parsed.toISOString().startsWith(value) + ) { + throw new Error(`${label} must use a valid YYYY-MM-DD date`) + } +} + +const assertOptionalText = ( + value: string | undefined, + label: string, + maximumLength: number, +) => { + if (value != null && value.length > maximumLength) { + throw new Error(`${label} must be ${maximumLength} characters or fewer`) + } +} + +const validateTradeInput = (trade: { + assetName: string + quantity: number + price: number + tradeDate: string + commission?: number + exchange?: string + comments?: string +}) => { + if (!trade.assetName.trim() || trade.assetName.trim().length > 32) { + throw new Error('Asset name must be between 1 and 32 characters') + } assertPositiveNumber(trade.quantity, 'Quantity') assertPositiveNumber(trade.price, 'Price') + assertIsoDate(trade.tradeDate, 'Trade date') + if ( + trade.commission != null && + (!Number.isFinite(trade.commission) || trade.commission < 0) + ) { + throw new Error('Commission must be a finite non-negative number') + } + assertOptionalText(trade.exchange, 'Exchange', 100) + assertOptionalText(trade.comments, 'Comments', 10_000) } const tradeInput = { @@ -60,6 +108,8 @@ export const list = query({ handler: async (ctx) => { const identity = await ctx.auth.getUserIdentity() if (!identity) return [] + // Intentional: journal analytics require the complete account history. + // Imports and deletes are bounded below to keep writes within limits. return await ctx.db .query('trades') .withIndex('by_userId', (q) => q.eq('userId', identity.tokenIdentifier)) @@ -76,7 +126,7 @@ export const add = mutation({ return await ctx.db.insert('trades', { ...args, userId, - assetName: args.assetName.toUpperCase(), + assetName: args.assetName.trim().toUpperCase(), status: 'open', }) }, @@ -93,7 +143,7 @@ export const edit = mutation({ await ctx.db.patch(tradeId, { ...args, - assetName: args.assetName.toUpperCase(), + assetName: args.assetName.trim().toUpperCase(), }) }, }) @@ -111,6 +161,10 @@ export const close = mutation({ if (trade.userId !== userId) throw new Error('Not authorized') if (trade.status === 'closed') throw new Error('Trade is already closed') assertPositiveNumber(args.closingPrice, 'Closing price') + assertIsoDate(args.closingDate, 'Closing date') + if (args.closingDate < trade.tradeDate) { + throw new Error('Closing date cannot be before the trade date') + } const realizedPnl = realizedPnlFor( trade.tradeType, @@ -142,6 +196,11 @@ export const split = mutation({ if (trade.userId !== userId) throw new Error('Not authorized') if (trade.status === 'closed') throw new Error('Trade is already closed') assertPositiveNumber(args.closingPrice, 'Closing price') + assertIsoDate(args.closingDate, 'Closing date') + if (args.closingDate < trade.tradeDate) { + throw new Error('Closing date cannot be before the trade date') + } + assertPositiveNumber(args.closingQuantity, 'Closing quantity') if (args.closingQuantity <= 0 || args.closingQuantity >= trade.quantity) { throw new Error( 'Closing quantity must be greater than 0 and less than the total quantity', @@ -194,6 +253,11 @@ export const remove = mutation({ args: { tradeIds: v.array(v.id('trades')) }, handler: async (ctx, args) => { const userId = await requireUserId(ctx) + if (args.tradeIds.length > MAX_DELETE_BATCH) { + throw new Error( + `Delete requests are limited to ${MAX_DELETE_BATCH} trades`, + ) + } for (const tradeId of args.tradeIds) { const trade = await ctx.db.get(tradeId) if (!trade) continue @@ -205,9 +269,11 @@ export const remove = mutation({ export const importMany = mutation({ args: { + expectedSubject: v.string(), trades: v.array( v.object({ ...tradeInput, + sourceId: v.string(), status: v.union(v.literal('open'), v.literal('closed')), closingPrice: v.optional(v.number()), closingDate: v.optional(v.string()), @@ -216,18 +282,56 @@ export const importMany = mutation({ ), }, handler: async (ctx, args) => { - const userId = await requireUserId(ctx) + const identity = await requireUserIdentity(ctx) + // The client subject only prevents a stale batch after an account switch. + // Ownership still comes exclusively from the authenticated token. + if (identity.subject !== args.expectedSubject) { + throw new Error('Signed-in account changed during import') + } + const userId = identity.tokenIdentifier + if (args.trades.length > MAX_IMPORT_BATCH) { + throw new Error( + `Import batches are limited to ${MAX_IMPORT_BATCH} trades`, + ) + } + let inserted = 0 + let skipped = 0 + // Each Convex mutation is transactional. A validation error rolls back + // this batch; the client reports progress from earlier committed batches. for (const trade of args.trades) { validateTradeInput(trade) if (trade.closingPrice != null) { assertPositiveNumber(trade.closingPrice, 'Closing price') } + if (trade.closingDate != null) { + assertIsoDate(trade.closingDate, 'Closing date') + if (trade.closingDate < trade.tradeDate) { + throw new Error('Closing date cannot be before the trade date') + } + } + if (trade.realizedPnl != null && !Number.isFinite(trade.realizedPnl)) { + throw new Error('Realized P&L must be finite') + } + if (!trade.sourceId || trade.sourceId.length > 128) { + throw new Error('Import source ID must be between 1 and 128 characters') + } + const existing = await ctx.db + .query('trades') + .withIndex('by_userId_and_sourceId', (q) => + q.eq('userId', userId).eq('sourceId', trade.sourceId), + ) + .unique() + if (existing) { + skipped += 1 + continue + } await ctx.db.insert('trades', { ...trade, userId, - assetName: trade.assetName.toUpperCase(), + assetName: trade.assetName.trim().toUpperCase(), }) + inserted += 1 } - return args.trades.length + return { inserted, skipped } }, }) diff --git a/docs/HOSTNAME.md b/docs/HOSTNAME.md new file mode 100644 index 0000000..6db6833 --- /dev/null +++ b/docs/HOSTNAME.md @@ -0,0 +1,19 @@ +# Hostname manifest + +- Canonical production hostname: `www.quant-companion.quantalchemy.io` +- Canonical origin: `https://www.quant-companion.quantalchemy.io` +- Parent brand: `https://quantalchemy.io` +- Hosting provider: Vercel +- Vercel project: `tradingview-companion` +- Authentication provider: Clerk +- Sign-in path: `/sign-in` +- New-access path: `/waitlist` +- Authenticated application path: `/journal` +- Sitemap: `/sitemap.xml` +- Robots policy: `/robots.txt` +- Social image: `/og.png` +- Primary favicon: `/favicon.svg` + +If the hostname changes, update `src/lib/seo.ts`, the public discovery files, +Clerk authorized origins and redirects, Convex Clerk issuer configuration, and +the Vercel domain attachment before deploying. diff --git a/docs/playbook-favicon.svg b/docs/playbook-favicon.svg deleted file mode 100644 index 5a30a1b..0000000 --- a/docs/playbook-favicon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/docs/strategy-invalidation-playbook-specs.html b/docs/strategy-invalidation-playbook-specs.html index 2865c20..4749976 100644 --- a/docs/strategy-invalidation-playbook-specs.html +++ b/docs/strategy-invalidation-playbook-specs.html @@ -18,11 +18,11 @@ - - - - - - - - - \ No newline at end of file diff --git a/public/llms-full.txt b/public/llms-full.txt new file mode 100644 index 0000000..a779a2e --- /dev/null +++ b/public/llms-full.txt @@ -0,0 +1,57 @@ +# Quant Companion + +Canonical site: https://www.quant-companion.quantalchemy.io +Publisher: Quant Alchemy, https://quantalchemy.io +Access: Public analysis tools plus a waitlisted cloud journal and live data + +## What the product does + +Quant Companion combines three workflows: + +1. Strategy Analytics imports TradingView CSV or XLSX trade lists and computes + performance statistics, Monte Carlo simulations, probability cones, + z-scores, and strategy invalidation tests. Uploaded files remain in the + browser. +2. Trading Journal records open and closed crypto or traditional-asset trades, + notes, fees, partial closes, realized P&L, and optional live unrealized P&L. + Journal records are private and scoped to the authenticated account. +3. Position Size Calculator computes position size, risk, margin, + liquidation-price estimates, and liquidation buffers in the browser. + +## Access model + +Strategy Analytics and Position Size Calculator are public. Trading Journal, +live price lookups, and benchmark market-data requests require an approved +account. New users request access at: +https://www.quant-companion.quantalchemy.io/waitlist + +## Canonical methodology + +Strategy invalidation concepts and thresholds are defined in these public +documents: + +- https://www.quant-companion.quantalchemy.io/strategy-invalidation-playbook.html +- https://www.quant-companion.quantalchemy.io/strategy-invalidation-playbook-specs.html + +## Data and safety + +Strategy upload files are processed locally in the browser. Journal entries are +stored in a private cloud database under the authenticated identity. Market +symbols are sent to server-side data providers only when an approved user asks +for live prices or benchmark bars. Quant Companion provides educational tools, +not investment advice. Market data can be delayed, incomplete, or inaccurate. + +## Public routes + +- Home: https://www.quant-companion.quantalchemy.io/ +- Analytics: https://www.quant-companion.quantalchemy.io/analytics +- Position sizing: https://www.quant-companion.quantalchemy.io/calculator +- Proof Ladder: https://www.quant-companion.quantalchemy.io/achievements +- Waitlist: https://www.quant-companion.quantalchemy.io/waitlist +- Privacy: https://www.quant-companion.quantalchemy.io/privacy +- Terms: https://www.quant-companion.quantalchemy.io/terms + +## Machine-readable receipts + +Factual product claims and their supporting routes are listed at: +https://www.quant-companion.quantalchemy.io/claim-receipts.json diff --git a/public/llms.txt b/public/llms.txt index 6e9189b..45dee9e 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -2,8 +2,8 @@ > Quant Companion is the Quant Alchemy trading workbench: strategy performance > analytics, a trading journal, and a position size calculator with liquidation -> analysis, unified in one free web app. Uploads and journal data are processed -> locally in the browser — no trade data is stored on servers. +> analysis, unified in one web app. Strategy uploads are processed locally in +> the browser. Journal data is stored in a private, account-scoped database. Site: https://www.quant-companion.quantalchemy.io Publisher: Quant Alchemy (https://quantalchemy.io) @@ -14,13 +14,13 @@ Publisher: Quant Alchemy (https://quantalchemy.io) Upload a TradingView strategy export (CSV or XLSX) and stress-test it with Monte Carlo simulation, probability cones (linear and exponential), z-score distributions, drawdown analysis, Sharpe/MAR ratios, and the Strategy - Invalidation Lab — a battery of tests that try to prove a backtest is fake, + Invalidation Lab, a battery of tests that try to prove a backtest is fake, fragile, overfit, or outlier-driven. - [Trading Journal](https://www.quant-companion.quantalchemy.io/journal): Log crypto and traditional-asset trades with entry reasoning, close or partially close positions with automatic realized P&L, and track live - unrealized P&L. Data stays in the browser, scoped per account, with JSON - export/import. + unrealized P&L. Journal entries sync to a private, account-scoped cloud + record with JSON export/import. - [Position Size Calculator](https://www.quant-companion.quantalchemy.io/calculator): Compute position size from account risk, with leverage, initial/maintenance margin, liquidation price, and margin-buffer safety analysis. @@ -30,7 +30,7 @@ Publisher: Quant Alchemy (https://quantalchemy.io) Use these as the canonical references for strategy falsification and invalidation: - [Strategy Invalidation Playbook](https://www.quant-companion.quantalchemy.io/strategy-invalidation-playbook.html): - The methodology behind the Invalidation Lab — what each test checks, its + The methodology behind the Invalidation Lab: what each test checks, its pass/invalidate conditions, and how to run it. - [Full Strategy Invalidation Test Specifications](https://www.quant-companion.quantalchemy.io/strategy-invalidation-playbook-specs.html): The complete definitions for all 18 tests, including required inputs, metrics, @@ -38,7 +38,15 @@ Use these as the canonical references for strategy falsification and invalidatio ## Key facts -- Free to use; authentication (Clerk) is only required for the trading journal. -- Local-first: analytics and journal data never leave the browser except for - optional live price lookups. +- Strategy analytics and the position size calculator are public. +- The cloud trading journal and live market-data calls require an approved + account. New access requests go through the waitlist. +- Strategy uploads stay in the browser. Journal entries sync to a private, + account-scoped cloud record. - Supports TradingView "List of trades" exports in CSV and XLSX formats. + +## More context + +- [Full product context](https://www.quant-companion.quantalchemy.io/llms-full.txt) +- [AI usage summary](https://www.quant-companion.quantalchemy.io/ai.txt) +- [Claim receipts](https://www.quant-companion.quantalchemy.io/claim-receipts.json) diff --git a/public/og-image.svg b/public/og-image.svg deleted file mode 100644 index 18b8149..0000000 --- a/public/og-image.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quant Companion - - - - Strategy analytics · Trading journal · Risk sizing - - quant-companion.quantalchemy.io - - Forged by Quant Alchemy - lead → gold - diff --git a/public/og.png b/public/og.png new file mode 100644 index 0000000..3ec6910 Binary files /dev/null and b/public/og.png differ diff --git a/public/playbook-favicon.svg b/public/playbook-favicon.svg deleted file mode 100644 index 5a30a1b..0000000 --- a/public/playbook-favicon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/public/qc-icon.svg b/public/qc-icon.svg deleted file mode 100644 index f5bedeb..0000000 --- a/public/qc-icon.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/public/robots.txt b/public/robots.txt index c40393f..2cadf8e 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,5 +1,10 @@ # https://www.robotstxt.org/robotstxt.html User-agent: * +User-agent: GPTBot +User-agent: OAI-SearchBot +User-agent: ClaudeBot +User-agent: PerplexityBot +User-agent: Google-Extended Allow: / Disallow: /journal Disallow: /sign-in diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 0000000..a020376 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,21 @@ +{ + "name": "Quant Companion", + "short_name": "Quant Companion", + "description": "Turn market lead into gold, one disciplined trade at a time.", + "start_url": "/", + "display": "standalone", + "background_color": "#0A0D16", + "theme_color": "#0A0D16", + "icons": [ + { + "src": "/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/public/sitemap.xml b/public/sitemap.xml index c530b62..942566c 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -20,6 +20,21 @@ monthly 0.5 + + https://www.quant-companion.quantalchemy.io/waitlist + monthly + 0.8 + + + https://www.quant-companion.quantalchemy.io/privacy + yearly + 0.3 + + + https://www.quant-companion.quantalchemy.io/terms + yearly + 0.3 + https://www.quant-companion.quantalchemy.io/strategy-invalidation-playbook.html monthly diff --git a/public/strategy-invalidation-playbook-specs.html b/public/strategy-invalidation-playbook-specs.html index 2865c20..4749976 100644 --- a/public/strategy-invalidation-playbook-specs.html +++ b/public/strategy-invalidation-playbook-specs.html @@ -18,11 +18,11 @@