mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 07:26:46 +00:00
Added fetching currency exchange rate and conversion support.
This commit is contained in:
29
itbithttp.go
29
itbithttp.go
@@ -24,14 +24,35 @@ type ItBit struct {
|
||||
ClientKey, APISecret, UserID string
|
||||
}
|
||||
|
||||
func (i *ItBit) GetTicker(currency string) (bool) {
|
||||
type ItBitTicker struct {
|
||||
Pair string
|
||||
Bid float64 `json:",string"`
|
||||
BidAmt float64 `json:",string"`
|
||||
Ask float64 `json:",string"`
|
||||
AskAmt float64 `json:",string"`
|
||||
LastPrice float64 `json:",string"`
|
||||
LastAmt float64 `json:",string"`
|
||||
Volume24h float64 `json:",string"`
|
||||
VolumeToday float64 `json:",string"`
|
||||
High24h float64 `json:",string"`
|
||||
Low24h float64 `json:",string"`
|
||||
HighToday float64 `json:",string"`
|
||||
LowToday float64 `json:",string"`
|
||||
OpenToday float64 `json:",string"`
|
||||
VwapToday float64 `json:",string"`
|
||||
Vwap24h float64 `json:",string"`
|
||||
ServertimeUTC string
|
||||
}
|
||||
|
||||
func (i *ItBit) GetTicker(currency string) (ItBitTicker) {
|
||||
path := ITBIT_API_URL + "/markets/" + currency + "/ticker"
|
||||
err := SendHTTPRequest(path, true, nil)
|
||||
var itbitTicker ItBitTicker
|
||||
err := SendHTTPRequest(path, true, &itbitTicker)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return false
|
||||
return ItBitTicker{}
|
||||
}
|
||||
return true
|
||||
return itbitTicker
|
||||
}
|
||||
|
||||
func (i *ItBit) GetOrderbook(currency string) (bool) {
|
||||
|
||||
Reference in New Issue
Block a user