Documentation ¶
Index ¶
- func CalcSpread(bidMax float64, askMin float64) (spread float64, midPoint float64)
- func GetAssetString(assetType string, code string, issuer string) string
- func PanicIfError(e error)
- func Retry(numRetries int, delay time.Duration, logger *hlog.Entry, f func() error) error
- func SliceDiff(a, b []string) (diff []string)
- func TimeToRFC3339(t time.Time) string
- func TimeToUnixEpoch(t time.Time) int64
- func WriteJSONToFile(jsonBytes []byte, filename string) (numBytes int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcSpread ¶
CalcSpread calculates the spread stats for the given bidMax and askMin orderbook values
func GetAssetString ¶
GetAssetString returns a string representation of an asset
func PanicIfError ¶
func PanicIfError(e error)
PanicIfError is an utility function that panics if err != nil
func Retry ¶
Retry retries running a function that returns an error numRetries times, multiplying the sleep time by a factor of 2 each time it retries.
func TimeToRFC3339 ¶
TimeToRFC3339 converts a time.Time to a string in RFC3339 format
func TimeToUnixEpoch ¶
TimeToTimestamp converts a time.Time into a Unix epoch
func WriteJSONToFile ¶
WriteJSONToFile atomically writes a json []byte dump to <filename> It ensures atomicity by first creating a tmp file (filename.tmp), writing the contents to it, then renaming it to the originally specified filename.
Types ¶
This section is empty.