99 lines
6.0 KiB
Go
99 lines
6.0 KiB
Go
package binancedto
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type UserSubscribeState struct {
|
|
SpotLastTime *time.Time `json:"spotLastTime" comment:"现货websocket最后通信时间"`
|
|
FuturesLastTime *time.Time `json:"futuresLastTime" comment:"合约websocket最后通信时间"`
|
|
}
|
|
|
|
type OpenOrder struct {
|
|
Price decimal.Decimal `json:"price"` //均价
|
|
Quantity decimal.Decimal `json:"quantity"` //数量
|
|
Status string `json:"status"` //币安原始状态 "NEW", "PARTIALLY_FILLED", "FILLED", "CANCELED", "PENDING_CANCEL", "REJECTED", "EXPIRED"
|
|
}
|
|
|
|
type StoplossMarket struct {
|
|
Pid int `json:"pid"`
|
|
Symbol string `json:"symbol"`
|
|
Type int `json:"type" comment:"对冲类型 1-现货 2-合约"`
|
|
}
|
|
|
|
type BinanceSpotOrder struct {
|
|
Symbol string `json:"symbol"` // 交易对
|
|
OrderID int64 `json:"orderId"` // 系统的订单ID
|
|
OrderListID int64 `json:"orderListId"` // 除非此单是订单列表的一部分, 否则此值为 -1
|
|
ClientOrderID string `json:"clientOrderId"` // 客户自己设置的ID
|
|
Price string `json:"price"` // 订单价格
|
|
OrigQty string `json:"origQty"` // 用户设置的原始订单数量
|
|
ExecutedQty string `json:"executedQty"` // 交易的订单数量
|
|
OrigQuoteOrderQty string `json:"origQuoteOrderQty"` // 原始的交易金额
|
|
CummulativeQuoteQty string `json:"cummulativeQuoteQty"` // 累计交易的金额
|
|
Status string `json:"status"` // 订单状态
|
|
TimeInForce string `json:"timeInForce"` // 订单的时效方式
|
|
Type string `json:"type"` // 订单类型,比如市价单,现价单等
|
|
Side string `json:"side"` // 订单方向,买还是卖
|
|
StopPrice string `json:"stopPrice"` // 止损价格
|
|
IcebergQty string `json:"icebergQty"` // 冰山数量
|
|
Time int64 `json:"time"` // 订单时间
|
|
UpdateTime int64 `json:"updateTime"` // 最后更新时间
|
|
IsWorking bool `json:"isWorking"` // 订单是否出现在orderbook中
|
|
WorkingTime int64 `json:"workingTime"` // 订单添加到 order book 的时间
|
|
SelfTradePreventionMode string `json:"selfTradePreventionMode"` // 如何处理自我交易模式
|
|
}
|
|
|
|
type BinanceFutureOrder struct {
|
|
AvgPrice string `json:"avgPrice"` // 平均成交价
|
|
ClientOrderID string `json:"clientOrderId"` // 用户自定义的订单号
|
|
CumQuote string `json:"cumQuote"` // 成交金额
|
|
ExecutedQty string `json:"executedQty"` // 成交量
|
|
OrderID int64 `json:"orderId"` // 系统订单号
|
|
OrigQty string `json:"origQty"` // 原始委托数量
|
|
OrigType string `json:"origType"` // 触发前订单类型
|
|
Price string `json:"price"` // 委托价格
|
|
ReduceOnly bool `json:"reduceOnly"` // 是否仅减仓
|
|
Side string `json:"side"` // 买卖方向
|
|
PositionSide string `json:"positionSide"` // 持仓方向
|
|
Status string `json:"status"` // 订单状态
|
|
StopPrice string `json:"stopPrice"` // 触发价,对`TRAILING_STOP_MARKET`无效
|
|
ClosePosition bool `json:"closePosition"` // 是否条件全平仓
|
|
Symbol string `json:"symbol"` // 交易对
|
|
Time int64 `json:"time"` // 订单时间
|
|
TimeInForce string `json:"timeInForce"` // 有效方法
|
|
Type string `json:"type"` // 订单类型
|
|
ActivatePrice string `json:"activatePrice"` // 跟踪止损激活价格, 仅`TRAILING_STOP_MARKET` 订单返回此字段
|
|
PriceRate string `json:"priceRate"` // 跟踪止损回调比例, 仅`TRAILING_STOP_MARKET` 订单返回此字段
|
|
UpdateTime int64 `json:"updateTime"` // 更新时间
|
|
WorkingType string `json:"workingType"` // 条件价格触发类型
|
|
PriceProtect bool `json:"priceProtect"` // 是否开启条件单触发保护
|
|
PriceMatch string `json:"priceMatch"` // 盘口价格下单模式
|
|
SelfTradePreventionMode string `json:"selfTradePreventionMode"` // 订单自成交保护模式
|
|
GoodTillDate int64 `json:"goodTillDate"` // 订单TIF为GTD时的自动取消时间
|
|
}
|
|
|
|
type BinanceSpotAccount struct {
|
|
Balances []BinanceSpotBalance `json:"balances"`
|
|
}
|
|
|
|
type BinanceSpotBalance struct {
|
|
Asset string `json:"asset"`
|
|
Free string `json:"free"`
|
|
Locked string `json:"locked"`
|
|
}
|
|
|
|
type BinanceFutureBalance struct {
|
|
AccountAlias string `json:"accountAlias"` // 账户唯一识别码
|
|
Asset string `json:"asset"` // 资产
|
|
Balance string `json:"balance"` // 总余额
|
|
CrossWalletBalance string `json:"crossWalletBalance"` // 全仓余额
|
|
CrossUnPnl string `json:"crossUnPnl"` // 全仓持仓未实现盈亏
|
|
AvailableBalance string `json:"availableBalance"` // 下单可用余额
|
|
MaxWithdrawAmount string `json:"maxWithdrawAmount"` // 最大可转出余额
|
|
MarginAvailable bool `json:"marginAvailable"` // 是否可用作联合保证金
|
|
UpdateTime int64 `json:"updateTime"` // 更新时间(时间戳)
|
|
}
|