1
This commit is contained in:
parent
262ee661a5
commit
bfae183e39
|
|
@ -11,4 +11,8 @@
|
|||
|
||||
## 3. 代码风格
|
||||
- 使用 Python 异步编程 (asyncio)。
|
||||
- 所有的交易日志必须记录 Symbol、价格、原因和时间戳。
|
||||
- 所有的交易日志必须记录 Symbol、价格、原因和时间戳。
|
||||
|
||||
## 4. 不要在本地运行交易系统,后台服务,数据库连接
|
||||
- 交易系统必须在服务器上运行,严禁在本地环境测试。
|
||||
- 所有配置(如 API 密钥、数据库连接等)必须在服务器上配置,本地环境不得包含任何敏感信息。
|
||||
|
|
@ -274,6 +274,26 @@ const StatsDashboard = () => {
|
|||
{ limit: 0, market: 0, unknown: 0 }
|
||||
)
|
||||
|
||||
const handleExportPositions = () => {
|
||||
if (openTrades.length === 0) {
|
||||
alert('暂无持仓数据可导出')
|
||||
return
|
||||
}
|
||||
|
||||
const timestamp = new Date().toISOString().slice(0, 19).replace(/:/g, '-')
|
||||
const filename = `持仓记录_${timestamp}.json`
|
||||
const dataStr = JSON.stringify(openTrades, null, 2)
|
||||
const dataBlob = new Blob([dataStr], { type: 'application/json' })
|
||||
const url = URL.createObjectURL(dataBlob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = filename
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '20px' }}>
|
||||
|
|
@ -441,6 +461,24 @@ const StatsDashboard = () => {
|
|||
<div className="positions-header">
|
||||
<h3>当前持仓</h3>
|
||||
<div style={{ display: 'flex', gap: '8px' }}>
|
||||
<button
|
||||
onClick={handleExportPositions}
|
||||
disabled={openTrades.length === 0}
|
||||
style={{
|
||||
padding: '6px 12px',
|
||||
backgroundColor: '#607D8B',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
cursor: openTrades.length === 0 ? 'not-allowed' : 'pointer',
|
||||
fontSize: '13px',
|
||||
fontWeight: 'bold',
|
||||
opacity: openTrades.length === 0 ? 0.6 : 1
|
||||
}}
|
||||
title="导出当前持仓为JSON数据"
|
||||
>
|
||||
导出 JSON
|
||||
</button>
|
||||
<button
|
||||
className="sltp-all-btn"
|
||||
onClick={handleEnsureAllSLTP}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user