bitget

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sym2duo

func Sym2duo(pair string) q.D

Types

type BitgetSwap

type BitgetSwap struct {
	// contains filtered or unexported fields
}

func NewSwap

func NewSwap(config *exws.APIConfig) *BitgetSwap

func (*BitgetSwap) AllTicker

func (bs *BitgetSwap) AllTicker(SymPair map[string]q.D) (mdt *sync.Map, err error)

func (*BitgetSwap) Balances

func (bs *BitgetSwap) Balances() (availables, frozens *sync.Map, err error)

func (*BitgetSwap) Fee

func (bs *BitgetSwap) Fee() float64

func (*BitgetSwap) FeeMap

func (bs *BitgetSwap) FeeMap() (map[string]q.TradeFee, error)

func (*BitgetSwap) FutureCancelOrder

func (bs *BitgetSwap) FutureCancelOrder(currencyPair cons.CurrencyPair, contractType, orderId string) (bool, error)

*

*
* 取消订单
* @param symbol   btc_usd:比特币    ltc_usd :莱特币
* @param contractType    合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度
* @param orderId   订单ID

func (*BitgetSwap) GetAttr

func (bs *BitgetSwap) GetAttr() (a q.Attr)

func (*BitgetSwap) GetContractInfo

func (bs *BitgetSwap) GetContractInfo(pair cons.CurrencyPair) (*Instrument, error)

func (*BitgetSwap) GetContractValue

func (bs *BitgetSwap) GetContractValue(currencyPair cons.CurrencyPair) (float64, error)

*

*获取每张合约价值

func (*BitgetSwap) GetDeliveryTime

func (bs *BitgetSwap) GetDeliveryTime() (int, int, int, int)

*

*获取交割时间 星期(0,1,2,3,4,5,6),小时,分,秒

func (*BitgetSwap) GetFee

func (bs *BitgetSwap) GetFee() (float64, error)

*

*获取交易费

func (*BitgetSwap) GetFutureDepth

func (bs *BitgetSwap) GetFutureDepth(currency cons.CurrencyPair, contractType string, size int) (*exws.Depth, error)

*

  • 期货深度
  • @param currencyPair btc_usd:比特币 ltc_usd :莱特币
  • @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
  • @param size 获取深度档数
  • @return

func (*BitgetSwap) GetFutureEstimatedPrice

func (bs *BitgetSwap) GetFutureEstimatedPrice(currencyPair cons.CurrencyPair) (float64, error)

*

*获取交割预估价

func (*BitgetSwap) GetFutureIndex

func (bs *BitgetSwap) GetFutureIndex(currencyPair cons.CurrencyPair) (float64, error)

*

  • 期货指数
  • @param currencyPair btc_usd:比特币 ltc_usd :莱特币

func (*BitgetSwap) GetFutureOrder

func (bs *BitgetSwap) GetFutureOrder(orderId string, currencyPair cons.CurrencyPair, contractType string) (*exws.FutureOrder, error)

*

*获取单个订单信息

func (*BitgetSwap) GetFutureOrders

func (bs *BitgetSwap) GetFutureOrders(orderIds []string, currencyPair cons.CurrencyPair, contractType string) ([]exws.FutureOrder, error)

*

*获取订单信息

func (*BitgetSwap) GetFuturePosition

func (bs *BitgetSwap) GetFuturePosition(currencyPair cons.CurrencyPair, contractType string) ([]exws.FuturePosition, error)

*

  • 用户持仓查询
  • @param symbol btc_usd:比特币 ltc_usd :莱特币
  • @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
  • @return

func (*BitgetSwap) GetFutureTicker

func (bs *BitgetSwap) GetFutureTicker(currency cons.CurrencyPair, contractType string) (*exws.Ticker, error)

*

  • 期货行情
  • @param currency_pair btc_usd:比特币 ltc_usd :莱特币
  • @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度

func (*BitgetSwap) GetFutureUserinfo

func (bs *BitgetSwap) GetFutureUserinfo(currencyPair ...cons.CurrencyPair) (*exws.FutureAccount, error)

全仓账户

func (*BitgetSwap) GetInstruments

func (bs *BitgetSwap) GetInstruments() ([]Instrument, error)

func (*BitgetSwap) GetKlineRecords

func (bs *BitgetSwap) GetKlineRecords(contractType string, currency cons.CurrencyPair, period, size, since int) ([]exws.FutureKline, error)

*

  • 获取K线数据

func (*BitgetSwap) GetMarginLevel

func (bs *BitgetSwap) GetMarginLevel(currencyPair cons.CurrencyPair) (*MarginLeverage, error)

func (*BitgetSwap) GetServerTime

func (bs *BitgetSwap) GetServerTime() (int64, error)

func (*BitgetSwap) GetTrades

func (bs *BitgetSwap) GetTrades(contractType string, currencyPair cons.CurrencyPair, since int64) ([]q.Trade, error)

func (*BitgetSwap) GetUnfinishFutureOrders

func (bs *BitgetSwap) GetUnfinishFutureOrders(currencyPair cons.CurrencyPair, contractType string) ([]exws.FutureOrder, error)

*

*获取未完成订单信息

func (*BitgetSwap) LimitFuturesOrder

func (bs *BitgetSwap) LimitFuturesOrder(currencyPair cons.CurrencyPair, contractType, price, amount string, openType int, opt ...cons.LimitOrderOptionalParameter) (*exws.FutureOrder, error)

func (*BitgetSwap) MarketFuturesOrder

func (bs *BitgetSwap) MarketFuturesOrder(currencyPair cons.CurrencyPair, contractType, amount string, openType int) (*exws.FutureOrder, error)

func (*BitgetSwap) ModifyAutoAppendMargin

func (bs *BitgetSwap) ModifyAutoAppendMargin(currencyPair cons.CurrencyPair, side int, autoAppend int) (bool, error)

side 1:多仓 2:空仓 autoAppend追加保证金类型 0 不自动追加 1 自动追加

func (*BitgetSwap) OneTicker

func (bs *BitgetSwap) OneTicker(d q.D) (ticker q.Bbo, err error)

func (*BitgetSwap) PairArray

func (bs *BitgetSwap) PairArray() (map[string]q.D, map[q.D]q.P, error)

func (*BitgetSwap) PlaceFutureOrder

func (bs *BitgetSwap) PlaceFutureOrder(currencyPair cons.CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

func (*BitgetSwap) PlaceFutureOrder2

func (bs *BitgetSwap) PlaceFutureOrder2(currencyPair cons.CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (*exws.FutureOrder, error)

*

  • @deprecated
  • 期货下单
  • @param currencyPair btc_usd:比特币 ltc_usd :莱特币
  • @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度
  • @param price 价格
  • @param amount 委托数量
  • @param openType 1:开多 2:开空 3:平多 4:平空
  • @param matchPrice 是否为对手价 0:不是 1:是 ,当取值为1时,price无效

func (*BitgetSwap) PlaceOrders

func (bs *BitgetSwap) PlaceOrders(places [3]q.Order) (orders [3]q.Order, err error)

func (*BitgetSwap) SetBaseUri

func (bs *BitgetSwap) SetBaseUri(uri string)

func (*BitgetSwap) SetMarginLevel

func (bs *BitgetSwap) SetMarginLevel(currencyPair cons.CurrencyPair, level, side int) (*MarginLeverage, error)

side 1:多仓 2:空仓

func (*BitgetSwap) String

func (bs *BitgetSwap) String() string

func (*BitgetSwap) Test

func (bs *BitgetSwap) Test() bool

func (*BitgetSwap) WithdrawFee

func (bs *BitgetSwap) WithdrawFee() (sf []q.NetworkWithdraw, err error)

type Instrument

type Instrument struct {
	Coin                string `json:"coin"`
	ContractVal         string `json:"contract_val"`
	Delivery            []any  `json:"delivery"`
	ForwardContractFlag bool   `json:"forwardContractFlag"`
	Listing             any    `json:"listing"`
	PriceEndStep        int    `json:"priceEndStep"`
	QuoteCurrency       string `json:"quote_currency"`
	SizeIncrement       int    `json:"size_increment"`
	Symbol              string `json:"symbol"`
	TickSize            int    `json:"tick_size"`
	UnderlyingIndex     string `json:"underlying_index"`
}

type MarginLeverage

type MarginLeverage struct {
	LongLeverage        float64 `json:"long_leverage,string"`
	MarginMode          string  `json:"margin_mode"`
	ShortLeverage       float64 `json:"short_leverage,string"`
	ForwardContractFlag bool    `json:"forwardContractFlag"`
	Symbol              string  `json:"symbol"`
}

Jump to

Keyboard shortcuts

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