Documentation ¶
Index ¶
- Constants
- type Asset
- type FCoin
- func (fc *FCoin) AssetTransfer(currency Currency, amount, from, to string) (bool, error)
- func (fc *FCoin) CancelOrder(orderId string, currency CurrencyPair) (bool, error)
- func (fc *FCoin) GetAccount() (*Account, error)
- func (fc *FCoin) GetAssets() ([]Asset, error)
- func (fc *FCoin) GetDaysOrderHistorys(currency CurrencyPair, start time.Time, days int64) ([]Order, error)
- func (fc *FCoin) GetDepth(size int, currency CurrencyPair) (*Depth, error)
- func (fc *FCoin) GetExchangeName() string
- func (fc *FCoin) GetHoursOrderHistorys(currency CurrencyPair, start time.Time, hours int64) ([]Order, error)
- func (fc *FCoin) GetKlineRecords(currency CurrencyPair, period, size, since int) ([]Kline, error)
- func (fc *FCoin) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)
- func (fc *FCoin) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]Order, error)
- func (fc *FCoin) GetOrderHistorys2(currency CurrencyPair, currentPage, pageSize int, states ...string) ([]Order, error)
- func (fc *FCoin) GetServerTime() (int64, error)
- func (fc *FCoin) GetTicker(currencyPair CurrencyPair) (*Ticker, error)
- func (fc *FCoin) GetTradeSymbol(currencyPair CurrencyPair) (*TradeSymbol, error)
- func (fc *FCoin) GetTradeSymbol2(currencyPair CurrencyPair) (*TradeSymbol2, error)
- func (fc *FCoin) GetTradeSymbols() ([]TradeSymbol, error)
- func (fc *FCoin) GetTradeSymbols2() ([]TradeSymbol2, error)
- func (fc *FCoin) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)
- func (fc *FCoin) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)
- func (fc *FCoin) LimitBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (fc *FCoin) LimitSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (fc *FCoin) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (fc *FCoin) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (fc *FCoin) PlaceOrder(orderType OrderType, orderSide, amount, price string, pair CurrencyPair, ...) (*Order, error)
- type FCoinMargin
- func (fm *FCoinMargin) AssetTransferIn(currency Currency, amount, from string, to CurrencyPair) (bool, error)
- func (fm *FCoinMargin) AssetTransferOut(currency Currency, amount string, from CurrencyPair, to string) (bool, error)
- func (fm *FCoinMargin) Borrow(parameter BorrowParameter) (*MarginOrder, error)
- func (fm *FCoinMargin) GetAccount() (*Account, error)
- func (fm *FCoinMargin) GetExchangeName() string
- func (fm *FCoinMargin) GetMarginAccount(currency CurrencyPair) (*MarginAccount, error)
- func (fm *FCoinMargin) GetOneLoan(borrowId string) (*MarginOrder, error)
- func (fm *FCoinMargin) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]Order, error)
- func (fm *FCoinMargin) GetOrderHistorys2(currency CurrencyPair, currentPage, pageSize int, states ...string) ([]Order, error)
- func (fm *FCoinMargin) GetUnfinishLoans(currency CurrencyPair) ([]*MarginOrder, error)
- func (fm *FCoinMargin) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)
- func (fm *FCoinMargin) LimitBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (fm *FCoinMargin) LimitSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (fm *FCoinMargin) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (fm *FCoinMargin) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (fm *FCoinMargin) Repayment(parameter RepaymentParameter) (repaymentId string, err error)
- type FCoinWs
- func (fcWs *FCoinWs) SetCallbacks(tickerCallback func(*Ticker), depthCallback func(*Depth), ...)
- func (fcWs *FCoinWs) SubscribeDepth(pair CurrencyPair, size int) error
- func (fcWs *FCoinWs) SubscribeKline(pair CurrencyPair, period int) error
- func (fcWs *FCoinWs) SubscribeTicker(pair CurrencyPair) error
- func (fcWs *FCoinWs) SubscribeTrade(pair CurrencyPair) error
- type FMexSwap
- func (fm *FMexSwap) AdaptTradeStatus(status int) TradeStatus
- func (fm *FMexSwap) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)
- func (fm *FMexSwap) GetContractValue(currencyPair CurrencyPair) (float64, error)
- func (fm *FMexSwap) GetDeliveryTime() (int, int, int, int)
- func (fm *FMexSwap) GetExchangeName() string
- func (fm *FMexSwap) GetExchangeRate() (float64, error)
- func (fm *FMexSwap) GetFee() (float64, error)
- func (fm *FMexSwap) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)
- func (fm *FMexSwap) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)
- func (fm *FMexSwap) GetFutureIndex(currencyPair CurrencyPair) (float64, error)
- func (fm *FMexSwap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)
- func (fm *FMexSwap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (fm *FMexSwap) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)
- func (fm *FMexSwap) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)
- func (fm *FMexSwap) GetFutureUserinfo() (*FutureAccount, error)
- func (fm *FMexSwap) GetHistoricalFunding(contractType string, currencyPair CurrencyPair, page int) ([]HistoricalFunding, error)
- func (fm *FMexSwap) GetKlineRecords(contract_type string, currency CurrencyPair, period, size, since int) ([]FutureKline, error)
- func (fm *FMexSwap) GetTrades(contract_type string, currencyPair CurrencyPair, since int64) ([]Trade, error)
- func (fm *FMexSwap) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
- func (fm *FMexSwap) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, ...) (string, error)
- type MarginOrder
- type RawTicker
- type TradeSymbol
- type TradeSymbol2
Constants ¶
View Source
const ( SPOT = "spot" ASSETS = "assets" EXCHANGE = "exchange" )
View Source
const ( /*Rest Endpoint*/ Endpoint = "https://api.testnet.fmex.com" GET_ACCOUNTS = "/v3/contracts/accounts" PLACE_ORDER = "/v3/contracts/orders" CANCEL_ORDER = "/v3/contracts/orders/%s/cancel" GET_POSITION = "/v3/contracts/positions" GET_DEPTH = "/v2/market/depth/L20/%s" GET_TICKER = "/v2/market/ticker/%s" GET_UNFINISHED_ORDERS = "/v3/contracts/orders/open" )
View Source
const ( FCoinWSTicker = "ticker.%s" FCoinWSOrderBook = "depth.L%d.%s" FCoinWSOrderBookL20 = "depth.L20.%s" FCoinWSOrderBookL150 = "depth.L150.%s" FCoinWSOrderBookFull = "depth.full.%s" FCoinWSTrades = "trade.%s" FCoinWSKLines = "candle.%s.%s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FCoin ¶
type FCoin struct {
// contains filtered or unexported fields
}
func (*FCoin) AssetTransfer ¶
from, to: assets, spot
func (*FCoin) CancelOrder ¶
func (*FCoin) GetAccount ¶
func (*FCoin) GetDaysOrderHistorys ¶
func (*FCoin) GetExchangeName ¶
func (*FCoin) GetHoursOrderHistorys ¶
func (*FCoin) GetKlineRecords ¶
func (*FCoin) GetOneOrder ¶
func (*FCoin) GetOrderHistorys ¶
func (*FCoin) GetOrderHistorys2 ¶ added in v1.0.5
func (*FCoin) GetServerTime ¶ added in v1.0.4
func (*FCoin) GetTradeSymbol ¶ added in v1.0.5
func (fc *FCoin) GetTradeSymbol(currencyPair CurrencyPair) (*TradeSymbol, error)
func (*FCoin) GetTradeSymbol2 ¶ added in v1.0.5
func (fc *FCoin) GetTradeSymbol2(currencyPair CurrencyPair) (*TradeSymbol2, error)
func (*FCoin) GetTradeSymbols2 ¶ added in v1.0.3
func (fc *FCoin) GetTradeSymbols2() ([]TradeSymbol2, error)
func (*FCoin) GetUnfinishOrders ¶
func (*FCoin) MarketSell ¶
type FCoinMargin ¶ added in v1.0.5
type FCoinMargin struct {
*FCoin
}
func NewFcoinMargin ¶ added in v1.0.6
func NewFcoinMargin(client *http.Client, apikey, secretkey string) *FCoinMargin
func (*FCoinMargin) AssetTransferIn ¶ added in v1.0.5
func (fm *FCoinMargin) AssetTransferIn(currency Currency, amount, from string, to CurrencyPair) (bool, error)
currency币种名称:usdt、btc、eth from资产来源账户类型: exchange: 交易账户; assets: 资产账户 to目标账户类型: leveraged_btcusdt、leveraged_ethusdt、leveraged_eosusdt、leveraged_xrpusdt
func (*FCoinMargin) AssetTransferOut ¶ added in v1.0.5
func (fm *FCoinMargin) AssetTransferOut(currency Currency, amount string, from CurrencyPair, to string) (bool, error)
currency币种名称:usdt、btc、eth from资产来源账户类型: exchange: 交易账户; assets: 资产账户 to目标账户类型: leveraged_btcusdt、leveraged_ethusdt、leveraged_eosusdt、leveraged_xrpusdt
func (*FCoinMargin) Borrow ¶ added in v1.0.5
func (fm *FCoinMargin) Borrow(parameter BorrowParameter) (*MarginOrder, error)
func (*FCoinMargin) GetAccount ¶ added in v1.0.6
func (fm *FCoinMargin) GetAccount() (*Account, error)
func (*FCoinMargin) GetExchangeName ¶ added in v1.0.6
func (fm *FCoinMargin) GetExchangeName() string
func (*FCoinMargin) GetMarginAccount ¶ added in v1.0.5
func (fm *FCoinMargin) GetMarginAccount(currency CurrencyPair) (*MarginAccount, error)
func (*FCoinMargin) GetOneLoan ¶ added in v1.0.5
func (fm *FCoinMargin) GetOneLoan(borrowId string) (*MarginOrder, error)
func (*FCoinMargin) GetOrderHistorys ¶ added in v1.0.5
func (fm *FCoinMargin) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]Order, error)
func (*FCoinMargin) GetOrderHistorys2 ¶ added in v1.0.6
func (fm *FCoinMargin) GetOrderHistorys2(currency CurrencyPair, currentPage, pageSize int, states ...string) ([]Order, error)
states:submitted,partial_filled,partial_canceled,filled,canceled
func (*FCoinMargin) GetUnfinishLoans ¶ added in v1.0.5
func (fm *FCoinMargin) GetUnfinishLoans(currency CurrencyPair) ([]*MarginOrder, error)
func (*FCoinMargin) GetUnfinishOrders ¶ added in v1.0.5
func (fm *FCoinMargin) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)
func (*FCoinMargin) LimitBuy ¶ added in v1.0.5
func (fm *FCoinMargin) LimitBuy(amount, price string, currency CurrencyPair) (*Order, error)
func (*FCoinMargin) LimitSell ¶ added in v1.0.5
func (fm *FCoinMargin) LimitSell(amount, price string, currency CurrencyPair) (*Order, error)
func (*FCoinMargin) MarketBuy ¶ added in v1.0.5
func (fm *FCoinMargin) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)
func (*FCoinMargin) MarketSell ¶ added in v1.0.5
func (fm *FCoinMargin) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)
func (*FCoinMargin) Repayment ¶ added in v1.0.5
func (fm *FCoinMargin) Repayment(parameter RepaymentParameter) (repaymentId string, err error)
type FCoinWs ¶
func NewFCoinWs ¶
func (*FCoinWs) SetCallbacks ¶
func (*FCoinWs) SubscribeDepth ¶
func (*FCoinWs) SubscribeKline ¶
func (*FCoinWs) SubscribeTicker ¶
func (*FCoinWs) SubscribeTrade ¶
type FMexSwap ¶ added in v1.0.6
type FMexSwap struct { *FCoin // contains filtered or unexported fields }
func NewFMexSwap ¶ added in v1.0.6
func NewFMexSwap(config *APIConfig) *FMexSwap
func (*FMexSwap) AdaptTradeStatus ¶ added in v1.0.6
func (*FMexSwap) FutureCancelOrder ¶ added in v1.0.6
func (*FMexSwap) GetContractValue ¶ added in v1.0.6
*
func (*FMexSwap) GetDeliveryTime ¶ added in v1.0.6
func (*FMexSwap) GetExchangeName ¶ added in v1.0.6
func (*FMexSwap) GetExchangeRate ¶ added in v1.0.6
func (*FMexSwap) GetFutureDepth ¶ added in v1.0.6
func (*FMexSwap) GetFutureEstimatedPrice ¶ added in v1.0.6
func (*FMexSwap) GetFutureIndex ¶ added in v1.0.6
func (*FMexSwap) GetFutureOrder ¶ added in v1.0.6
func (fm *FMexSwap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)
*
func (*FMexSwap) GetFutureOrders ¶ added in v1.0.6
func (fm *FMexSwap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)
*
func (*FMexSwap) GetFuturePosition ¶ added in v1.0.6
func (*FMexSwap) GetFutureTicker ¶ added in v1.0.6
func (*FMexSwap) GetFutureUserinfo ¶ added in v1.0.6
func (*FMexSwap) GetHistoricalFunding ¶ added in v1.0.6
func (*FMexSwap) GetKlineRecords ¶ added in v1.0.6
func (*FMexSwap) GetUnfinishFutureOrders ¶ added in v1.0.6
type MarginOrder ¶ added in v1.0.5
type MarginOrder struct { Currency Currency Amount float64 // borrow amount BorrowTime int64 // borrow time, ms RepaymentTime int64 // repayment time, ms LendingFee float64 // LendingFee LoanRate float64 // loan rate LoanFeeStartTime int64 // charge from start time LastRepayTime int64 // last repay time LoanBillId string NextLoanFeeStartTime int64 State string //账单状态. submitted 已提交; 2 confirmed 已确认; 5 finished 还款完成 UnPaidAmount float64 UnPaidLendingFee float64 }
* 杠杆交易区借币, pair : 操作的交易对 currency: 需要借的币种 amount : 借的金额
type TradeSymbol ¶
type TradeSymbol2 ¶ added in v1.0.3
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"` }
Click to show internal directories.
Click to hide internal directories.