fmex

package
v1.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SPOT     = "spot"
	ASSETS   = "assets"
	EXCHANGE = "exchange"
)
View Source
const (
	FMexWSTicker        = "ticker.%s"
	FMexWSOrderBook     = "depth.L%d.%s"
	FMexWSOrderBookL20  = "depth.L20.%s"
	FMexWSOrderBookL150 = "depth.L150.%s"
	FMexWSOrderBookFull = "depth.full.%s"
	FMexWSTrades        = "trade.%s"
	FMexWSKLines        = "candle.%s.%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Currency  Currency
	Avaliable float64
	Frozen    float64
	Finances  float64
	Lock      float64
	Total     float64
}

type FMexSwap

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

func NewFMexSwap

func NewFMexSwap(config *APIConfig) *FMexSwap

func (*FMexSwap) FutureCancelOrder

func (fm *FMexSwap) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)

*

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

func (*FMexSwap) GetContractValue

func (fm *FMexSwap) GetContractValue(currencyPair CurrencyPair) (float64, error)

*

*获取每张合约价值

func (*FMexSwap) GetDeliveryTime

func (fm *FMexSwap) GetDeliveryTime() (int, int, int, int)

*

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

func (*FMexSwap) GetExchangeName

func (fm *FMexSwap) GetExchangeName() string

func (*FMexSwap) GetFee

func (fm *FMexSwap) GetFee() (float64, error)

*

*获取交易费

func (*FMexSwap) GetFutureDepth

func (fm *FMexSwap) GetFutureDepth(currency CurrencyPair, contractType string, size int) (*Depth, error)

func (*FMexSwap) GetFutureEstimatedPrice

func (fm *FMexSwap) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)

*

*获取交割预估价

func (*FMexSwap) GetFutureIndex

func (fm *FMexSwap) GetFutureIndex(currencyPair CurrencyPair) (float64, error)

*

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

func (*FMexSwap) GetFutureOrder

func (fm *FMexSwap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)

*

*获取单个订单信息

func (*FMexSwap) GetFutureOrderHistory

func (fm *FMexSwap) GetFutureOrderHistory(filter *OrderFilter, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*FMexSwap) GetFutureOrders

func (fm *FMexSwap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

*

*获取订单信息

func (*FMexSwap) GetFuturePosition

func (fm *FMexSwap) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)

*

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

func (*FMexSwap) GetFutureTicker

func (fm *FMexSwap) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)

*

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

func (*FMexSwap) GetFutureUserinfo

func (fm *FMexSwap) GetFutureUserinfo() (*FutureAccount, error)

*

*全仓账户

func (*FMexSwap) GetKlineRecords

func (fm *FMexSwap) GetKlineRecords(contract_type string, currency CurrencyPair, period, size, since int) ([]FutureKline, error)

*

  • 获取K线数据

func (*FMexSwap) GetServerTime

func (fm *FMexSwap) GetServerTime() (int64, error)

func (*FMexSwap) GetTrades

func (fm *FMexSwap) GetTrades(contract_type string, currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*FMexSwap) GetUnfinishFutureOrders

func (fm *FMexSwap) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

*

*获取未完成订单信息

func (*FMexSwap) MarginTransferOut

func (fm *FMexSwap) MarginTransferOut(currency Currency, amount float64) (bool, error)

func (*FMexSwap) PlaceFutureOrder

func (fm *FMexSwap) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice, leverRate int) (string, 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 (*FMexSwap) PlaceFutureOrder2

func (fm *FMexSwap) PlaceFutureOrder2(ord *OrderParam) (string, error)

func (*FMexSwap) SetBaseUri

func (fm *FMexSwap) SetBaseUri(uri string)

type FMexTicker

type FMexTicker struct {
	Ticker
	SellAmount,
	BuyAmount float64
}

type FMexWs

type FMexWs struct {
	*WsBuilder
	sync.Once
	// contains filtered or unexported fields
}

func NewFMexWs

func NewFMexWs(client *http.Client) *FMexWs

func (*FMexWs) SetCallbacks

func (fmWs *FMexWs) SetCallbacks(
	tickerCallback func(*Ticker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade),
	klineCallback func(*Kline, int),
)

func (*FMexWs) SubscribeDepth

func (fmWs *FMexWs) SubscribeDepth(pair CurrencyPair, size int) error

func (*FMexWs) SubscribeKline

func (fmWs *FMexWs) SubscribeKline(pair CurrencyPair, period int) error

func (*FMexWs) SubscribeTicker

func (fmWs *FMexWs) SubscribeTicker(pair CurrencyPair) error

func (*FMexWs) SubscribeTrade

func (fmWs *FMexWs) SubscribeTrade(pair CurrencyPair) error

type OrderFilter

type OrderFilter struct {
	Range    string
	Symbol   string
	OffsetId string
	Limit    string
}

type OrderParam

type OrderParam struct {
	Currency         CurrencyPair
	Type             OrderType
	Direction        int
	Price            string
	Amount           string
	OType            int    //1:开多 2:开空 3:平多 4: 平空
	TriggerOn        string //订单触发价格,如果不填,则立刻执行
	TrailingDistance string //止盈止损订单触发距离,如果不填,则不会按止盈止损执行
	IsFOK            bool   //是否设置FOK订单
	IsIOC            bool   //是否设置IOC订单
	IsPostOnly       bool   //是否设置PostOnly订单
	IsHidden         bool   //是否设置Hidden订单
	IsReduceOnly     bool   //是否设置ReduceOnly订单
}

type RawTicker

type RawTicker struct {
	Ticker
	SellAmount   float64
	BuyAmount    float64
	LastTradeVol float64
}

type TradeSymbol

type TradeSymbol struct {
	Name          string `json:"name"`
	BaseCurrency  string `json:"base_currency"`
	QuoteCurrency string `json:"quote_currency"`
	PriceDecimal  int    `json:"price_decimal"`
	AmountDecimal int    `json:"amount_decimal"`
	Tradeable     bool   `json:"tradable"`
}

type TradeSymbol2

type TradeSymbol2 struct {
	TradeSymbol
	Category           string  `json:"category"`
	LeveragedMultiple  int     `json:"leveraged_multiple"`
	MarketOrderEnabled bool    `json:"market_order_enabled"`
	LimitAmountMin     float64 `json:"limit_amount_min"`
	LimitAmountMax     float64 `json:"limit_amount_max"`
	MainTag            string  `json:"main_tag"`
	DailyOpenAt        string  `json:"daily_open_at"`
	DailyCloseAt       string  `json:"daily_close_at"`
}

Jump to

Keyboard shortcuts

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