Hikyuu
util.h
浏览该文件的文档.
1 /*
2  * util.h
3  *
4  * Created on: 2009-11-20
5  * Author: fasiondog
6  */
7 
8 #ifndef UTIL_H_
9 #define UTIL_H_
10 
11 #ifndef DATATYPE_H_
12 #include <string>
13 #include <boost/config.hpp>
14 
15 #ifndef HKU_API
16 #define HKU_API
17 #endif
18 
19 #endif /* DATATYPE_H_ */
20 
21 namespace hku {
22 
23 #ifndef DATATYPE_H_
24 using std::string;
25 #endif
26 
32 #if defined(BOOST_WINDOWS)
33 string HKU_API utf8_to_gb(const char* szinput);
34 string HKU_API utf8_to_gb(const string& szinput);
35 string HKU_API gb_to_utf8(const char* szinput);
36 string HKU_API gb_to_utf8(const string& szinput);
37 #else
38 string HKU_API utf8_to_gb(const string& szinput);
39 string HKU_API gb_to_utf8(const string& szinput);
40 #endif
41 
48 #if defined(BOOST_WINDOWS) && (PY_VERSION_HEX < 0x03000000)
49  //将utf8编码的字符串转换为GB2312编码
50  #define UTF8ToGB utf8_to_gb
51  #define GBToUTF8 gb_to_utf8
52  #define HKU_STR(s) UTF8ToGB(s)
53 #else
54  #define HKU_STR(s) (s)
55  #define GBToUTF8(s) (s)
56  #define UTF8ToGB(s) (s)
57 #endif
58 
59 
66 double HKU_API roundEx(double number, int ndigits=0);
67 
74 double HKU_API roundUp(double number, int ndigits=0);
75 
82 double HKU_API roundDown(double number, int ndigits=0);
83 
84 
86 } /* namespace */
87 
88 #endif /* UTIL_H_ */
std::string string
Definition: DataType.h:55
double HKU_API roundDown(double number, int ndigits)
向下截取,如10.1截取后为10
Definition: util.cpp:80
double HKU_API roundEx(double number, int ndigits)
四舍五入,和python中的round行为一样
Definition: util.cpp:20
string HKU_API utf8_to_gb(const string &szinput)
Definition: util.cpp:206
string HKU_API gb_to_utf8(const string &szinput)
Definition: util.cpp:222
#define HKU_API
Definition: util.h:16
double HKU_API roundUp(double number, int ndigits)
向上截取,如10.1截取后为11
Definition: util.cpp:50
Hikyuu核心命名空间,包含股票数据的管理、指标实现、交易系统框架等
Definition: Block.cpp:11