/
exceptions.py
86 lines (56 loc) · 1.31 KB
/
exceptions.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: utf-8 -*-
"""
exceptions in xalpha packages
"""
class XalphaException(Exception):
pass
class FundTypeError(XalphaException):
"""
The code mismatches the fund type obj, fundinfo/mfundinfo
"""
pass
class FundNotExistError(XalphaException):
"""
There is no fund with given code
"""
pass
class TradeBehaviorError(XalphaException):
"""
Used for unreal trade attempt, such as selling before buying
"""
pass
class ParserFailure(XalphaException):
"""
Used for exception when parsing fund APIs
"""
pass
class DataSourceNotFound(XalphaException):
"""
Used when authentication required data source is not ready to use
"""
pass
class DataPossiblyWrong(XalphaException):
"""
Used for data failed to verify
"""
pass
class DateMismatch(XalphaException):
"""
Used for lof prediction
"""
def __init__(self, code, reason=""):
self.code = code
self.reason = reason
def __repr__(self):
return self.reason
__str__ = __repr__
class NonAccurate(XalphaException):
"""
Used for lof prediction
"""
def __init__(self, code, reason=""):
self.code = code
self.reason = reason
def __repr__(self):
return self.reason
__str__ = __repr__