mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
- 新增 TushareApi 结构体和 GetDaily 方法,用于获取 A 股日线行情数据 - 在 openai_api.go 中添加获取股票日 K线数据的协程 - 在 utils.go 中添加股票代码与 tushare 代码相互转换的函数 - 更新相关测试文件以支持新功能
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package data
|
|
|
|
import (
|
|
"go-stock/backend/logger"
|
|
"testing"
|
|
)
|
|
|
|
// TestRemoveNonPrintable tests the RemoveAllBlankChar function.
|
|
func TestRemoveNonPrintable(t *testing.T) {
|
|
//tests := []struct {
|
|
// input string
|
|
// expected string
|
|
//}{
|
|
// {"新 希 望", "新希望"},
|
|
// {"", ""},
|
|
// {"Hello, World!", "Hello, World!"},
|
|
// {"\x00\x01\x02", ""},
|
|
// {"Hello\x00World", "HelloWorld"},
|
|
// {"\x1F\x20\x7E\x7F", " \x7E"},
|
|
//}
|
|
|
|
//for _, test := range tests {
|
|
// actual := RemoveAllBlankChar(test.input)
|
|
// if actual != test.expected {
|
|
// t.Errorf("RemoveAllBlankChar(%q) = %q; expected %q", test.input, actual, test.expected)
|
|
// }
|
|
//}
|
|
txt := "新 希 望"
|
|
txt2 := RemoveAllBlankChar(txt)
|
|
logger.SugaredLogger.Infof("RemoveAllBlankChar(%s)", txt2)
|
|
logger.SugaredLogger.Infof("RemoveAllBlankChar(%s)", txt)
|
|
|
|
}
|
|
|
|
func TestConvertStockCodeToTushareCode(t *testing.T) {
|
|
logger.SugaredLogger.Infof("ConvertStockCodeToTushareCode(%s)", ConvertStockCodeToTushareCode("sz000802"))
|
|
logger.SugaredLogger.Infof("ConvertTushareCodeToStockCode(%s)", ConvertTushareCodeToStockCode("000802.SZ"))
|
|
}
|