autoapi

package
v1.0.3-0...-554643c Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTicker

func AllTicker()

func BatchOrder

func BatchOrder(market string, tradeType TradeType, tradeParams [][]decimal.Decimal, opts ...Option[*Values])

func CancelAllOrders

func CancelAllOrders(market string, opts ...Option[*Values]) any

func DepositAddress

func DepositAddress(currency string)

func HmacMD5

func HmacMD5(message, secretKey string) (hmacSign string)

HmacMD5 MD5

func Markets

func Markets() map[string]MarketConfig

func TickerData

func TickerData(market string)

func UserInfo

func UserInfo()

Types

type Account

type Account struct {
	Account   string `yaml:"account"`
	AccessKey string `yaml:"accessKey"`
	SecretKey string `yaml:"secretKey"`
	API       string `yaml:"api"`
	Trade     string `yaml:"trade"`
	KLine     string `yaml:"kline"`
	WSAPI     string `yaml:"wsapi"`
}
var (
	DefaultAccount *Account
)

type AccountType

type AccountType string
const (
	AccountTypeMain  AccountType = "0"
	AccountTypeLever AccountType = "1"
	AccountTypeCross AccountType = "2"
)

type Config

type Config struct {
	Current  string    `yaml:"current"`
	Accounts []Account `yaml:"accounts"`
}

type MarketConfig

type MarketConfig struct {
	AmountScale decimal.Decimal `json:"amountScale"`
	MinAmount   decimal.Decimal `json:"minAmount"`
	MinSize     decimal.Decimal `json:"minSize"`
	PriceScale  decimal.Decimal `json:"priceScale"`
}

type Option

type Option[T any] func(T)

func WithAccount

func WithAccount(account *Account) Option[*Values]

func WithAcctType

func WithAcctType(acctType AccountType) Option[*Values]

func WithAmount

func WithAmount(amount decimal.Decimal) Option[*Values]

func WithContinueErr

func WithContinueErr() Option[*Values]

func WithCurrency

func WithCurrency(currency string) Option[*Values]

func WithCurrencyMarket

func WithCurrencyMarket(market string) Option[*Values]

func WithCustomerOrderId

func WithCustomerOrderId(orderId string) Option[*Values]

func WithEnableExpress

func WithEnableExpress() Option[*Values]

func WithEnableRepay

func WithEnableRepay() Option[*Values]

func WithMarket

func WithMarket(market string) Option[*Values]

func WithObj

func WithObj(key string, obj any) Option[*Values]

func WithOrderType

func WithOrderType(orderType OrderType) Option[*Values]

func WithPrice

func WithPrice(price decimal.Decimal) Option[*Values]

func WithTrade

func WithTrade() Option[*Values]

func WithTradeType

func WithTradeType(tradeType TradeType) Option[*Values]

type OrderResp

type OrderResp struct {
	Response `json:",inline"`
	ID       string `json:"ID,omitempty"`
}

func Order

func Order(market string, price, amount decimal.Decimal, tradeType TradeType, opts ...Option[*Values]) OrderResp

Order spot trade

Optional parameters:
WithAcctType: default AccountTypeMain
WithEnableExpress: default false
WithEnableRepay: default false
WithOrderType: default OrderTypeLimit
WithCustomerOrderId: default ""

func QueueOrder

func QueueOrder(market string, price, amount decimal.Decimal, tradeType TradeType, opts ...Option[*Values]) OrderResp

type OrderType

type OrderType string
const (
	OrderTypeLimit    OrderType = "0"
	OrderTypePostOnly OrderType = "1"
	OrderTypeIoc      OrderType = "2"
)

type Response

type Response struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type Ticker

type Ticker struct {
	Date   string      `json:"date"`
	Ticker TickerModel `json:"ticker"`
}

type TickerModel

type TickerModel struct {
	High     decimal.Decimal `json:"high"`
	Vol      decimal.Decimal `json:"vol"`
	Last     decimal.Decimal `json:"last"`
	Low      decimal.Decimal `json:"low"`
	Buy      decimal.Decimal `json:"buy"`
	Sell     decimal.Decimal `json:"sell"`
	Turnover decimal.Decimal `json:"turnover"`
	Open     decimal.Decimal `json:"open"`
	RiseRate decimal.Decimal `json:"riseRate"`
}

type Tickers

type Tickers map[string]TickerModel

type TradeType

type TradeType string
const (
	TradeTypeSell         TradeType = "0"
	TradeTypeBuy          TradeType = "1"
	TradeTypePostOnlySell TradeType = "2"
	TradeTypePostOnlyBuy  TradeType = "3"
	TradeTypeIocSell      TradeType = "4"
	TradeTypeIocBuy       TradeType = "5"
)

func ReverseTradeType

func ReverseTradeType(types int) TradeType

func TradeTypeByInt

func TradeTypeByInt(types int) TradeType

func (TradeType) String

func (tt TradeType) String() string

type Values

type Values struct {
	*Account
	url.Values
	URL string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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