tiki

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOrderLimit = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsaSummary

type AsaSummary struct {
	At     string    `json:"at"`
	Ticker AsaTicker `json:"ticker"`
}

type AsaTicker

type AsaTicker struct {
	Open               string `json:"open"`
	Last               string `json:"last"`
	Low                string `json:"low"`
	High               string `json:"high"`
	Amount             string `json:"amount"`
	Volume             string `json:"vol"`
	AvgPrice           string `json:"avg_price"`
	PriceChangePercent string `json:"price_change_percent"`
}

type Order

type Order struct {
	ID        uint64    `json:"id"`
	Price     float64   `json:"price"`
	Amount    float64   `json:"amount"`
	Total     float64   `json:"total"`
	Side      OrderType `json:"side"`
	CreatedAt time.Time `json:"createAt"`
}

type OrderType

type OrderType string
const (
	OrderSellType OrderType = "sell"
	OrderBuyType  OrderType = "buy"
)

type TikiClient

type TikiClient struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewTikiClient

func NewTikiClient(cfg TikiClientConfig, log logger.Logger) *TikiClient

func (*TikiClient) GetAsaPrice

func (c *TikiClient) GetAsaPrice(ctx context.Context) (float64, error)

GetAsaPrice returns the price of an ASA on the Tiki Exchange.

func (*TikiClient) GetAsaSummary

func (c *TikiClient) GetAsaSummary(ctx context.Context) (*AsaSummary, error)

GetAsaSummary returns the price summary of Astra on the Tiki Exchange.

func (*TikiClient) GetOrders

func (c *TikiClient) GetOrders(ctx context.Context, limits ...int) ([]Order, error)

GetOrders returns the current newest orders on the Tiki Exchange.

If `limits` is not set, the default number of orders will be returned is DefaultOrderLimit.

func (*TikiClient) LatestOrderID

func (c *TikiClient) LatestOrderID(ctx context.Context) (uint64, error)

func (*TikiClient) ListenToTxs

func (c *TikiClient) ListenToTxs(ctx context.Context, txResult chan interface{}, _ *big.Int)

type TikiClientConfig

type TikiClientConfig struct {
	Endpoint string `json:"Endpoint"`
	Enabled  bool   `json:"Enabled"`
}

func DefaultConfig

func DefaultConfig() TikiClientConfig

func (TikiClientConfig) IsValid

func (cfg TikiClientConfig) IsValid() (bool, error)

IsValid checks if the current EvmClientConfig is valid.

Jump to

Keyboard shortcuts

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