feat(ui): 接入股票名称展示,实装表单币种自动绑定及编辑删除功能
This commit is contained in:
@@ -37,8 +37,9 @@ export async function syncAllStockPrices() {
|
||||
const latestPrice = dataArr[3];
|
||||
|
||||
if (latestPrice && !isNaN(Number(latestPrice)) && Number(latestPrice) > 0) {
|
||||
const stockName = dataArr[1] || null;
|
||||
await db.update(assets)
|
||||
.set({ latestPrice: latestPrice })
|
||||
.set({ latestPrice: latestPrice, name: stockName })
|
||||
.where(eq(assets.id, asset.id));
|
||||
successCount++;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { desc, eq } from 'drizzle-orm';
|
||||
interface Position {
|
||||
assetId: string;
|
||||
symbol: string;
|
||||
name: string | null;
|
||||
type: string;
|
||||
quantity: string;
|
||||
baseCurrency: string;
|
||||
@@ -82,6 +83,7 @@ export async function getPortfolioPositions(): Promise<Position[]> {
|
||||
txCurrency: transactions.txCurrency,
|
||||
assetId: transactions.assetId,
|
||||
assetSymbol: assets.symbol,
|
||||
assetName: assets.name,
|
||||
assetType: assets.type,
|
||||
assetBaseCurrency: assets.baseCurrency,
|
||||
assetLatestPrice: assets.latestPrice,
|
||||
@@ -101,6 +103,7 @@ export async function getPortfolioPositions(): Promise<Position[]> {
|
||||
const holdings = new Map<string, {
|
||||
assetId: string;
|
||||
symbol: string;
|
||||
name: string | null;
|
||||
type: string;
|
||||
quantity: Big;
|
||||
baseCurrency: string;
|
||||
@@ -117,6 +120,7 @@ export async function getPortfolioPositions(): Promise<Position[]> {
|
||||
holdings.set(tx.assetId, {
|
||||
assetId: tx.assetId,
|
||||
symbol: tx.assetSymbol || tx.assetId,
|
||||
name: tx.assetName,
|
||||
type: tx.assetType || 'CASH',
|
||||
quantity: new Big('0'),
|
||||
baseCurrency: tx.assetBaseCurrency || '',
|
||||
@@ -190,6 +194,7 @@ export async function getPortfolioPositions(): Promise<Position[]> {
|
||||
result.push({
|
||||
assetId: holding.assetId,
|
||||
symbol: holding.symbol,
|
||||
name: holding.name,
|
||||
type: holding.type,
|
||||
quantity: holding.quantity.toString(),
|
||||
baseCurrency: holding.baseCurrency,
|
||||
|
||||
Reference in New Issue
Block a user