创建投资
StableFX 中的外汇投资是有时间限制的仓位,资金被分配用于在特定周期内交易某个货币对。本页介绍 useForexInvestments hook、投资类型、周期选项和费用结构。
核心类型
ForexInvestment
import type { ForexInvestment } from '@one_deploy/sdk';
interface ForexInvestment {
/** Unique investment identifier. */
id: string;
/** The currency pair being traded. */
currencyPair: string;
/** Total amount deposited (in USDC). */
amount: number;
/** Amount allocated to active trading. */
tradingCapital: number;
/** Amount allocated to pool reserves. */
reserveCapital: number;
/** The selected cycle duration. */
cycle: string;
/** Current status of the investment. */
status: 'active' | 'pending' | 'completed' | 'cancelled';
/** Realized profit or loss (in USDC). Updated during the cycle. */
pnl: number;
/** Current return as a decimal (e.g. 0.05 = 5%). */
returnRate: number;
/** Total fees charged (in USDC). */
feesCharged: number;
/** ISO-8601 timestamp when the investment was created. */
createdAt: string;
/** ISO-8601 timestamp when the cycle ends. */
expiresAt: string;
/** ISO-8601 timestamp of last update. */
updatedAt: string;
}
ForexCycleOption
周期选项定义了可用的投资期限。每个周期有不同的费率和预期收益范围。
import type { ForexCycleOption } from '@one_deploy/sdk';
interface ForexCycleOption {
/** Cycle identifier, e.g. "7d", "14d", "30d". */
id: string;
/** Human-readable label. */
label: string;
/** Duration in days. */
durationDays: number;
/** Management fee as a decimal (e.g. 0.01 = 1%). */
managementFee: number;
/** Performance fee as a decimal, charged on profits only. */
performanceFee: number;
/** Minimum investment amount in USDC. */
minimumInvestment: number;
/** Whether this cycle option is currently available. */
isAvailable: boolean;
}
可用周期
| 周期 | 时长 | 管理费 | 绩效费 | 最低投资额 |
|---|---|---|---|---|
7d | 7 天 | 0.5% | 10% | $100 |
14d | 14 天 | 0.75% | 10% | $250 |
30d | 30 天 | 1.0% | 15% | $500 |
60d | 60 天 | 1.5% | 15% | $1,000 |
90d | 90 天 | 2.0% | 20% | $2,500 |
费用结构
费用通过两种方式从投资中扣除:
- 管理费 -- 在总存款金额上预先收取。该费用用于运营成本和池维护。
- 绩效费 -- 仅在周期结束时对已实现利润收取。如果投资产生亏损,则不收取绩效费。
// Fee calculation example for a $10,000 investment on a 30-day cycle
const deposit = 10_000;
const managementFee = deposit * 0.01; // $100 (1.0%)
const netDeposit = deposit - managementFee; // $9,900
// If the cycle generates $500 profit:
const profit = 500;
const performanceFee = profit * 0.15; // $75 (15% of profit)
const netProfit = profit - performanceFee; // $425
// Total return to user: $9,900 + $425 = $10,325