tiki

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 12 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"`
}

func (Order) Hash added in v0.1.0

func (ord Order) Hash() common.Hash

type OrderType

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

type Orders added in v0.1.0

type Orders []*Order

func (Orders) Amount added in v0.1.0

func (ord Orders) Amount() float64

Amount returns the total amounts of the given Orders.

func (Orders) AmountByType added in v0.1.0

func (ord Orders) AmountByType(side OrderType) float64

AmountByType returns the total amounts of the given Orders by OrderType.

func (Orders) Count added in v0.1.0

func (ord Orders) Count() int

func (Orders) ToSlice added in v0.1.0

func (ord Orders) ToSlice() []*Order

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