cons

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPEN_BUY   = 1 + iota //开多
	OPEN_SELL             //开空
	CLOSE_BUY             //平多
	CLOSE_SELL            //平空
)
View Source
const (
	KLINE_PERIOD_1MIN = 1 + iota
	KLINE_PERIOD_3MIN
	KLINE_PERIOD_5MIN
	KLINE_PERIOD_15MIN
	KLINE_PERIOD_30MIN
	KLINE_PERIOD_60MIN
	KLINE_PERIOD_1H
	KLINE_PERIOD_2H
	KLINE_PERIOD_3H
	KLINE_PERIOD_4H
	KLINE_PERIOD_6H
	KLINE_PERIOD_8H
	KLINE_PERIOD_12H
	KLINE_PERIOD_1DAY
	KLINE_PERIOD_3DAY
	KLINE_PERIOD_1WEEK
	KLINE_PERIOD_1MONTH
	KLINE_PERIOD_1YEAR
)

k线周期

View Source
const (
	ORDER_FEATURE_ORDINARY = iota
	ORDER_FEATURE_POST_ONLY
	ORDER_FEATURE_FOK
	ORDER_FEATURE_IOC
	ORDER_FEATURE_FAK
	ORDER_FEATURE_LIMIT
)
View Source
const (
	ORDER_TYPE_LIMIT = 1 + iota
	ORDER_TYPE_MARKET
)
View Source
const (
	SUB_ACCOUNT         = iota         //子账户
	SPOT                               // 币币交易
	FUTURE              = 1 + iota     //交割合约
	C2C                                //法币
	SPOT_MARGIN                        //币币杠杆交易
	WALLET                             // 资金账户
	TIPS                = 2 + iota     //余币宝
	SWAP                               //永续合约
	SWAP_USDT                          //usdt本位永续合约
	THIS_WEEK_CONTRACT  = "this_week"  //周合约
	NEXT_WEEK_CONTRACT  = "next_week"  //次周合约
	QUARTER_CONTRACT    = "quarter"    //季度合约
	BI_QUARTER_CONTRACT = "bi_quarter" // NEXT QUARTER
	SWAP_CONTRACT       = "swap"       //永续合约
	SWAP_USDT_CONTRACT  = "swap-usdt"
	// exchanges const
	KUCOIN          = "kucoin.com"
	OKCOIN_COM      = "okcoin.com"
	OKEX            = "okx.com"
	OKEX_FUTURE     = "okx.com_future"
	OKEX_SWAP       = "okx.com_swap"
	HUOBI           = "huobi.com"
	HUOBI_PRO       = "huobi.pro"
	BITSTAMP        = "bitstamp.net"
	KRAKEN          = "kraken.com"
	BITFINEX        = "bitfinex.com"
	BINANCE         = "binance.com"
	BINANCE_SWAP    = "binance.com_swap"
	BINANCE_FUTURES = "binance.com_futures"
	POLONIEX        = "poloniex.com"
	COINEX          = "coinex.com"
	BITHUMB         = "bithumb.com"
	GATEIO          = "gate.io"
	COINBASE        = "coinbase.com"
	BIGONE          = "big.one"
	FMEX            = "fmex.com"
	HITBTC          = "hitbtc.com"
	BITMEX          = "bitmex.com"
	BITMEX_TEST     = "testnet.bitmex.com"
	CRYPTOPIA       = "cryptopia.co.nz"
	HBDM            = "hbdm.com"
	HBDM_SWAP       = "hbdm.com_swap"
	BITGET_SWAP     = "bitget_swap"
)

Variables

View Source
var (
	UNKNOWN = Currency{"UNKNOWN", ""}
	CNY     = Currency{"CNY", ""}
	USD     = Currency{"USD", ""}
	USDT    = Currency{"USDT", ""}
	PAX     = Currency{"PAX", "https://www.paxos.com/"}
	USDC    = Currency{"USDC", "https://www.centre.io/"}
	EUR     = Currency{"EUR", ""}
	KRW     = Currency{"KRW", ""}
	JPY     = Currency{"JPY", ""}
	BTC     = Currency{"BTC", "https://bitcoin.org/"}
	XBT     = Currency{"XBT", ""}
	BCC     = Currency{"BCC", ""}
	BCH     = Currency{"BCH", ""}
	BCX     = Currency{"BCX", ""}
	LTC     = Currency{"LTC", ""}
	ETH     = Currency{"ETH", ""}
	ETC     = Currency{"ETC", ""}
	EOS     = Currency{"EOS", ""}
	BTS     = Currency{"BTS", ""}
	QTUM    = Currency{"QTUM", ""}
	SC      = Currency{"SC", ""}
	ANS     = Currency{"ANS", ""}
	ZEC     = Currency{"ZEC", ""}
	DCR     = Currency{"DCR", ""}
	XRP     = Currency{"XRP", ""}
	BTG     = Currency{"BTG", ""}
	BCD     = Currency{"BCD", ""}
	NEO     = Currency{"NEO", ""}
	HSR     = Currency{"HSR", ""}
	BSV     = Currency{"BSV", ""}
	OKB     = Currency{"OKB", "OKB is a global utility token issued by OK Blockchain Foundation"}
	HT      = Currency{"HT", "HuoBi Token"}
	BNB     = Currency{"BNB", "BNB, or Binance Coin, is a cryptocurrency created by Binance."}
	TRX     = Currency{"TRX", ""}
	GBP     = Currency{"GBP", ""}
	XLM     = Currency{"XLM", ""}
	DOT     = Currency{"DOT", ""}
	DASH    = Currency{"DASH", ""}
	CRV     = Currency{"CRV", ""}
	ALGO    = Currency{"ALGO", ""}
	//currency pair
	BTC_KRW      = CurrencyPair{CurrencyA: BTC, CurrencyB: KRW, AmountTickSize: 2, PriceTickSize: 1}
	ETH_KRW      = CurrencyPair{CurrencyA: ETH, CurrencyB: KRW, AmountTickSize: 2, PriceTickSize: 2}
	ETC_KRW      = CurrencyPair{CurrencyA: ETC, CurrencyB: KRW, AmountTickSize: 2, PriceTickSize: 2}
	LTC_KRW      = CurrencyPair{CurrencyA: LTC, CurrencyB: KRW, AmountTickSize: 2, PriceTickSize: 2}
	BCH_KRW      = CurrencyPair{CurrencyA: BCH, CurrencyB: KRW, AmountTickSize: 2, PriceTickSize: 2}
	BTC_USD      = CurrencyPair{CurrencyA: BTC, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 1}
	LTC_USD      = CurrencyPair{CurrencyA: LTC, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	ETH_USD      = CurrencyPair{CurrencyA: ETH, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	ETC_USD      = CurrencyPair{CurrencyA: ETC, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	BCH_USD      = CurrencyPair{CurrencyA: BCH, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	XRP_USD      = CurrencyPair{CurrencyA: XRP, CurrencyB: USD, AmountTickSize: 3, PriceTickSize: 3}
	BCD_USD      = CurrencyPair{CurrencyA: BCD, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 3}
	EOS_USD      = CurrencyPair{CurrencyA: EOS, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	BTG_USD      = CurrencyPair{CurrencyA: BTG, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	BSV_USD      = CurrencyPair{CurrencyA: BSV, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	DOT_USD      = CurrencyPair{CurrencyA: DOT, CurrencyB: USD, AmountTickSize: 3, PriceTickSize: 2}
	DASH_USD     = CurrencyPair{CurrencyA: DASH, CurrencyB: USD, AmountTickSize: 2, PriceTickSize: 2}
	CRV_USD      = CurrencyPair{CurrencyA: CRV, CurrencyB: USD, AmountTickSize: 4, PriceTickSize: 3}
	ALGO_USD     = CurrencyPair{CurrencyA: ALGO, CurrencyB: USD, AmountTickSize: 4, PriceTickSize: 4}
	BTC_USDT     = CurrencyPair{CurrencyA: BTC, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 1}
	LTC_USDT     = CurrencyPair{CurrencyA: LTC, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	BCH_USDT     = CurrencyPair{CurrencyA: BCH, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	ETC_USDT     = CurrencyPair{CurrencyA: ETC, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 3}
	ETH_USDT     = CurrencyPair{CurrencyA: ETH, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	BCD_USDT     = CurrencyPair{CurrencyA: BCD, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	NEO_USDT     = CurrencyPair{CurrencyA: NEO, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	EOS_USDT     = CurrencyPair{CurrencyA: EOS, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	XRP_USDT     = CurrencyPair{CurrencyA: XRP, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	HSR_USDT     = CurrencyPair{CurrencyA: HSR, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	BSV_USDT     = CurrencyPair{CurrencyA: BSV, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	OKB_USDT     = CurrencyPair{CurrencyA: OKB, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	HT_USDT      = CurrencyPair{CurrencyA: HT, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 4}
	BNB_USDT     = CurrencyPair{CurrencyA: BNB, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	PAX_USDT     = CurrencyPair{CurrencyA: PAX, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 3}
	TRX_USDT     = CurrencyPair{CurrencyA: TRX, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 3}
	DOT_USDT     = CurrencyPair{CurrencyA: DOT, CurrencyB: USDT, AmountTickSize: 3, PriceTickSize: 2}
	DASH_USDT    = CurrencyPair{CurrencyA: DASH, CurrencyB: USDT, AmountTickSize: 2, PriceTickSize: 2}
	CRV_USDT     = CurrencyPair{CurrencyA: CRV, CurrencyB: USDT, AmountTickSize: 3, PriceTickSize: 3}
	ALGO_USDT    = CurrencyPair{CurrencyA: ALGO, CurrencyB: USDT, AmountTickSize: 3, PriceTickSize: 4}
	XRP_EUR      = CurrencyPair{CurrencyA: XRP, CurrencyB: EUR, AmountTickSize: 2, PriceTickSize: 4}
	BTC_JPY      = CurrencyPair{CurrencyA: BTC, CurrencyB: JPY, AmountTickSize: 2, PriceTickSize: 0}
	LTC_JPY      = CurrencyPair{CurrencyA: LTC, CurrencyB: JPY, AmountTickSize: 2, PriceTickSize: 0}
	ETH_JPY      = CurrencyPair{CurrencyA: ETH, CurrencyB: JPY, AmountTickSize: 2, PriceTickSize: 0}
	ETC_JPY      = CurrencyPair{CurrencyA: ETC, CurrencyB: JPY, AmountTickSize: 2, PriceTickSize: 0}
	BCH_JPY      = CurrencyPair{CurrencyA: BCH, CurrencyB: JPY, AmountTickSize: 2, PriceTickSize: 0}
	LTC_BTC      = CurrencyPair{CurrencyA: LTC, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	ETH_BTC      = CurrencyPair{CurrencyA: ETH, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	ETC_BTC      = CurrencyPair{CurrencyA: ETC, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	BCC_BTC      = CurrencyPair{CurrencyA: BCC, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	BCH_BTC      = CurrencyPair{CurrencyA: BCH, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	DCR_BTC      = CurrencyPair{CurrencyA: DCR, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	XRP_BTC      = CurrencyPair{CurrencyA: XRP, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 6}
	BTG_BTC      = CurrencyPair{CurrencyA: BTG, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	BCD_BTC      = CurrencyPair{CurrencyA: BCD, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	NEO_BTC      = CurrencyPair{CurrencyA: NEO, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	EOS_BTC      = CurrencyPair{CurrencyA: EOS, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 5}
	HSR_BTC      = CurrencyPair{CurrencyA: HSR, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	BSV_BTC      = CurrencyPair{CurrencyA: BSV, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 4}
	OKB_BTC      = CurrencyPair{CurrencyA: OKB, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 6}
	HT_BTC       = CurrencyPair{CurrencyA: HT, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 7}
	BNB_BTC      = CurrencyPair{CurrencyA: BNB, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 6}
	TRX_BTC      = CurrencyPair{CurrencyA: TRX, CurrencyB: BTC, AmountTickSize: 2, PriceTickSize: 7}
	DOT_BTC      = CurrencyPair{CurrencyA: DOT, CurrencyB: BTC, AmountTickSize: 3, PriceTickSize: 6}
	ETC_ETH      = CurrencyPair{CurrencyA: ETC, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	EOS_ETH      = CurrencyPair{CurrencyA: EOS, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	ZEC_ETH      = CurrencyPair{CurrencyA: ZEC, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	NEO_ETH      = CurrencyPair{CurrencyA: NEO, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	HSR_ETH      = CurrencyPair{CurrencyA: HSR, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	LTC_ETH      = CurrencyPair{CurrencyA: LTC, CurrencyB: ETH, AmountTickSize: 2, PriceTickSize: 4}
	UNKNOWN_PAIR = CurrencyPair{CurrencyA: UNKNOWN, CurrencyB: UNKNOWN}
)

Functions

This section is empty.

Types

type Currency

type Currency struct {
	Symbol string
	Desc   string
}

func NewCurrency

func NewCurrency(symbol, desc string) Currency

func (Currency) AdaptBccToBch

func (c Currency) AdaptBccToBch() Currency

func (Currency) AdaptBchToBcc

func (c Currency) AdaptBchToBcc() Currency

func (Currency) Eq

func (c Currency) Eq(c2 Currency) bool

func (Currency) String

func (c Currency) String() string

type CurrencyPair

type CurrencyPair struct {
	CurrencyA      Currency
	CurrencyB      Currency
	AmountTickSize int // 下单量精度
	PriceTickSize  int //交易对价格精度
}

A->B(A兑换为B)

func NewCurrencyPair

func NewCurrencyPair(currencyA Currency, currencyB Currency) CurrencyPair

func NewCurrencyPair2

func NewCurrencyPair2(currencyPairSymbol string) CurrencyPair

func NewCurrencyPair3

func NewCurrencyPair3(currencyPairSymbol string, sep string) CurrencyPair

func (CurrencyPair) AdaptUsdToUsdt

func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair

func (CurrencyPair) AdaptUsdtToUsd

func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair

func (CurrencyPair) Eq

func (pair CurrencyPair) Eq(c2 CurrencyPair) bool

func (CurrencyPair) Reverse

func (pair CurrencyPair) Reverse() CurrencyPair

func (*CurrencyPair) SetAmountTickSize

func (pair *CurrencyPair) SetAmountTickSize(tickSize int) CurrencyPair

func (*CurrencyPair) SetPriceTickSize

func (pair *CurrencyPair) SetPriceTickSize(tickSize int) CurrencyPair

func (CurrencyPair) String

func (pair CurrencyPair) String() string

func (CurrencyPair) ToLower

func (pair CurrencyPair) ToLower() CurrencyPair

for to symbol lower , Not practical '==' operation method

func (CurrencyPair) ToSymbol

func (pair CurrencyPair) ToSymbol(joinChar string) string

func (CurrencyPair) ToSymbol2

func (pair CurrencyPair) ToSymbol2(joinChar string) string

type KlinePeriod

type KlinePeriod int

type LimitOrderOptionalParameter

type LimitOrderOptionalParameter int
const (
	PostOnly LimitOrderOptionalParameter = iota + 1
	Ioc
	Fok
	FuturesTwoWayPositionMode //币安双向持仓模式
)

func (LimitOrderOptionalParameter) String

func (opt LimitOrderOptionalParameter) String() string

type OrderFeature

type OrderFeature int

func (OrderFeature) String

func (of OrderFeature) String() string

type OrderType

type OrderType int

func (OrderType) String

func (ot OrderType) String() string

type TradeSide

type TradeSide int
const (
	BUY TradeSide = 1 + iota
	SELL
	BUY_MARKET
	SELL_MARKET
)

func (TradeSide) String

func (ts TradeSide) String() string

type TradeStatus

type TradeStatus int
const (
	ORDER_UNFINISH TradeStatus = iota
	ORDER_PART_FINISH
	ORDER_FINISH
	ORDER_CANCEL
	ORDER_REJECT
	ORDER_CANCEL_ING
	ORDER_FAIL
)

func (TradeStatus) String

func (ts TradeStatus) String() string

Jump to

Keyboard shortcuts

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