price

package
v0.0.5-alpha.9-b Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MULTIPLIER           = uint64(1000000000)
	LUNA_PRICE_CALLDATA  = LunaPriceCallData{Multiplier: MULTIPLIER}
	LUNA_PRICE_END_POINT = fmt.Sprintf("/oracle/request_search?oid=13&calldata=%x&min_count=10&ask_count=16", LUNA_PRICE_CALLDATA.toBytes())
)

Functions

func Decode

func Decode(data []byte, v ...interface{}) error

Decode uses obi encoding scheme to decode the given input(s).

func DecodeBytes

func DecodeBytes(data []byte) ([]byte, []byte, error)

DecodeBytes decodes the input bytes and returns bytes result and the remaining bytes.

func DecodeSigned16

func DecodeSigned16(data []byte) (int16, []byte, error)

DecodeSigned16 decodes the input bytes into `uint64` and returns the remaining bytes.

func DecodeSigned32

func DecodeSigned32(data []byte) (int32, []byte, error)

DecodeSigned32 decodes the input bytes into `uint64` and returns the remaining bytes.

func DecodeSigned64

func DecodeSigned64(data []byte) (int64, []byte, error)

DecodeSigned64 decodes the input bytes into `uint64` and returns the remaining bytes.

func DecodeSigned8

func DecodeSigned8(data []byte) (int8, []byte, error)

DecodeSigned8 decodes the input bytes into `uint64` and returns the remaining bytes.

func DecodeString

func DecodeString(data []byte) (string, []byte, error)

DecodeString decodes the input bytes and returns string result and the remaining bytes.

func DecodeUnsigned16

func DecodeUnsigned16(data []byte) (uint16, []byte, error)

DecodeUnsigned16 decodes the input bytes into `uint16` and returns the remaining bytes.

func DecodeUnsigned32

func DecodeUnsigned32(data []byte) (uint32, []byte, error)

DecodeUnsigned32 decodes the input bytes into `uint32` and returns the remaining bytes.

func DecodeUnsigned64

func DecodeUnsigned64(data []byte) (uint64, []byte, error)

DecodeUnsigned64 decodes the input bytes into `uint64` and returns the remaining bytes.

func DecodeUnsigned8

func DecodeUnsigned8(data []byte) (uint8, []byte, error)

DecodeUnsigned8 decodes the input bytes into `uint8` and returns the remaining bytes.

func Encode

func Encode(v ...interface{}) ([]byte, error)

Encode uses obi encoding scheme to encode the given input(s) into bytes.

func EncodeBytes

func EncodeBytes(v []byte) []byte

EncodeBytes takes a `[]byte` variable and encodes it into a byte array

func EncodeSigned16

func EncodeSigned16(v int16) []byte

EncodeSigned16 takes an `int16` variable and encodes it into a byte array

func EncodeSigned32

func EncodeSigned32(v int32) []byte

EncodeSigned32 takes an `int32` variable and encodes it into a byte array

func EncodeSigned64

func EncodeSigned64(v int64) []byte

EncodeSigned64 takes an `int64` variable and encodes it into a byte array

func EncodeSigned8

func EncodeSigned8(v int8) []byte

EncodeSigned8 takes an `int8` variable and encodes it into a byte array

func EncodeString

func EncodeString(v string) []byte

EncodeString takes a `string` variable and encodes it into a byte array

func EncodeUnsigned16

func EncodeUnsigned16(v uint16) []byte

EncodeUnsigned16 takes an `uint16` variable and encodes it into a byte array

func EncodeUnsigned32

func EncodeUnsigned32(v uint32) []byte

EncodeUnsigned32 takes an `uint32` variable and encodes it into a byte array

func EncodeUnsigned64

func EncodeUnsigned64(v uint64) []byte

EncodeUnsigned64 takes an `uint64` variable and encodes it into a byte array

func EncodeUnsigned8

func EncodeUnsigned8(v uint8) []byte

EncodeUnsigned8 takes an `uint8` variable and encodes it into a byte array

func GetSchema

func GetSchema(v interface{}) (string, error)

GetSchema returns the compact OBI individual schema of the given value.

func MustDecode

func MustDecode(data []byte, v ...interface{})

MustDecode uses obi encoding scheme to decode the given input. Panics on error.

func MustEncode

func MustEncode(v ...interface{}) []byte

MustEncode uses obi encoding scheme to encode the given input into bytes. Panics on error.

func MustGetSchema

func MustGetSchema(v interface{}) string

MustGetSchema returns the compact OBI individual schema of the given value. Panics on error.

Types

type APILayerResponse

type APILayerResponse struct {
	Success   bool               `json:"success"`
	Terms     string             `json:"terms"`
	Privacy   string             `json:"privacy"`
	Timestamp int64              `json:"timestamp"`
	Source    string             `json:"source"`
	Quotes    map[string]float64 `json:"quotes"`
}

APILayerResponse response body from currencylayer

type BandResponse

type BandResponse struct {
	Height int64      `json:"height,string"`
	Result BandResult `json:"result"`
}

type BandResult

type BandResult struct {
	Request Request   `json:"request"`
	Reports []Reports `json:"reports"`
	Result  Packet    `json:"result"`
}

type BinancePrice

type BinancePrice struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

BinancePrice response from binance

type FxResponse

type FxResponse struct {
	Height string   `json:"height"`
	Result []Result `json:"result"`
}

type LunaPrice

type LunaPrice struct {
	OrderBooks []OrderBook `json:"order_books"`
}

type LunaPriceCallData

type LunaPriceCallData struct {
	Multiplier uint64
}

type OrderBook

type OrderBook struct {
	Ask int64 `json:"ask"`
	Bid int64 `json:"bid"`
	Mid int64 `json:"mid"`
}

type Packet

type Packet struct {
	RequestPacketData  RequestPacketData  `json:"request_packet_data"`
	ResponsePacketData ResponsePacketData `json:"response_packet_data"`
}

type PriceService

type PriceService struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewPriceService

func NewPriceService() *PriceService

func (*PriceService) GetPrice

func (ps *PriceService) GetPrice(market string) sdk.DecCoin

func (*PriceService) OnStart

func (ps *PriceService) OnStart() error

func (*PriceService) SetPrice

func (ps *PriceService) SetPrice(market string, coin sdk.DecCoin, timestamp int64)

type PriceWithTimestamp

type PriceWithTimestamp struct {
	Px        sdk.DecCoin
	Timestamp int64
}

type RawReports

type RawReports struct {
	ExternalID uint64 `json:"external_id,string"`
	Data       string `json:"data"`
}

type RawRequests

type RawRequests struct {
	ExternalID   uint64 `json:"external_id,string"`
	DataSourceID uint64 `json:"data_source_id,string"`
	Calldata     []byte `json:"calldata,string"`
}

type Reports

type Reports struct {
	Validator       string       `json:"validator"`
	InBeforeResolve bool         `json:"in_before_resolve"`
	RawReports      []RawReports `json:"raw_reports"`
}

type Request

type Request struct {
	OracleScriptID      uint64        `json:"oracle_script_id,string"`
	Calldata            []byte        `json:"calldata,string"`
	RequestedValidators []string      `json:"requested_validators"`
	MinCount            uint64        `json:"min_count,string"`
	RequestHeight       uint64        `json:"request_height,string"`
	RequestTime         time.Time     `json:"request_time"`
	ClientID            string        `json:"client_id"`
	RawRequests         []RawRequests `json:"raw_requests"`
}

type RequestPacketData

type RequestPacketData struct {
	ClientID       string `json:"client_id"`
	OracleScriptID uint64 `json:"oracle_script_id,string"`
	Calldata       []byte `json:"calldata,string"`
	AskCount       uint64 `json:"ask_count,string"`
	MinCount       uint64 `json:"min_count,string"`
}

type ResponsePacketData

type ResponsePacketData struct {
	ClientID      string `json:"client_id"`
	RequestID     uint64 `json:"request_id,string"`
	AnsCount      uint64 `json:"ans_count,string"`
	RequestTime   uint64 `json:"request_time,string"`
	ResolveTime   uint64 `json:"resolve_time,string"`
	ResolveStatus uint8  `json:"resolve_status"`
	Result        []byte `json:"result,string"`
}

type Result

type Result struct {
	Symbol      string  `json:"symbol"`
	Multiplier  float64 `json:"multiplier,string"`
	Px          float64 `json:"px,string"`
	RequestID   string  `json:"request_id"`
	ResolveTime int64   `json:"resolve_time,string"`
}

type Ticker_bithumb

type Ticker_bithumb struct {
	Data struct {
		Closing_price string `json:"closing_price"`
		Date          string `json:"date"`
	}
}

for bithumn

type Trade

type Trade struct {
	Timestamp     uint64 `json:"timestamp"`
	Price         string `json:"price"`
	Volume        string `json:"volume"`
	IsSellerMaker bool   `json:"is_seller_maker"`
}

Trade response from coinone

type TradeHistory

type TradeHistory struct {
	Trades []Trade `json:"trades"`
}

TradeHistory response from coinone

Jump to

Keyboard shortcuts

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