_interface

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	LimitBuy(amount, price string, currency common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
	LimitSell(amount, price string, currency common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
	MarketBuy(amount, price string, currency common.TradingPair) (*common.Order, error)
	MarketSell(amount, price string, currency common.TradingPair) (*common.Order, error)
	CancelOrder(orderId string, currency common.TradingPair) (bool, error)
	GetOneOrder(orderId string, currency common.TradingPair) (*common.Order, error)
	GetUnfinishOrders(currency common.TradingPair) ([]common.Order, error)
	GetOrderHistorys(currency common.TradingPair, currentPage, pageSize int) ([]common.Order, error)
	GetAccount() (*common.Account, error)

	GetTicker(currency common.TradingPair) (*common.Ticker, error)
	GetDepth(size int, currency common.TradingPair) (*common.Depth, error)
	GetKlineRecords(currency common.TradingPair, period, size, since int) ([]common.Kline, error)
	//非个人,整个交易所的交易记录
	GetTrades(currencyPair common.TradingPair, since int64) ([]common.Trade, error)

	GetExchangeName() string
}

type FutureRestAPI

type FutureRestAPI interface {
	/**
	 *获取交易所名字
	 */
	GetExchangeName() string

	/**
	 *获取交割预估价
	 */
	GetFutureEstimatedPrice(currencyPair common.TradingPair) (float64, error)

	/**
	 * 期货行情
	 * @param currency_pair   btc_usd:比特币    ltc_usd :莱特币
	 * @param contractType  合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度
	 */
	GetFutureTicker(currencyPair common.TradingPair, contractType string) (*common.Ticker, error)

	/**
	 * 期货深度
	 * @param currencyPair  btc_usd:比特币    ltc_usd :莱特币
	 * @param contractType  合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度
	 * @param size 获取深度档数
	 * @return
	 */
	GetFutureDepth(currencyPair common.TradingPair, contractType string, size int) (*common.Depth, error)

	/**
	 * 期货指数
	 * @param currencyPair   btc_usd:比特币    ltc_usd :莱特币
	 */
	GetFutureIndex(currencyPair common.TradingPair) (float64, error)

	/**
	 *全仓账户
	 *@param currency
	 */
	GetFutureUserinfo(currencyPair ...common.TradingPair) (*common.FutureAccount, 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无效
	 */
	PlaceFutureOrder(currencyPair common.TradingPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

	LimitFuturesOrder(currencyPair common.TradingPair, contractType, price, amount string, openType int, opt ...common.LimitOrderOptionalParameter) (*common.FutureOrder, error)

	//对手价下单
	MarketFuturesOrder(currencyPair common.TradingPair, contractType, amount string, openType int) (*common.FutureOrder, error)

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

	 */
	FutureCancelOrder(currencyPair common.TradingPair, contractType, orderId string) (bool, error)

	/**
	 * 用户持仓查询
	 * @param symbol   btc_usd:比特币    ltc_usd :莱特币
	 * @param contractType   合约类型: this_week:当周   next_week:下周   month:当月   quarter:季度
	 * @return
	 */
	GetFuturePosition(currencyPair common.TradingPair, contractType string) ([]common.FuturePosition, error)

	/**
	 *获取订单信息
	 */
	GetFutureOrders(orderIds []string, currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)

	/**
	 *获取单个订单信息
	 */
	GetFutureOrder(orderId string, currencyPair common.TradingPair, contractType string) (*common.FutureOrder, error)

	/**
	 *获取未完成订单信息
	 */
	GetUnfinishFutureOrders(currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)

	/**
	 *获取交易费
	 */
	GetFee() (float64, error)

	/**
	 *获取每张合约价值
	 */
	GetContractValue(currencyPair common.TradingPair) (float64, error)

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

	/**
	 * 获取K线数据
	 */
	GetKlineRecords(contractType string, currency common.TradingPair, period, size, since int) ([]common.FutureKline, error)

	/**
	 * 获取Trade数据
	 */
	GetTrades(contractType string, currencyPair common.TradingPair, since int64) ([]common.Trade, error)
}

type FuturesWsApi

type FuturesWsApi interface {
	DepthCallback(func(depth *common.Depth))
	TickerCallback(func(ticker *common.FutureTicker))
	TradeCallback(func(trade *common.Trade, contract string))

	SubscribeDepth(pair common.TradingPair, contractType string) error
	SubscribeTicker(pair common.TradingPair, contractType string) error
	SubscribeTrade(pair common.TradingPair, contractType string) error
}

type SpotWsApi

type SpotWsApi interface {
	DepthCallback(func(depth *common.Depth))
	TickerCallback(func(ticker *common.Ticker))
	TradeCallback(func(trade *common.Trade))

	SubscribeDepth(pair common.TradingPair) error
	SubscribeTicker(pair common.TradingPair) error
	SubscribeTrade(pair common.TradingPair) error
}

type WalletAPI

type WalletAPI interface {
	GetAccount() (*common.Account, error)
	Withdrawal(param common.WithdrawParameter) (withdrawId string, err error)
	Transfer(param common.TransferParameter) error
	GetWithDrawHistory(currency *common.Currency) ([]common.DepositWithdrawHistory, error)
	GetDepositHistory(currency *common.Currency) ([]common.DepositWithdrawHistory, error)
}

Jump to

Keyboard shortcuts

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