70 lines
1.2 KiB
C++
70 lines
1.2 KiB
C++
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
|
|
#include <QString>
|
|
|
|
struct StockInfo {
|
|
QString strCode;
|
|
QString strName;
|
|
float fcurPrice;
|
|
float fShare;
|
|
};
|
|
|
|
/*
|
|
*
|
|
code str 股票代码
|
|
name str 股票名称
|
|
time_key str K 线时间
|
|
open float 开盘价
|
|
close float 收盘价
|
|
high float 最高价
|
|
low float 最低价
|
|
pe_ratio float 市盈率
|
|
turnover_rate float 换手率
|
|
volume int 成交量
|
|
turnover float 成交额
|
|
change_rate float 涨跌幅
|
|
last_close float 昨收价
|
|
*
|
|
*/
|
|
struct StockKInfo {
|
|
QString code;
|
|
QString name;
|
|
QString timeKey;
|
|
float open;
|
|
float close;
|
|
float high;
|
|
float low;
|
|
float peRatio;
|
|
float turnoverRate;
|
|
int volume;
|
|
float turnover;
|
|
float changeRate;
|
|
float lastClose;
|
|
};
|
|
|
|
// 数据结构:存储每日价格和交易数据
|
|
struct DataPoint {
|
|
std::string date;
|
|
double open;
|
|
double close;
|
|
double sma_short;
|
|
double sma_long;
|
|
int signal;
|
|
int position;
|
|
double returns;
|
|
double strategy_returns;
|
|
};
|
|
|
|
// 性能统计结果
|
|
struct PerformanceResult {
|
|
int S;
|
|
int L;
|
|
double total_return;
|
|
double sharpe_ratio;
|
|
double max_drawdown;
|
|
};
|
|
|
|
|
|
#endif // CONFIG_H
|