predikt/oracle/backend/scripts/update-stats.ts
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

30 lines
917 B
TypeScript

import { runScript } from './run-script'
import { log, revalidateStaticProps } from 'shared/utils'
import { saveCalibrationData } from 'shared/calculate-calibration'
import { updateStatsBetween } from '../scheduler/src/jobs/update-stats'
if (require.main === module)
runScript(async ({ pg }) => {
// get dates from cli
if (process.argv.length < 4) {
log('Usage: yarn update-stats <start> <end>')
process.exit(1)
}
const start = process.argv[2]
const end = process.argv[3]
if (!dateregex.test(start) || !dateregex.test(end)) {
log.error('Invalid date format, should be YYYY-MM-DD')
process.exit(1)
}
await updateStatsBetween(pg, start, end)
await saveCalibrationData(pg)
await revalidateStaticProps('/stats')
// note does not update mana stats. if you want that please add the call to this script
})
const dateregex = /^\d{4}-\d{2}-\d{2}$/