Skip to content

Commit 4e64702

Browse files
the-dev-zclaude
andcommitted
style: apply go fmt after rebase
Only formatting changes: - api/server.go: fix indentation - manager/trader_manager.go: add blank line - trader/partial_close_test.go: align struct fields 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7b529e2 commit 4e64702

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

api/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func (s *Server) handleSyncBalance(c *gin.Context) {
967967
actualBalance = totalBalance
968968
} else {
969969
c.JSON(http.StatusInternalServerError, gin.H{"error": "无法获取可用余额"})
970-
return
970+
return
971971
}
972972

973973
oldBalance := traderConfig.InitialBalance

manager/trader_manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ func (tm *TraderManager) LoadUserTraders(database *config.Database, userID strin
850850
// - database: 数据库实例
851851
// - userID: 用户ID
852852
// - traderID: 交易员ID
853+
//
853854
// 返回:
854855
// - error: 如果交易员不存在、配置无效或加载失败则返回错误
855856
func (tm *TraderManager) LoadTraderByID(database *config.Database, userID, traderID string) error {

trader/partial_close_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ func (m *MockTrader) SetTakeProfit(symbol, side string, quantity, price float64)
5858
// TestPartialCloseMinPositionCheck 測試最小倉位檢查邏輯
5959
func TestPartialCloseMinPositionCheck(t *testing.T) {
6060
tests := []struct {
61-
name string
62-
totalQuantity float64
63-
markPrice float64
64-
closePercentage float64
65-
expectFullClose bool // 是否應該觸發全平邏輯
66-
expectRemainValue float64
61+
name string
62+
totalQuantity float64
63+
markPrice float64
64+
closePercentage float64
65+
expectFullClose bool // 是否應該觸發全平邏輯
66+
expectRemainValue float64
6767
}{
6868
{
6969
name: "正常部分平倉_剩餘價值充足",
@@ -136,10 +136,10 @@ func TestPartialCloseMinPositionCheck(t *testing.T) {
136136
// TestPartialCloseWithStopLossTakeProfitRecovery 測試止盈止損恢復邏輯
137137
func TestPartialCloseWithStopLossTakeProfitRecovery(t *testing.T) {
138138
tests := []struct {
139-
name string
140-
newStopLoss float64
141-
newTakeProfit float64
142-
expectStopLoss bool
139+
name string
140+
newStopLoss float64
141+
newTakeProfit float64
142+
expectStopLoss bool
143143
expectTakeProfit bool
144144
}{
145145
{
@@ -258,16 +258,16 @@ func TestPartialCloseEdgeCases(t *testing.T) {
258258
// TestPartialCloseIntegration 整合測試(使用 mock trader)
259259
func TestPartialCloseIntegration(t *testing.T) {
260260
tests := []struct {
261-
name string
262-
symbol string
263-
side string
264-
totalQuantity float64
265-
markPrice float64
266-
closePercentage float64
267-
newStopLoss float64
268-
newTakeProfit float64
269-
expectFullClose bool
270-
expectStopLossCall bool
261+
name string
262+
symbol string
263+
side string
264+
totalQuantity float64
265+
markPrice float64
266+
closePercentage float64
267+
newStopLoss float64
268+
newTakeProfit float64
269+
expectFullClose bool
270+
expectStopLossCall bool
271271
expectTakeProfitCall bool
272272
}{
273273
{
@@ -304,9 +304,9 @@ func TestPartialCloseIntegration(t *testing.T) {
304304
mockTrader := &MockTrader{
305305
positions: []map[string]interface{}{
306306
{
307-
"symbol": tt.symbol,
308-
"side": tt.side,
309-
"quantity": tt.totalQuantity,
307+
"symbol": tt.symbol,
308+
"side": tt.side,
309+
"quantity": tt.totalQuantity,
310310
"markPrice": tt.markPrice,
311311
},
312312
},

0 commit comments

Comments
 (0)