原帖见 http://www.weistock.com/bbs/dispbbs.asp?boardid=5&Id=12481 交易系统分成三部分: 1. 数据存储。利用金字塔插件实现实时行情的存储到数据库。需要存储的数据包括:秒级tick数据(主力合约达到2笔/s)和分钟级的K线数据及合约最新的价格。把tick数据保存到tickTable表中,把K线保存到KLineTable表中,把最新价格保存到lastPriceTable表中。三个表中的字段及其意义见附录。 2. 决策部分。纽银方面根据保存到数据库中的信息进行决策,决策结果保存到指令表OrderTable中。 3. 下单及反馈。金字塔根据指令表OrderTable中的信息发出指令,并把持仓信息更新到持仓表PositionTable中。 tickTable中字段: 字段名 字段类型 意义 其它 InstrumentID string 合约代码 “ZJIF05”表示中金所的IF05 TradeTime string 时间 格式为YYYYMMDDHHmmSS 年月日时分秒 NowPrice float 最新价 NowVolume float 现手 TotalVolume float 总持仓量 Volume float 成交量 Amount float 成交额 BuyVolume float 买一量 BuyPrice float 买一价 SellVolume float 卖一量 SellPrice float 卖一价 KlineTable中字段: 字段名 字段类型 意义 其它 InstrumentID string 合约代码 “ZJIF05”表示中金所的IF05 TradeTime string 时间 格式为YYYYMMDDHHmm 年月日时分 OpenPrice float 开盘价 ClosePrice float 收盘价 HighPrice float 最高价 LowPrice float 最低价 Volume float 成交量 Amount float 成交额 LastPriceTable中字段: 字段名 字段类型 意义 其它 InstrumentID string 合约代码 “ZJIF05”表示中金所的IF05 TradeTime string 时间 格式为YYYYMMDDHHmmSS 年月日时分秒 NowPrice float 最新价 NowVolume float 现手 Volume float 成交量 Amount float 成交额 BuyVolume float 买一量 BuyPrice float 买一价 SellVolume float 卖一量 SellPrice float 卖一价 OrderTable表中字段: 字段名 字段类型 意义 其它 AccountID string 账户 InstrumentID string 合约代码 “ZJIF05”表示中金所的IF05 Action string 操作类型 “Insert”表示挂单 “Cancel”表示撤单 PriceType BYTE 价格类型 0限价单 1市价单 2停损单 3限价停损单 LmtPrice float 挂单价格 StopPrice float 停止价 Volume float 下单手数 Direction BYTE 交易方向 0买 1卖 Offset BYTE 开平标志 0开仓 1平仓 Hedge BYTE 套保标志 0投机 1保值 PostionTable中的字段: AccountID string 账户 InstrumentID string 合约代码 “ZJIF05”表示中金所的IF05 Direction BYTE 持仓方向 0买持 1卖持 以上的设计部分包含的参考信息如下: 基于金字塔平台下开发C++交易策略 http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=11548 利用数据库扩充金字塔的数据存放及分析能力 http://www.weistock.com/bbs/dispbbs.asp?boardid=5&Id=401&page=2