Merge pull request #137 from fasiondog/feature/tools

Feature/tools fixed windows 下板块读取错误
This commit is contained in:
fasiondog 2023-12-10 02:00:07 +08:00 committed by GitHub
commit 1cf80831d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 29972 additions and 18349 deletions

View File

@ -7,7 +7,6 @@
* Author: fasiondog
*/
#include <boost/algorithm/string.hpp>
#include "StockManager.h"
namespace hku {

View File

@ -6,7 +6,7 @@
*/
#include <fstream>
#include <boost/algorithm/string.hpp>
#include "hikyuu/utilities/arithmetic.h"
#include "QLBlockInfoDriver.h"
namespace hku {
@ -36,9 +36,9 @@ Block QLBlockInfoDriver ::getBlock(const string& category, const string& name) {
string line_str;
string section, market, code;
bool is_find = false;
string gb_name = utf8_to_gb(name);
// string gb_name = utf8_to_gb(name);
while (std::getline(inifile, line_str)) {
boost::trim(line_str);
trim(line_str);
// 空行或注释行,跳过
if (line_str.empty() || line_str.at(0) == ';') {
@ -49,7 +49,7 @@ Block QLBlockInfoDriver ::getBlock(const string& category, const string& name) {
size_t pos = line_str.find(';');
if (pos != std::string::npos) {
line_str.assign(line_str, 0, pos);
boost::trim(line_str);
trim(line_str);
}
// section行
@ -63,12 +63,12 @@ Block QLBlockInfoDriver ::getBlock(const string& category, const string& name) {
}
section.assign(line_str, 1, len - 2);
boost::trim(section);
trim(section);
if (section.empty()) {
continue;
}
if (section == gb_name) {
if (section == name) {
is_find = true;
}
}
@ -78,8 +78,8 @@ Block QLBlockInfoDriver ::getBlock(const string& category, const string& name) {
if (pos != std::string::npos) {
market.assign(line_str, 0, pos);
code.assign(line_str, pos + 1, line_str.size());
boost::trim(market);
boost::trim(code);
trim(market);
trim(code);
if (market == "0") {
result.add("SH" + code);
} else {
@ -115,7 +115,7 @@ BlockList QLBlockInfoDriver::getBlockList(const string& category) {
std::string line_str;
Block block;
while (std::getline(inifile, line_str)) {
boost::trim(line_str);
trim(line_str);
// 空行或注释行,跳过
if (line_str.empty() || line_str.at(0) == ';')
@ -125,7 +125,7 @@ BlockList QLBlockInfoDriver::getBlockList(const string& category) {
size_t pos = line_str.find(';');
if (pos != std::string::npos) {
line_str.assign(line_str, 0, pos);
boost::trim(line_str);
trim(line_str);
}
// section行
@ -135,11 +135,11 @@ BlockList QLBlockInfoDriver::getBlockList(const string& category) {
continue;
section.assign(line_str, 1, len - 2);
boost::trim(section);
trim(section);
if (section.empty())
continue;
block = Block(category, gb_to_utf8(section));
block = Block(category, section);
result.push_back(block);
} else {
@ -151,12 +151,12 @@ BlockList QLBlockInfoDriver::getBlockList(const string& category) {
continue;
key.assign(line_str, 0, pos);
boost::trim(key);
trim(key);
if (key.empty())
continue;
value.assign(line_str, pos + 1, std::string::npos);
boost::trim(value);
trim(value);
if (value.empty())
continue;

View File

@ -111,8 +111,8 @@ inline void trim(std::string& s) {
s.erase(0, s.find_first_not_of(" "));
s.erase(s.find_last_not_of(" ") + 1);
s.erase(s.find_last_not_of("\n") + 1);
s.erase(s.find_last_not_of("\r") + 1);
s.erase(s.find_last_not_of("\n") + 1);
}
/**

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
[恒综企业]
[恒综企业]
2,00004
2,00013
2,00017
@ -15,7 +15,7 @@
2,00882
2,01038
2,01359
[恒工业]
[恒工业]
2,00148
2,00179
2,00269
@ -58,7 +58,7 @@
2,03808
2,03898
2,06199
[恒能源业]
[恒能源业]
2,00135
2,00196
2,00276
@ -84,7 +84,7 @@
2,02236
2,02883
2,03899
[恒生金融]
[恒生金融]
2,00005
2,00011
2,00023
@ -97,7 +97,7 @@
2,02628
2,03328
2,03988
[恒生小型]
[恒生小型]
2,00034
2,00043
2,00067
@ -372,7 +372,7 @@
2,03993
2,06199
2,06881
[恒生大型]
[恒生大型]
2,00001
2,00002
2,00003
@ -480,7 +480,7 @@
2,03968
2,03988
2,06808
[国企指数]
[国企指数]
2,00168
2,00347
2,00358
@ -529,7 +529,7 @@
2,03988
2,06030
2,06837
[恒IT业]
[恒IT业]
2,00241
2,00268
2,00285
@ -565,7 +565,7 @@
2,03315
2,03336
2,03888
[恒公用业]
[恒公用业]
2,00002
2,00003
2,00006
@ -602,7 +602,7 @@
2,03698
2,03800
2,06818
[恒电讯业]
[恒电讯业]
2,00008
2,00215
2,00315
@ -612,7 +612,7 @@
2,00941
2,01045
2,01883
[恒原材料]
[恒原材料]
2,00067
2,00148
2,00189
@ -659,7 +659,7 @@
2,02899
2,03983
2,03993
[红筹指数]
[红筹指数]
2,00119
2,00123
2,00135
@ -693,12 +693,12 @@
2,03360
2,03377
2,03808
[恒生公用]
[恒生公用]
2,00002
2,00003
2,00006
2,00836
[恒地产业]
[恒地产业]
2,00001
2,00004
2,00010
@ -801,7 +801,7 @@
2,03383
2,03639
2,03900
[恒金融业]
[恒金融业]
2,00005
2,00011
2,00023
@ -838,7 +838,7 @@
2,03988
2,06030
2,06837
[恒消费品]
[恒消费品]
2,00043
2,00073
2,00116
@ -956,7 +956,7 @@
2,03933
2,03998
2,06863
[恒生综指]
[恒生综指]
2,00001
2,00002
2,00003
@ -1453,7 +1453,7 @@
2,06837
2,06863
2,06881
[恒服务业]
[恒服务业]
2,00027
2,00044
2,00045
@ -1522,7 +1522,7 @@
2,03382
2,03813
2,06808
[恒生指数]
[恒生指数]
2,00001
2,00002
2,00003
@ -1577,7 +1577,7 @@
2,02628
2,03328
2,03988
[内地25]
[内地25]
2,00135
2,00151
2,00322
@ -1605,7 +1605,7 @@
2,03328
2,03968
2,03988
[恒生地产]
[恒生地产]
2,00001
2,00004
2,00012
@ -1615,7 +1615,7 @@
2,00101
2,00688
2,01109
[恒生工商]
[恒生工商]
2,00004
2,00013
2,00017
@ -1647,7 +1647,7 @@
2,02038
2,02319
2,02600
[恒生中型]
[恒生中型]
2,00008
2,00014
2,00027

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
[林地规划]
[林地规划]
1,000663
0,600265
0,600189
@ -19,7 +19,7 @@
0,600235
0,600163
[软件产业]
[软件产业]
0,600571
0,600756
1,002195
@ -50,7 +50,7 @@
1,300020
1,002153
[高铁产业]
[高铁产业]
1,000595
1,000920
1,002081
@ -90,7 +90,7 @@
0,601668
0,601766
[以旧换新]
[以旧换新]
1,000521
1,000527
1,000533
@ -122,7 +122,7 @@
0,600481
1,002242
[生物产业]
[生物产业]
1,000004
1,000078
1,000538
@ -160,7 +160,7 @@
0,600867
1,300186
[生物育种]
[生物育种]
0,600354
1,000713
1,002041
@ -171,7 +171,7 @@
1,002157
1,002086
[农机补贴]
[农机补贴]
0,600218
1,000816
1,300022
@ -186,7 +186,7 @@
1,000338
0,600841
[新能源车]
[新能源车]
0,600066
0,600686
0,600166
@ -214,7 +214,7 @@
1,000571
0,600192
[智能电网]
[智能电网]
1,000021
1,000400
1,000682
@ -262,7 +262,7 @@
0,601700
0,601727
[长三角]
[长三角]
0,600088
1,002028
0,600590
@ -330,7 +330,7 @@
0,600651
0,600115
[山东半岛]
[山东半岛]
0,600467
0,600960
1,000677
@ -378,7 +378,7 @@
0,601678
0,600308
[深圳特区]
[深圳特区]
1,000001
1,000002
1,000004
@ -400,7 +400,7 @@
1,000024
1,000025
[保险持股]
[保险持股]
0,601106
0,601117
1,002443
@ -799,7 +799,7 @@
0,601958
0,601288
[社保持股]
[社保持股]
1,002440
0,600660
0,600718
@ -1096,7 +1096,7 @@
0,600496
0,600482
[股东增持]
[股东增持]
0,600875
0,600496
0,600603
@ -1140,7 +1140,7 @@
0,600754
0,600110
[文化振兴]
[文化振兴]
0,600825
0,600831
0,600832
@ -1160,7 +1160,7 @@
0,601801
1,300052
[预盈预增]
[预盈预增]
1,002083
1,000520
1,000937
@ -1561,7 +1561,7 @@
0,600982
0,600029
[分拆上市]
[分拆上市]
0,600100
0,600739
1,000988
@ -1596,7 +1596,7 @@
0,601991
1,000778
[手机支付]
[手机支付]
0,600584
1,002119
1,000851
@ -1620,7 +1620,7 @@
1,002261
0,600410
[期货概念]
[期货概念]
1,000010
1,000031
1,000060
@ -1651,7 +1651,7 @@
0,600787
0,600837
[融资融券]
[融资融券]
0,600000
0,600005
0,600015
@ -1743,7 +1743,7 @@
1,002142
1,002202
[惠农概念]
[惠农概念]
0,600108
0,600127
0,600189
@ -1780,7 +1780,7 @@
1,002234
1,002259
[新能源]
[新能源]
0,600066
0,600076
0,600089
@ -1922,7 +1922,7 @@
1,300153
1,300160
[环保概念]
[环保概念]
1,300190
0,600008
0,600292
@ -1955,7 +1955,7 @@
1,300137
1,002499
[循环经济]
[循环经济]
0,600008
0,600010
0,600022
@ -2006,7 +2006,7 @@
1,000959
1,000983
[节能减排]
[节能减排]
0,600160
0,600636
0,600396
@ -2042,7 +2042,7 @@
1,002178
0,600590
[锂电池]
[锂电池]
0,600846
0,600773
0,600872
@ -2086,7 +2086,7 @@
1,002389
1,300068
[稀缺资源]
[稀缺资源]
0,600792
0,600259
0,600265
@ -2128,7 +2128,7 @@
1,002378
1,002340
[资产注入]
[资产注入]
0,600007
0,600010
0,600033
@ -2220,7 +2220,7 @@
1,000951
1,000963
[高净收率]
[高净收率]
0,600609
0,601988
0,600115
@ -2256,7 +2256,7 @@
0,600579
0,600031
[大浦东]
[大浦东]
0,600675
0,600708
0,600818
@ -2278,7 +2278,7 @@
0,600591
0,600115
[新医改]
[新医改]
1,000963
1,002038
1,002252

10
test_data/block/self.ini Normal file
View File

@ -0,0 +1,10 @@
[1]
1, 000728 ;国元证券
1, 002685 ;华东重机
1, 002339 ;积成电子
1, 000958 ;东方能源
1, 000001 ;平安银行
0, 600050 ;中国联通
0, 601098 ;中南传媒
0, 600601 ;方正科技
0, 601018 ;宁波港

View File

@ -1,5 +1,5 @@
[港澳中线]
[港澳点评]
[港澳中线]
[港澳点评]
1,000933
1,000557
1,000613

File diff suppressed because it is too large Load Diff