f1exapi

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderSideASK = "ASK"
	OrderSideBID = "BID"

	OrderTypeLimit  = "LIMIT"
	OrderTypeMarket = "MARKET"

	OrderStatePending = "PENDING"
	OrderStateDone    = "DONE"

	TransferSourceCancel = "CANCEL"
	TransferSourceRefund = "REFUND"
	TransferSourceMatch  = "MATCH"

	TradeSideMaker = "MAKER"
	TradeSideTaker = "TAKER"
)
View Source
const (
	Endpoint = "https://exchange.fox.one"
)

Variables

This section is empty.

Functions

func EncodeAuthMemo added in v1.1.10

func EncodeAuthMemo(key crypto.PublicKey) (string, error)

func SignToken

func SignToken(claim Claim, key interface{}) (string, error)

SignToken with ecdsa private key

func UseEndpoint added in v1.2.1

func UseEndpoint(endpoint string)

Types

type AssetTicker added in v1.3.3

type AssetTicker struct {
	AssetID string `json:"asset_id"`
	Symbol  string `json:"symbol"`

	Volume    decimal.Decimal `json:"volume"`
	Price     decimal.Decimal `json:"price"`
	Change    decimal.Decimal `json:"change"`
	PriceUSD  decimal.Decimal `json:"price_usd"`
	ChangeUSD decimal.Decimal `json:"change_usd"`
	PriceBTC  decimal.Decimal `json:"price_btc"`
	ChangeBTC decimal.Decimal `json:"change_btc"`
}

func ReadAssetTickers added in v1.3.3

func ReadAssetTickers(ctx context.Context) ([]*AssetTicker, error)

type Claim

type Claim struct {
	jwt.StandardClaims
	MerchantID string `json:"mid,omitempty"`
	UserID     string `json:"uid,omitempty"`
}

type Order added in v1.2.1

type Order struct {
	OrderID         string          `json:"id"`
	CreatedAt       int64           `json:"created_at"`
	OrderType       string          `json:"order_type"`
	UserID          string          `json:"user_id"`
	QuoteAssetID    string          `json:"quote_asset_id"`
	BaseAssetID     string          `json:"base_asset_id"`
	Symbol          string          `json:"symbol"`
	Side            string          `json:"side"`
	Price           decimal.Decimal `json:"price"`
	RemainingAmount decimal.Decimal `json:"remaining_amount"`
	FilledAmount    decimal.Decimal `json:"filled_amount"`
	RemainingFunds  decimal.Decimal `json:"remaining_fund"`
	FilledFunds     decimal.Decimal `json:"filled_fund"`
	State           string          `json:"state"`
}

func QueryOrder added in v1.2.4

func QueryOrder(ctx context.Context, token, orderID string) (*Order, error)

func QueryOrders added in v1.2.1

func QueryOrders(ctx context.Context, token string, input *QueryOrdersInput) ([]*Order, *pagination.Pagination, error)

type OrderAction

type OrderAction struct {
	S string    // side
	A uuid.UUID // asset
	P string    // price
	T string    // type
	M uuid.UUID // merchant
}

func ParsePutOrder added in v1.1.7

func ParsePutOrder(memo string) (*OrderAction, error)

func (*OrderAction) Encode

func (action *OrderAction) Encode() (string, error)

type PutOrderInput

type PutOrderInput struct {
	Base       string `valid:"uuid,required"`
	Quote      string `valid:"uuid,required"`
	Side       string `valid:"in(ASK|BID),required"`
	Type       string `valid:"in(LIMIT|MARKET),required"`
	Price      string
	MerchantID string `valid:"uuid"`
}

type PutOrderOutput

type PutOrderOutput struct {
	AssetID  string
	Memo     string
	Opponent string
}

func PutOrder

func PutOrder(input *PutOrderInput) (*PutOrderOutput, error)

type QueryOrdersInput added in v1.2.1

type QueryOrdersInput struct {
	Symbol string
	Side   string
	Cursor string
	Limit  int
	Order  string
	State  string
	Start  int64 // 单位秒
	End    int64 // 单位秒
}

type TransferAction

type TransferAction struct {
	S string    // source
	O uuid.UUID // order
	A uuid.UUID // asset id
	P string    // price
	C string    // category, bid or ask
}

func ParseTransfer

func ParseTransfer(memo string) (*TransferAction, error)

Jump to

Keyboard shortcuts

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