-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdependencies.py
149 lines (133 loc) · 3.4 KB
/
dependencies.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
from pydantic import BaseModel
from enum import Enum
from decimal import Decimal
# ==========
# Pydantics Database Schema
# ==========
class DataParam(BaseModel):
index: int
param: str
value: str
class Config:
from_attributes = True
class ListCode(BaseModel):
index: int
code: str
value: Decimal | None = None
frequency: Decimal | None = None
foreignsellval: Decimal | None = None
foreignbuyval: Decimal | None = None
class Config:
from_attributes = True
# ==========
# Metadata Tags
# ==========
class ExternalDocs(BaseModel):
description:str | None
url:str
class MetadataTag(BaseModel):
name:str
description:str | None
external_docs:ExternalDocs | None
class Tags(Enum):
chart = MetadataTag(
name="chart",
description="Generate chart by plotly, return plotly fig in json format as default, or png, jpeg, jpg, webp, and svg",
external_docs=None
)
radar = MetadataTag(
name="radar",
description="Generate radar by plotly, return plotly fig in json format as default, or png, jpeg, jpg, webp, and svg",
external_docs=None
)
screener = MetadataTag(
name="screener",
description="Find the list of stocks based on modifiable screener rules templates",
external_docs=None
)
full_data = MetadataTag(
name="full_data",
description="Return full data of processed indicator from analysis in json format transformed from pandas dataframe",
external_docs=None
)
# ==========
# Parameter Class
# ==========
class ListCategory(str,Enum):
broker = "broker"
index = "index" # type: ignore
stock = "stock"
class ListMediaType(str,Enum):
png = "png"
jpeg = "jpeg"
jpg = "jpg"
webp = "webp"
svg = "svg"
json = "json"
class ListRadarType(str,Enum):
correlation = "correlation"
changepercentage = "changepercentage"
class ListBrokerApiType(str, Enum):
all = "all"
brokerflow = "brokerflow"
brokercluster = "brokercluster"
class AnalysisMethod(str, Enum):
foreign = "foreign"
broker = "broker"
class ClusteringMethod(str, Enum):
correlation = "correlation"
timeseries = "timeseries"
class ScreenerList(str, Enum):
most_accumulated = "most_accumulated"
most_distributed = "most_distributed"
vwap_rally = "vwap_rally"
vwap_around = "vwap_around"
vwap_breakout = "vwap_breakout"
vwap_breakdown = "vwap_breakdown"
vprofile_inside = "vprofile_inside"
class HoldingSectors(str, Enum):
# Dictionary:
# IS: Insurance
# CP: Corporate
# PF: Pension Fund
# IB: Financial Instution (Investment Bank)
# ID: Individual
# MF: Mutual Fund
# SC: Securities Company
# FD: Foundation
# OT: Others
local_is = "local_is"
local_cp = "local_cp"
local_pf = "local_pf"
local_ib = "local_ib"
local_id = "local_id"
local_mf = "local_mf"
local_sc = "local_sc"
local_fd = "local_fd"
local_ot = "local_ot"
local_total = "local_total"
foreign_is = "foreign_is"
foreign_cp = "foreign_cp"
foreign_pf = "foreign_pf"
foreign_ib = "foreign_ib"
foreign_id = "foreign_id"
foreign_mf = "foreign_mf"
foreign_sc = "foreign_sc"
foreign_fd = "foreign_fd"
foreign_ot = "foreign_ot"
foreign_total = "foreign_total"
class HoldingSectorsCat(dict, Enum):
default = {
"foreign": [HoldingSectors.foreign_total],
"local_institutional": [
HoldingSectors.local_is,
HoldingSectors.local_cp,
HoldingSectors.local_pf,
HoldingSectors.local_ib,
HoldingSectors.local_mf,
HoldingSectors.local_sc,
HoldingSectors.local_fd,
HoldingSectors.local_ot,
],
"local_individual": [HoldingSectors.local_id]
}