-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstock.go
46 lines (43 loc) · 1.18 KB
/
stock.go
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
package krx
type Stock struct {
Quote string
UpDown UpDown
DayOverDay string
PreviousClose string
Volume string
TradingValue string
StartValue string
Low string
High string
Low52Week string
High52week string
UpperLimit string
LowerLimit string
ListedShares string
FaceValue string
PER string
}
func GetStockBySymbol(symbol string) (*Stock, error) {
s, err := getStockInfoBySymbol(symbol)
if err != nil {
return nil, err
}
return &Stock{
Quote: s.TBLStockInfo.CurJuka,
UpDown: castToUpDown(s.TBLStockInfo.DungRak),
DayOverDay: s.TBLStockInfo.Debi,
PreviousClose: s.TBLStockInfo.PrevJuka,
Volume: s.TBLStockInfo.Volume,
TradingValue: s.TBLStockInfo.Money,
StartValue: s.TBLStockInfo.StartJuka,
Low: s.TBLStockInfo.LowJuka,
High: s.TBLStockInfo.HighJuka,
Low52Week: s.TBLStockInfo.Low52,
High52week: s.TBLStockInfo.High52,
UpperLimit: s.TBLStockInfo.UpJuka,
LowerLimit: s.TBLStockInfo.DownJuka,
ListedShares: s.TBLStockInfo.Amount,
FaceValue: s.TBLStockInfo.FaceJuka,
PER: s.TBLStockInfo.Per,
}, nil
}