mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-17 17:34:39 +08:00
refactor: standardize code comments
This commit is contained in:
@@ -26,7 +26,7 @@ func NewAPIClient() *APIClient {
|
||||
|
||||
hookRes := hook.HookExec[hook.SetHttpClientResult](hook.SET_HTTP_CLIENT, client)
|
||||
if hookRes != nil && hookRes.Error() == nil {
|
||||
log.Printf("使用Hook设置的HTTP客户端")
|
||||
log.Printf("Using HTTP client set by Hook")
|
||||
client = hookRes.GetResult()
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func (c *APIClient) GetKlines(symbol, interval string, limit int) ([]Kline, erro
|
||||
var klineResponses []KlineResponse
|
||||
err = json.Unmarshal(body, &klineResponses)
|
||||
if err != nil {
|
||||
log.Printf("获取K线数据失败,响应内容: %s", string(body))
|
||||
log.Printf("Failed to get K-line data, response content: %s", string(body))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func (c *APIClient) GetKlines(symbol, interval string, limit int) ([]Kline, erro
|
||||
for _, kr := range klineResponses {
|
||||
kline, err := parseKline(kr)
|
||||
if err != nil {
|
||||
log.Printf("解析K线数据失败: %v", err)
|
||||
log.Printf("Failed to parse K-line data: %v", err)
|
||||
continue
|
||||
}
|
||||
klines = append(klines, kline)
|
||||
@@ -107,7 +107,7 @@ func parseKline(kr KlineResponse) (Kline, error) {
|
||||
return kline, fmt.Errorf("invalid kline data")
|
||||
}
|
||||
|
||||
// 解析各个字段
|
||||
// Parse each field
|
||||
kline.OpenTime = int64(kr[0].(float64))
|
||||
kline.Open, _ = strconv.ParseFloat(kr[1].(string), 64)
|
||||
kline.High, _ = strconv.ParseFloat(kr[2].(string), 64)
|
||||
|
||||
Reference in New Issue
Block a user