package binanceservice

import (
	"go-admin/common/global"
	"go-admin/common/helper"
	"testing"

	"github.com/go-admin-team/go-admin-core/sdk"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

// 测试策略 触发单
func TestTriggerOrder(t *testing.T) {
	service := BinanceStrategyOrderService{}
	dsn := "root:123456@tcp(127.0.0.1:3306)/go_exchange_single?charset=utf8mb4&parseTime=True&loc=Local&timeout=1000ms"
	db, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{})
	helper.InitDefaultRedis("127.0.0.1:6379", "", 2)
	helper.InitLockRedisConn("127.0.0.1:6379", "", "2")
	sdk.Runtime.SetDb("default", db)

	service.Orm = db
	service.Debug = true

	service.TriggerStrategyOrder(global.EXCHANGE_BINANCE)
}
