c

package
v0.0.0-...-3744841 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const APIHTTPHOST = "https://api.coinex.com"

APIHTTPHOST api host

View Source
const CONTENTTYPE = "application/json"

CONTENTTYPE http content-type

View Source
const USERAGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"

USERAGENT http User-Agent

Variables

View Source
var (
	Fees = model.Fees{
		MakerTakerRatio:    decimal.RequireFromString("0.003"),
		WithdrawalFlatXCH:  decimal.RequireFromString("0.001"),
		WithdrawalFlatUSDT: decimal.RequireFromString("1.4"),
	}

	AskAddition  = decimal.NewFromInt(1).Add(Fees.MakerTakerRatio)
	BidReduction = decimal.NewFromInt(1).Sub(Fees.MakerTakerRatio)
)

Functions

func Balances

func Balances() (b model.Balances, err error)

func Book

func Book() ([]model.Order, []model.Order, error)

func CancelOrder

func CancelOrder(orderID int64, market string) ([]byte, error)

CancelOrder Cancel unexecuted order

func CreateSubAccount

func CreateSubAccount(name string, allowedIPs []string) ([]byte, error)

CreateSubAccount create sub account

func GetAccount

func GetAccount() ([]byte, error)

GetAccount Inquire account asset constructure

func HTTPDelete

func HTTPDelete(urlHost string, parameters map[string]interface{}) ([]byte, error)

HTTPDelete http get method

func HTTPGet

func HTTPGet(urlHost string, parameters map[string]interface{}) ([]byte, error)

HTTPGet http get method

func HTTPPost

func HTTPPost(urlHost string, parameters map[string]interface{}) ([]byte, error)

HTTPPost http get method

func LoadClient

func LoadClient(conf *config.Config)

func OrderTest

func OrderTest()

func PutLimitOrder

func PutLimitOrder(amount, price, orderType, market string) ([]byte, error)

PutLimitOrder create limit order

func PutMarketOrder

func PutMarketOrder(amount, orderType, market string) ([]byte, error)

PutMarketOrder create market order

func QueryOrderFinished

func QueryOrderFinished(market string, accountID, page, limit int) ([]byte, error)

QueryOrderFinished Acquire executed order list

func QueryOrderPending

func QueryOrderPending(market string, accountID, page, limit int) ([]byte, error)

QueryOrderPending Acquire Unexecuted Order List.

Types

type AssetInfo

type AssetInfo struct {
	Available string `json:"available"`
	Frozen    string `json:"frozen"`
}

AssetInfo asset balance info

type BalanceResp

type BalanceResp struct {
	CommonResp
	AssetBalance map[string]AssetInfo `json:"data"`
}

BalanceResp response for api '/v1/balance/'

type CancelOrderResp

type CancelOrderResp struct {
	CommonResp
	Order OrderInfo `json:"data"`
}

CancelOrderResp cancel order response from server

type CommonResp

type CommonResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

CommonResp common resp: {'code': 0, 'message': 'success'}

type OrderFinishedResp

type OrderFinishedResp struct {
	CommonResp
	Data struct {
		QueryPageInfo
		Orders []OrderInfo `json:"data"`
	} `json:"data"`
}

OrderFinishedResp query finished order response

type OrderInfo

type OrderInfo struct {
	ID           int64  `json:"id"`
	Amount       string `json:"amount"`
	AvgPrice     string `json:"avg_price"`
	CreateTime   int64  `json:"create_time"`
	DealAmount   string `json:"deal_amount"`
	DealFee      string `json:"deal_fee"`
	DealMoney    string `json:"deal_money"`
	FinishedTime int64  `json:"finished_time"`
	MakerFeeRate string `json:"maker_fee_rate"`
	Market       string `json:"market"`
	OrderType    string `json:"order_type"`
	Price        string `json:"price"`
	Status       string `json:"status"`
	TakerFeeRate string `json:"taker_fee_rate"`
	Type         string `json:"type"`
	ClientID     string `json:"client_id"`
}

OrderInfo order base info

type OrderPendingResp

type OrderPendingResp struct {
	CommonResp
	Data struct {
		QueryPageInfo
		Orders []OrderInfo `json:"data"`
	} `json:"data"`
}

OrderPendingResp query pending order response

type OrderResp

type OrderResp struct {
	CommonResp
	Order OrderInfo `json:"data"`
}

OrderResp put limit order response from server

func Buy

func Buy(price, size decimal.Decimal) (*OrderResp, error)

func Sell

func Sell(price, size decimal.Decimal) (*OrderResp, error)

type QueryPageInfo

type QueryPageInfo struct {
	CurrentPage int  `json:"curr_page"`
	Count       int  `json:"count"`
	HasNext     bool `json:"has_next"`
}

QueryPageInfo response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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