Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quote support 5 secs at most, fix #27 #29

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### WIP v0.1.3

1. 全部命令添加 `--debug`/`-D` flag
2. quote 命令最多支持查询 5 个证券

### v0.1.2

Expand Down
5 changes: 5 additions & 0 deletions cmd/quote/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func quoteOneSec(key string) error {
}

func quoteMultiSec(keys []string) error {
// keys 长度不能超过5
if len(keys) > 5 {
slog.Warn("quoteMultiSec support 5 secs at most, will choose top 5 keys")
keys = keys[:5]
}
// 1. search security
secs := sina.MultiSearch(keys)
if len(secs) == 0 {
Expand Down
5 changes: 5 additions & 0 deletions provider/sina/sina.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ func parseBasicSecurity(body string) []BasicSecurity {
// 腾讯控股,31,00700,00700,腾讯控股,,腾讯控股,99,1,ESG;
// 1 5 7名称 2市场 3 4代码 8- 9在市 10-
ss := strings.Split(item, ",")
if len(ss) != 11 {
slog.Debug("parseBasicSecurity", "body invalid", body)
slog.Warn("parseBasicSecurity", "line of body invalid", item)
continue
}
if ss[8] != "1" {
continue
}
Expand Down
Loading