-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
57 lines (52 loc) · 2.07 KB
/
Copy pathtypes.go
File metadata and controls
57 lines (52 loc) · 2.07 KB
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
package altinapi
// Category — altinapi'nin tanımladığı sembol kategorileri.
// String tipinde tutulur; sabit değerler aşağıda.
type Category string
const (
// CategoryDoviz — döviz kurları (USDTRY, EURTRY, ...).
CategoryDoviz Category = "DOVIZ"
// CategoryMaden — değerli metaller (ALTIN, XAUUSD, GUMUSD, PLATIN, PALADYUM).
CategoryMaden Category = "MADEN"
// CategoryParite — uluslararası pariteler (EURUSD, GBPUSD, ...).
CategoryParite Category = "PARITE"
// CategoryGramAltin — ağırlığa göre altın (5/10/20/50/100 gr).
CategoryGramAltin Category = "GRAM ALTIN"
// CategorySarrafiye — Türk sarrafiye altınları (çeyrek, yarım, tam, ata).
CategorySarrafiye Category = "SARRAFIYE"
)
// Price — tek bir sembol için fiyat kaydı.
//
// API yanıtının JSON şekli ile birebir eşleşir. omitempty alanları
// (Description, CreatedAt) server göndermezse boş kalır.
type Price struct {
Symbol string `json:"symbol"`
Category string `json:"category"`
Bid float64 `json:"bid"`
Ask float64 `json:"ask"`
Timestamp string `json:"timestamp"` // ISO 8601
Description string `json:"description,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
// PricesResponse — /prices ve /prices/category endpoint'lerinin yanıt şekli.
type PricesResponse struct {
Data []Price `json:"data"`
UpdatedAt string `json:"updatedAt"`
Stale bool `json:"stale"`
}
// Sunucu tarafından yayınlanan WebSocket olayları.
const (
// EventConnect — bağlantı kuruldu.
EventConnect = "connect"
// EventDisconnect — bağlantı kapandı.
EventDisconnect = "disconnect"
// EventConnectError — bağlantı hatası.
EventConnectError = "connect_error"
// EventPricesSnapshot — bağlantı anında tüm güncel fiyatlar.
EventPricesSnapshot = "prices:snapshot"
// EventPricesUpdate — fiyat değişimi.
EventPricesUpdate = "prices:update"
// EventDataStale — kaynak bağlantısı koptu, veri eski olabilir.
EventDataStale = "data:stale"
// EventDataLive — kaynak yeniden bağlandı.
EventDataLive = "data:live"
)