protocol.HistoryTradeResp替换成protocol.TradeResp

This commit is contained in:
injoyai
2025-07-02 15:53:38 +08:00
parent 1783643f47
commit accda98f3b
3 changed files with 11 additions and 14 deletions

View File

@@ -360,14 +360,14 @@ func (this *Client) GetMinuteTradeAll(code string) (*protocol.TradeResp, error)
return resp, nil
}
func (this *Client) GetHistoryTrade(date, code string, start, count uint16) (*protocol.HistoryTradeResp, error) {
func (this *Client) GetHistoryTrade(date, code string, start, count uint16) (*protocol.TradeResp, error) {
return this.GetHistoryMinuteTrade(date, code, start, count)
}
// GetHistoryMinuteTrade 获取历史分时交易
// 只能获取昨天及之前的数据,服务器最多返回2000条,count-start<=2000,如果日期输入错误,则返回0
// 历史数据sz000001在20241116只能查到21111112,13年差几天,3141天,或者其他规则
func (this *Client) GetHistoryMinuteTrade(date, code string, start, count uint16) (*protocol.HistoryTradeResp, error) {
func (this *Client) GetHistoryMinuteTrade(date, code string, start, count uint16) (*protocol.TradeResp, error) {
code = protocol.AddPrefix(code)
f, err := protocol.MHistoryTrade.Frame(date, code, start, count)
if err != nil {
@@ -380,17 +380,17 @@ func (this *Client) GetHistoryMinuteTrade(date, code string, start, count uint16
if err != nil {
return nil, err
}
return result.(*protocol.HistoryTradeResp), nil
return result.(*protocol.TradeResp), nil
}
func (this *Client) GetHistoryTradeAll(date, code string) (*protocol.HistoryTradeResp, error) {
func (this *Client) GetHistoryTradeAll(date, code string) (*protocol.TradeResp, error) {
return this.GetHistoryMinuteTradeAll(date, code)
}
// GetHistoryMinuteTradeAll 获取历史分时全部交易,通过多次请求来拼接,只能获取昨天及之前的数据
// 历史数据sz000001在20241116只能查到21111112,13年差几天,3141天,或者其他规则
func (this *Client) GetHistoryMinuteTradeAll(date, code string) (*protocol.HistoryTradeResp, error) {
resp := &protocol.HistoryTradeResp{}
func (this *Client) GetHistoryMinuteTradeAll(date, code string) (*protocol.TradeResp, error) {
resp := &protocol.TradeResp{}
size := uint16(2000)
for start := uint16(0); ; start += size {
r, err := this.GetHistoryMinuteTrade(date, code, start, size)