投资周期
投资周期定义了 AI 交易订单的锁定期。在锁定期间,AI 代理拥有完全的自主权来交易所分配的资金。较长的周期通常提供更高的分成比例(即返还给投资者的利润百分比)。
周期运作方式
当用户创建 AI 交易订单时,需要选择周期时长。资金将在该时长内被锁定,AI 代理代为交易。
Order Created ─────── Lock Period ─────── Cycle End
│ │
│ AI agent trades freely │
│ User cannot withdraw without penalty │
│ │
└── Early withdrawal incurs penalty ─────┘
- 锁定期:资金承诺投入的天数。
- 分成比例:净利润中归投资者的百分比。剩余部分归平台/代理运营方。
- 提前赎回:用户可以在周期结束前赎回,但会根据剩余时间收取罚金。详见提前赎回。
周期选项
典型的周期时长及其对应的分成比例:
| 周期时长 | 锁定期 | 投资者分成比例 | 平台分成 |
|---|---|---|---|
| 7 天 | 7 天 | 60% | 40% |
| 14 天 | 14 天 | 65% | 35% |
| 30 天 | 30 天 | 70% | 30% |
| 60 天 | 60 天 | 75% | 25% |
| 90 天 | 90 天 | 80% | 20% |
| 180 天 | 180 天 | 85% | 15% |
提示
较长的锁定期给予 AI 代理更多时间来执行其策略并从临时回撤中恢复,因此提供更高的分成比例。
DEFAULT_SHARE_RATES 常量
DEFAULT_SHARE_RATES 常量提供了从周期时长(天数)到投资者分成比例的标准映射。
import { DEFAULT_SHARE_RATES } from '@one_deploy/sdk';
// DEFAULT_SHARE_RATES is a Record<number, number>
console.log(DEFAULT_SHARE_RATES[7]); // 0.60
console.log(DEFAULT_SHARE_RATES[14]); // 0.65
console.log(DEFAULT_SHARE_RATES[30]); // 0.70
console.log(DEFAULT_SHARE_RATES[60]); // 0.75
console.log(DEFAULT_SHARE_RATES[90]); // 0.80
console.log(DEFAULT_SHARE_RATES[180]); // 0.85
const DEFAULT_SHARE_RATES: Record<number, number> = {
7: 0.60,
14: 0.65,
30: 0.70,
60: 0.75,
90: 0.80,
180: 0.85,
};
OneCycleSelector 组件
OneCycleSelector 是一个 React Native 组件,用于展示给定策略的可用周期选项,显示每个选项的锁定时长和分成比例。
仅限 React Native
OneCycleSelector 从 @one_deploy/sdk 的 React Native 入口导出,不适用于 Web。
快速开始
import { useState } from 'react';
import { OneCycleSelector } from '@one_deploy/sdk';
function CycleSelection() {
const [selectedCycle, setSelectedCycle] = useState<number | null>(null);
return (
<OneCycleSelector
strategyId="strat_abc123"
onSelect={(cycleDays) => {
setSelectedCycle(cycleDays);
console.log('Selected cycle:', cycleDays, 'days');
}}
/>
);
}
OneCycleSelectorProps
interface OneCycleSelectorProps {
/** Strategy ID to determine available cycles. */
strategyId: string;
/** Currently selected cycle duration in days. */
selectedCycle?: number;
/** Callback fired when the user selects a cycle. */
onSelect: (cycleDays: number) => void;
/** Whether to display the share rate next to each option. Defaults to true. */
showShareRate?: boolean;
/** Custom share rates to override DEFAULT_SHARE_RATES. */
shareRates?: Record<number, number>;
/** Additional style applied to the container. */
style?: ViewStyle;
/** Style applied to each cycle option. */
itemStyle?: ViewStyle;
/** Style applied to the selected cycle option. */
selectedItemStyle?: ViewStyle;
/** Test ID for testing frameworks. */
testID?: string;
}
属性表
| 属性 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
strategyId | string | 是 | -- | 用于获 取可用周期的策略 ID |
selectedCycle | number | 否 | -- | 当前选中的周期(天数) |
onSelect | (cycleDays: number) => void | 是 | -- | 选择回调 |
showShareRate | boolean | 否 | true | 显示分成比例标签 |
shareRates | Record<number, number> | 否 | DEFAULT_SHARE_RATES | 自定义分成比例映射 |
style | ViewStyle | 否 | -- | 容器样式 |
itemStyle | ViewStyle | 否 | -- | 单个选项样式 |
selectedItemStyle | ViewStyle | 否 | -- | 选中项样式 |
testID | string | 否 | -- | 测试 ID |
显示分成比例信息
import { OneCycleSelector, DEFAULT_SHARE_RATES } from '@one_deploy/sdk';
function CycleWithInfo() {
const [selectedCycle, setSelectedCycle] = useState<number | null>(null);
const shareRate = selectedCycle ? DEFAULT_SHARE_RATES[selectedCycle] : null;
return (
<View>
<OneCycleSelector
strategyId="strat_abc123"
selectedCycle={selectedCycle ?? undefined}
showShareRate={true}
onSelect={setSelectedCycle}
/>
{selectedCycle && shareRate && (
<View style={styles.info}>
<Text>Lock period: {selectedCycle} days</Text>
<Text>Your share of profits: {(shareRate * 100).toFixed(0)}%</Text>
<Text>Platform share: {((1 - shareRate) * 100).toFixed(0)}%</Text>
</View>
)}
</View>
);
}
自定义分成比例
如果您的项目使用不同的费用结构,可以用自定义值覆盖默认分成比例。
import { OneCycleSelector } from '@one_deploy/sdk';
const CUSTOM_RATES: Record<number, number> = {
7: 0.55,
30: 0.72,
90: 0.82,
};
function CustomCycleSelector() {
return (
<OneCycleSelector
strategyId="strat_abc123"
shareRates={CUSTOM_RATES}
onSelect={(days) => console.log('Cycle:', days)}
/>
);
}
后续步骤
- 创建订单 -- 在订单创建流程中使用所选周期。
- 提前赎回 -- 了解在周期结束前赎回的罚金。
- OneCycleSelector 参考 -- 完整的组件 API 参考。