Documentation ¶
Index ¶
- Constants
- type DepthRecord
- type Funding
- type FundingService
- type Kline
- type KlineService
- func (service *KlineService) BatchInsert(kl []*Kline) error
- func (service *KlineService) GetKlines(limit, offset int64, tsDesc bool) ([]*Kline, error)
- func (service *KlineService) GetKlinesByTs(tsDesc bool, start, end time.Time) ([]*Kline, error)
- func (service KlineService) Insert(obj interface{}) (*primitive.ObjectID, error)
- func (service *KlineService) Merge(kl []*Kline) *Kline
- type Liquidation
- type LiquidationService
- type Order
- type Position
- type Quote
- type Trade
- type TradeService
Constants ¶
View Source
const ( SideBuy = "Buy" SideSell = "Sell" )
View Source
const ( OrdLimit = "Limit" // 限价买入 OrdMarket = "Market" // 市价买入 OrdStop = "Stop" // 止损市价平仓单 OrdStopLimit = "StopLimit" // 止损限价平仓单 LimitIfTouched = "LimitIfTouched" // 止盈限价平仓单 MarketIfTouched = "MarketIfTouched" // 止盈市价平仓单 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DepthRecord ¶
type Funding ¶
type Funding struct { ID primitive.ObjectID `bson:"_id" json:"id"` CreateTime time.Time `bson:"createTime" json:"createTime"` UpdateTime time.Time `bson:"updateTime" json:"updateTime"` Symbol string `bson:"symbol" json:"symbol"` FundingRate float64 `bson:"fundingRate" json:"fundingRate"` Timestamp time.Time `bson:"timestamp" json:"timestamp"` }
func NewFunding ¶
func NewFunding() *Funding
type FundingService ¶
type FundingService struct {
// contains filtered or unexported fields
}
func NewFundingService ¶
func NewFundingService( exchange, symbol string, db *storage.MongoProxy) *FundingService
func (*FundingService) BatchInsert ¶
func (service *FundingService) BatchInsert(fl []*Funding) error
type Kline ¶
type Kline struct { ID primitive.ObjectID `bson:"_id" json:"id"` CreateTime time.Time `bson:"createTime" json:"createTime"` UpdateTime time.Time `bson:"updateTime" json:"updateTime"` Symbol string `bson:"symbol" json:"symbol"` Open float64 `bson:"open" json:"open"` Close float64 `bson:"close" json:"close"` High float64 `bson:"high" json:"high"` Low float64 `bson:"low" json:"low"` Vol float64 `bson:"vol" json:"vol"` Timestamp time.Time `bson:"timestamp" json:"timestamp"` }
func CreateKline ¶
func CreateKline() *Kline
func (*Kline) UpdateKline ¶
type KlineService ¶
type KlineService struct {
// contains filtered or unexported fields
}
func NewKlineService ¶
func NewKlineService( exchange, symbol string, interval time.Duration, db *storage.MongoProxy) *KlineService
func (*KlineService) BatchInsert ¶
func (service *KlineService) BatchInsert(kl []*Kline) error
func (*KlineService) GetKlines ¶
func (service *KlineService) GetKlines( limit, offset int64, tsDesc bool) ([]*Kline, error)
func (*KlineService) GetKlinesByTs ¶
func (*KlineService) Merge ¶
func (service *KlineService) Merge(kl []*Kline) *Kline
type Liquidation ¶
type Liquidation struct { ID primitive.ObjectID `bson:"_id" json:"id"` CreateTime time.Time `bson:"createTime" json:"createTime"` UpdateTime time.Time `bson:"updateTime" json:"updateTime"` Symbol string `bson:"symbol" json:"symbol"` Side string `bson:"side" json:"side"` Price float64 `bson:"price" json:"price"` Volume float64 `bson:"volume" json:"volume"` }
func NewLiquidation ¶
func NewLiquidation() *Liquidation
type LiquidationService ¶
type LiquidationService struct {
// contains filtered or unexported fields
}
func NewLiquidationService ¶
func NewLiquidationService( exchange, symbol string, db *storage.MongoProxy) *LiquidationService
func (LiquidationService) BatchInsert ¶
func (service LiquidationService) BatchInsert(objs []interface{}) error
type Order ¶
type Order struct { Symbol string `json:"symbol"` OrderID string `json:"orderID"` ClOrdID string `json:"clOrdID"` OrdType string `json:"ordType"` Price float64 `json:"price"` AvgPrice float64 `json:"avgPrice"` Amount float64 `json:"amount"` FilledAmount float64 `json:"filledAmount"` Side string `json:"side"` OrdStatus string `json:"ordStatus"` Timestamp time.Time `json:"timestamp"` }
type Position ¶
type Position struct { Account float64 `json:"account"` Symbol string `json:"symbol"` Currency string `json:"currency"` LeverRate float64 `json:"leverRate"` // 杠杆率 ForceLiquPrice float64 `json:"forceLiquPrice"` //预估爆仓价 SellAmount float64 `json:"sellAmount"` // 空单量 SellAvailable float64 `json:"sellAvailable"` // 可用空单量 SellPriceAvg float64 `json:"sellPriceAvg"` // 空单开仓均价 SellPriceCost float64 `json:"sellPriceCost"` // 空单持仓金额 SellProfitReal float64 `json:"sellProfitReal"` // 空单浮盈 OpenOrderSellQty float64 `json:"openOrderSellQty"` // 委托空单平仓数量 BuyAmount float64 `json:"buyAmount"` // 多单量 BuyAvailable float64 `json:"buyAvailable"` // 可用多单量 BuyPriceAvg float64 `json:"buyPriceAvg"` // 多单开仓均价 BuyPriceCost float64 `json:"buyPriceCost"` // 多餐持仓金额 BuyProfitReal float64 `json:"buyProfitReal"` // 多单浮盈 OpenOrderBuyQty float64 `json:"openOrderBuyQty"` // 委托多单平仓数量 }
type Trade ¶
type Trade struct { ID primitive.ObjectID `bson:"_id" json:"id"` CreateTime time.Time `bson:"createTime" json:"createTime"` UpdateTime time.Time `bson:"updateTime" json:"updateTime"` Symbol string `bson:"symbol" json:"symbol"` TID string `bson:"tid" json:"tid"` Side string `bson:"side" json:"side"` Price float64 `bson:"price" json:"price"` Amount float64 `bson:"amount" json:"amount"` Timestamp time.Time `bson:"timestamp" json:"timestamp"` }
type TradeService ¶
type TradeService struct {
// contains filtered or unexported fields
}
func NewTradeService ¶
func NewTradeService( exchange, symbol string, db *storage.MongoProxy) *TradeService
func (TradeService) BatchInsert ¶
func (service TradeService) BatchInsert(objs []interface{}) error
Click to show internal directories.
Click to hide internal directories.