跳至主要内容

投资周期

投资周期定义了 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;
}

属性表

属性类型必填默认值描述
strategyIdstring--用于获取可用周期的策略 ID
selectedCyclenumber--当前选中的周期(天数)
onSelect(cycleDays: number) => void--选择回调
showShareRatebooleantrue显示分成比例标签
shareRatesRecord<number, number>DEFAULT_SHARE_RATES自定义分成比例映射
styleViewStyle--容器样式
itemStyleViewStyle--单个选项样式
selectedItemStyleViewStyle--选中项样式
testIDstring--测试 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)}
/>
);
}

后续步骤