mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* bithumb: Add websocket support (WIP) * bithumb: cont impl. * bithumb: finish, issues with orderbook needs review * linter issues * bithumb: move to separate file * bithumb: change to pointer for book * bithumb: Add tests * bithumb: Address nits * websocket: Export subscription error and wrap returns * bithumb: cleanup/ fix tests * gctrpc/bithumb: fix misspelling * bithumb: gofmt * readme: update support table, regen doc * tradesReadme: update * readme: update template
32 lines
632 B
Go
32 lines
632 B
Go
package bithumb
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
// bithumbMSTime provides an internal conversion helper for microsecond parsing
|
|
type bithumbTime time.Time
|
|
|
|
// UnmarshalJSON implements the unmarshal interface
|
|
func (t *bithumbTime) UnmarshalJSON(data []byte) error {
|
|
var timestamp string
|
|
if err := json.Unmarshal(data, ×tamp); err != nil {
|
|
return err
|
|
}
|
|
|
|
i, err := strconv.ParseInt(timestamp, 10, 64)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*t = bithumbTime(time.Unix(0, i*int64(time.Microsecond)))
|
|
return nil
|
|
}
|
|
|
|
// Time returns a time.Time object
|
|
func (t bithumbTime) Time() time.Time {
|
|
return time.Time(t)
|
|
}
|