feat(api): 构建汇率流水表与定时抓取 API,实现 USD/HKD 对人民币的双点数据入库
This commit is contained in:
@@ -92,3 +92,15 @@ export const assetPricesHistory = pgTable("asset_prices_history", {
|
||||
}, (table) => [
|
||||
uniqueIndex("asset_price_date_idx").on(table.assetId, table.date),
|
||||
]);
|
||||
|
||||
export const exchangeRatesHistory = pgTable("exchange_rates_history", {
|
||||
id: uuid("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
||||
fromCurrency: varchar("from_currency", { length: 10 }).notNull(),
|
||||
toCurrency: varchar("to_currency", { length: 10 }).notNull(),
|
||||
rate: numeric("rate", { precision: 20, scale: 8 }).notNull(),
|
||||
fetchTime: timestamp("fetch_time", { withTimezone: true, mode: "date" })
|
||||
.notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true, mode: "date" })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user