1、减仓策略
2、减仓后减仓节点(60%)
This commit is contained in:
@ -1,14 +1,12 @@
|
||||
package binanceservice
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
DbModels "go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/const/rediskey"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/helper"
|
||||
"go-admin/models"
|
||||
"go-admin/models/positiondto"
|
||||
"go-admin/pkg/utility"
|
||||
"go-admin/services/positionservice"
|
||||
@ -27,32 +25,6 @@ type AddPosition struct {
|
||||
Db *gorm.DB
|
||||
}
|
||||
|
||||
// 获取缓存交易对
|
||||
// symbolType 0-现货 1-合约
|
||||
func GetTradeSet(symbol string, symbolType int) (models.TradeSet, error) {
|
||||
result := models.TradeSet{}
|
||||
val := ""
|
||||
|
||||
switch symbolType {
|
||||
case 0:
|
||||
key := fmt.Sprintf(global.TICKER_SPOT, global.EXCHANGE_BINANCE, symbol)
|
||||
val, _ = helper.DefaultRedis.GetString(key)
|
||||
case 1:
|
||||
key := fmt.Sprintf(global.TICKER_FUTURES, global.EXCHANGE_BINANCE, symbol)
|
||||
val, _ = helper.DefaultRedis.GetString(key)
|
||||
}
|
||||
|
||||
if val != "" {
|
||||
if err := sonic.Unmarshal([]byte(val), &result); err != nil {
|
||||
return result, err
|
||||
}
|
||||
} else {
|
||||
return result, errors.New("未找到交易对信息")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func GetRisk(futApi *FutRestApi, apiInfo *DbModels.LineApiUser, symbol string) []PositionRisk {
|
||||
for x := 0; x < 5; x++ {
|
||||
risks, _ := futApi.GetPositionV3(apiInfo, symbol)
|
||||
|
||||
Reference in New Issue
Block a user