models

package
v0.0.0-...-5f382f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const JSONTimeFormat = time.RFC3339

Variables

View Source
var CandleResolutionMap = map[CandleResolution]struct{}{
	Minute:         {},
	FiveMinutes:    {},
	FifteenMinutes: {},
	Day:            {},
	Week:           {},
	Month:          {},
}

Functions

This section is empty.

Types

type Candle

type Candle struct {
	Symbol     string           `json:"symbol"`
	Resolution CandleResolution `json:"resolution"`
	From       time.Time        `json:"from"`
	To         time.Time        `json:"to"`

	Data CandleData `json:"data"`
}

type CandleData

type CandleData struct {
	// Open - open prices
	Open []float32 `json:"open"`

	// Close - close prices
	Close []float32 `json:"close"`

	// High - high prices
	High []float32 `json:"high"`

	// Low - low prices
	Low []float32 `json:"low"`

	// Volume - volume data
	Volume []int `json:"volume"`

	// List of timestamps in UNIX format
	Timestamps []int64 `json:"timestamps"`
}

type CandleRPCRequest

type CandleRPCRequest struct {
	Symbol     string           `json:"symbol"`
	Resolution CandleResolution `json:"resolution"`

	// From - UNIX time
	From int64 `json:"from"`

	// To - UNIX time
	To int64 `json:"to"`
}

type CandleRabbit

type CandleRabbit struct {
	// Open - open prices
	Open []float32 `json:"o"`

	// Close - close prices
	Close []float32 `json:"c"`

	// High - high prices
	High []float32 `json:"h"`

	// Low - low prices
	Low []float32 `json:"l"`

	// Volume - volume data
	Volume []int `json:"v"`

	// List of timestamps in UNIX format
	Timestamps []int64 `json:"t"`

	// Status of the response.
	// This field can either be `ok` or `no_data`.
	Status string `json:"s"`
}

func (CandleRabbit) ToCandleData

func (cr CandleRabbit) ToCandleData() CandleData

type CandleRequest

type CandleRequest struct {
	Resolution CandleResolution `json:"resolution" validate:"candle_resolution"`
	From       *JSONTime        `json:"from" validate:"required,gte"`
	To         *JSONTime        `json:"to" validate:"required,gte,ltefield=From"`
}

type CandleResolution

type CandleResolution string
const (
	Minute         CandleResolution = "1"
	FiveMinutes    CandleResolution = "5"
	FifteenMinutes CandleResolution = "15"
	Day            CandleResolution = "D"
	Week           CandleResolution = "W"
	Month          CandleResolution = "M"
)

type Exchange

type Exchange struct {
	Code     string `json:"code"`
	Currency string `json:"currency"`
	Name     string `json:"name"`
}

type JSONTime

type JSONTime time.Time

func (*JSONTime) MarshalJSON

func (t *JSONTime) MarshalJSON() ([]byte, error)

func (JSONTime) Time

func (t JSONTime) Time() time.Time

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(b []byte) error

type Symbol

type Symbol struct {
	ID uuid.UUID `json:"id"`

	Description   string `json:"description"`
	DisplaySymbol string `json:"displaySymbol"`
	Symbol        string `json:"symbol"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL