Documentation
¶
Index ¶
- Constants
- Variables
- func AdjustTime()
- func BinanceHmac256(data string, secret string) string
- func DeleteWithSign(key *Key, path string, data ParamData) (resBody []byte, err error)
- func EncodeQueryString(query map[string]interface{}, bSort bool) string
- func GetMapKeys(m map[string]interface{}) (keys []string)
- func GetNoSign(path string, params ParamData) (resBody []byte, err error)
- func GetWithSign(key *Key, path string, data ParamData) (resBody []byte, err error)
- func HuobiHmac256(data string, secret string) string
- func IsEmpty(obj interface{}) bool
- func PostNoSign(path string, data ParamData) (resBody []byte, err error)
- func PutWithSign(key *Key, path string, data ParamData) (resBody []byte, err error)
- func SortKeys(keys []string) []string
- func SpotGetWithSign(key *Key, path string, data ParamData) (resBody []byte, err error)
- func StructToMap(obj interface{}) map[string]interface{}
- func WsConnect(ctx context.Context, urlPath string) (*websocket.Conn, chan *WsMessage, error)
- type ContractStatus
- type ContractType
- type ErrMsg
- type IncomeType
- type Key
- type KlineInterval
- type MarginType
- type OrderSide
- type OrderStatus
- type OrderType
- type ParamData
- type PositionSide
- type PriceMatch
- type ResponseType
- type Sign
- type StpMode
- type TimeInForce
- type WorkingType
- type WsMessage
Constants ¶
View Source
const (
WsChanLen = 128 // chan lengh for websocket message
)
Variables ¶
View Source
var TestKey = &Key{
UserId: 123456,
ApiKey: "",
SecretKey: "",
}
Functions ¶
func AdjustTime ¶
func AdjustTime()
func BinanceHmac256 ¶
func DeleteWithSign ¶
发送需要签名的Delete请求
func EncodeQueryString ¶
/ 拼接query字符串
func GetMapKeys ¶
func GetWithSign ¶
发送需要签名的GET请求
func HuobiHmac256 ¶
func PutWithSign ¶
发送需要签名的Put请求
func SpotGetWithSign ¶
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
Types ¶
type ContractStatus ¶
type ContractStatus string
const ( CS_PendingTrading ContractStatus = "PENDING_TRADING" CS_Trading ContractStatus = "TRADING" CS_PreDelivering ContractStatus = "PRE_DELIVERING" CS_Delivering ContractStatus = "DELIVERING" CS_Delivered ContractStatus = "DELIVERED" CS_PreSettle ContractStatus = "PRE_SETTLE" CS_Settling ContractStatus = "SETTLING" CS_Close ContractStatus = "CLOSE" )
type ContractType ¶
type ContractType string
const ( CT_Perpetual ContractType = "PERPETUAL" CT_CurrentMonth ContractType = "CURRENT_MONTH" CT_NextMonth ContractType = "NEXT_MONTH" CT_CurrentQuarter ContractType = "CURRENT_QUARTER" CT_NextQuarter ContractType = "NEXT_QUARTER" CT_PerpetualDelivering ContractType = "PERPETUAL_DELIVERING" )
type IncomeType ¶
type IncomeType string
const ( IT_Transfer IncomeType = "TRANSFER" IT_WelcomeBonus IncomeType = "WELCOME_BONUS" IT_RealizedPnl IncomeType = "REALIZED_PNL" IT_FundingFee IncomeType = "FUNDING_FEE" IT_Commission IncomeType = "COMMISSION" IT_InsuranceClear IncomeType = "INSURANCE_CLEAR" IT_ReferralKickback IncomeType = "REFERRAL_KICKBACK" IT_CommissionRebate IncomeType = "COMMISSION_REBATE" IT_ApiRebate IncomeType = "API_REBATE" IT_ContestReward IncomeType = "CONTEST_REWARD" IT_CrossCollateralTransfer IncomeType = "CROSS_COLLATERAL_TRANSFER" IT_OptionsPremiumFee IncomeType = "OPTIONS_PREMIUM_FEE" IT_OptionsSettleProfit IncomeType = "OPTIONS_SETTLE_PROFIT" IT_InternalTransfer IncomeType = "INTERNAL_TRANSFER" IT_AutoExchange IncomeType = "AUTO_EXCHANGE" IT_DeliveredSettelment IncomeType = "DELIVERED_SETTELMENT" IT_CoinSwapDeposit IncomeType = "COIN_SWAP_DEPOSIT" IT_CoinSwapWithdraw IncomeType = "COIN_SWAP_WITHDRAW" IT_PositionLimitIncreaseFee IncomeType = "POSITION_LIMIT_INCREASE_FEE" )
type KlineInterval ¶
type KlineInterval string
const ( KI_Minute1 KlineInterval = "1m" KI_Minute3 KlineInterval = "3m" KI_Minute5 KlineInterval = "5m" KI_Minute15 KlineInterval = "15m" KI_Minute30 KlineInterval = "30m" KI_Hour1 KlineInterval = "1h" KI_Hour2 KlineInterval = "2h" KI_Hour4 KlineInterval = "4h" KI_Hour6 KlineInterval = "6h" KI_Hour8 KlineInterval = "8h" KI_Hour12 KlineInterval = "12h" KI_Day1 KlineInterval = "1d" KI_Day3 KlineInterval = "3d" KI_Week1 KlineInterval = "1w" KI_Month1 KlineInterval = "1M" )
type MarginType ¶
type MarginType string
const ( MT_Isolated MarginType = "ISOLATED" MT_Cross MarginType = "CROSSED" )
type OrderStatus ¶
type OrderStatus string
const ( OS_New OrderStatus = "NEW" OS_PartiallyFilled OrderStatus = "PARTIALLY_FILLED" OS_Filled OrderStatus = "FILLED" OS_Canceled OrderStatus = "CANCELED" OS_Rejected OrderStatus = "REJECTED" OS_Expired OrderStatus = "EXPIRED" )
type PositionSide ¶
type PositionSide string
const ( PS_Long PositionSide = "LONG" PS_Short PositionSide = "SHORT" PS_Both PositionSide = "BOTH" )
type PriceMatch ¶
type PriceMatch string
const ( PM_None PriceMatch = "NONE" PM_Opponent PriceMatch = "OPPONENT" // counterparty best price PM_Opponent_5 PriceMatch = "OPPONENT_5" // the 5th best price from the counterparty PM_Opponent_10 PriceMatch = "OPPONENT_10" // the 10th best price from the counterparty PM_Opponent_20 PriceMatch = "OPPONENT_20" // the 20th best price from the counterparty PM_Queue PriceMatch = "QUEUE" // the best price on the same side of the order book PM_Queue_5 PriceMatch = "QUEUE_5" // the 5th best price on the same side of the order book PM_Queue_10 PriceMatch = "QUEUE_10" // the 10th best price on the same side of the order book PM_Queue_20 PriceMatch = "QUEUE_20" // the 20th best price on the same side of the order book )
type ResponseType ¶
type ResponseType string
const ( RT_Result ResponseType = "RESULT" RT_Ack ResponseType = "ACK" )
type Sign ¶
func (*Sign) BinanceGetSign ¶
返回:签名串,签名
type TimeInForce ¶
type TimeInForce string
const ( TIF_GTC TimeInForce = "GTC" // Good Till Cancel(GTC order valitidy is 1 year from placement) TIF_IOC TimeInForce = "IOC" // Immediate or Cancel TIF_FOK TimeInForce = "FOK" // Fill or Kill TIF_GTX TimeInForce = "GTX" // Good Till Crossing (Post Only) TIF_GTD TimeInForce = "GTD" // Good Till Date )
type WorkingType ¶
type WorkingType string
const ( WT_MarkPrice WorkingType = "MARK_PRICE" WT_ContractPrice WorkingType = "CONTRACT_PRICE" )
Click to show internal directories.
Click to hide internal directories.