1、暂存
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"go-admin/models/spot"
|
||||
"go-admin/pkg/httputils"
|
||||
"go-admin/pkg/utility"
|
||||
"go-admin/services/commonservice"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -126,7 +127,7 @@ func (e SpotRestApi) GetSpotTicker24h(tradeSet *map[string]models.TradeSet) (del
|
||||
log.Error("缓存交易对失败|", item.Symbol, err)
|
||||
}
|
||||
|
||||
helper.DefaultRedis.AddSortSet(global.COIN_PRICE_CHANGE, symbol.PriceChange, symbol.Coin)
|
||||
helper.DefaultRedis.AddSortSet(fmt.Sprintf(global.COIN_PRICE_CHANGE, global.EXCHANGE_BINANCE), symbol.PriceChange, symbol.Coin)
|
||||
}
|
||||
return deleteSymbols, nil
|
||||
}
|
||||
@ -169,12 +170,12 @@ type Ticker struct {
|
||||
Price string `json:"price"`
|
||||
}
|
||||
|
||||
func (e SpotRestApi) Ticker() {
|
||||
tickerApi := fmt.Sprintf("%s%s", binanceRestApi, "/api/v3/ticker/price")
|
||||
mapData, _ := httputils.NewHttpRequestWithFasthttp("GET", tickerApi, "", map[string]string{})
|
||||
//sonic.Unmarshal(mapData, &tickerData)
|
||||
helper.DefaultRedis.SetString(rediskey.SpotSymbolTicker, string(mapData))
|
||||
}
|
||||
// func (e SpotRestApi) Ticker() {
|
||||
// tickerApi := fmt.Sprintf("%s%s", binanceRestApi, "/api/v3/ticker/price")
|
||||
// mapData, _ := httputils.NewHttpRequestWithFasthttp("GET", tickerApi, "", map[string]string{})
|
||||
// //sonic.Unmarshal(mapData, &tickerData)
|
||||
// helper.DefaultRedis.SetString(rediskey.SpotSymbolTicker, string(mapData))
|
||||
// }
|
||||
|
||||
// 循环下单
|
||||
func (e SpotRestApi) OrderPlaceLoop(db *gorm.DB, params OrderPlacementService, retryCount int) error {
|
||||
@ -452,7 +453,7 @@ func GetApiInfo(apiId int) (DbModels.LineApiUser, error) {
|
||||
}
|
||||
}
|
||||
|
||||
db := GetDBConnection()
|
||||
db := commonservice.GetDBConnection()
|
||||
|
||||
if err := db.Model(&api).Where("id =?", apiId).First(&api).Error; err != nil {
|
||||
return api, err
|
||||
|
||||
Reference in New Issue
Block a user