-
Notifications
You must be signed in to change notification settings - Fork 4
/
common.h
executable file
·47 lines (30 loc) · 1.38 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _COMMON_H_
#define _COMMON_H_
#include <string>
#define TERMINATE_STR(str) str[sizeof(str) - 1] = 0;
#define COPY_STR(dst, src) \
{ \
if (dst != NULL && src != NULL) { \
strncpy(dst, src, sizeof(dst) - 1); \
dst[sizeof(dst) - 1] = 0; \
} \
}
double __fastcall NormalizeDouble(const double val, int digits);
int CheckGroup(char* grouplist, const char* group);
double DecPow(const int digits);
char* RemoveWhiteChar(char* str);
char* StrRange(char* str, const char begin, const char end, char** buf);
int CStrToInt(char* string);
bool IsDigitalStr(char* string);
const char* TradeTypeStr(int trade_type);
const char* TradeCmdStr(int trade_cmd);
const char* OrderTypeStr(int order_type);
//--- "OP_BUY", "OP_SELL", "OP_BUY_LIMIT", "OP_SELL_LIMIT", "OP_BUY_STOP", "OP_SELL_STOP"
int ToCmd(const char* cmd_str, int default_value = -1);
//--- TS_OPEN_NORMAL, TS_OPEN_REMAND, TS_OPEN_RESTORED, TS_CLOSED_NORMAL, TS_CLOSED_PART, TS_CLOSED_BY, TS_DELETED
const char* ToTradeRecordStateStr(int state);
inline int ToCmd(std::string cmd_str, int default_value = -1) {
return ToCmd(cmd_str.c_str(), default_value);
}
int GetSpreadDiff(int login, const char* symbol);
#endif // !_COMMON_H_