From d76b9d55bbe2d9bf142aff5ca6827d495908c706 Mon Sep 17 00:00:00 2001 From: willshi Date: Sun, 13 Mar 2022 14:40:31 +0800 Subject: [PATCH] fix delivery without positionAmt bugs --- v2/delivery/account_service.go | 1 + v2/delivery/account_service_test.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/v2/delivery/account_service.go b/v2/delivery/account_service.go index f8294fd6..ee6fe57d 100644 --- a/v2/delivery/account_service.go +++ b/v2/delivery/account_service.go @@ -96,6 +96,7 @@ type AccountAsset struct { // AccountPosition define accoutn position type AccountPosition struct { Symbol string `json:"symbol"` + PositionAmt string `json:"positionAmt"` InitialMargin string `json:"initialMargin"` MaintMargin string `json:"maintMargin"` UnrealizedProfit string `json:"unrealizedProfit"` diff --git a/v2/delivery/account_service_test.go b/v2/delivery/account_service_test.go index 077ec53a..4e60aadd 100644 --- a/v2/delivery/account_service_test.go +++ b/v2/delivery/account_service_test.go @@ -83,6 +83,7 @@ func (s *accountServiceTestSuite) TestetAccount() { "positions": [ { "symbol": "BTCUSD_201225", + "positionAmt": "0", "initialMargin": "0", "maintMargin": "0", "unrealizedProfit": "0.00000000", @@ -96,6 +97,7 @@ func (s *accountServiceTestSuite) TestetAccount() { }, { "symbol": "BTCUSD_201225", + "positionAmt": "0", "initialMargin": "0", "maintMargin": "0", "unrealizedProfit": "0.00000000", @@ -109,6 +111,7 @@ func (s *accountServiceTestSuite) TestetAccount() { }, { "symbol": "BTCUSD_201225", + "positionAmt": "0", "initialMargin": "0", "maintMargin": "0", "unrealizedProfit": "0.00000000", @@ -156,6 +159,7 @@ func (s *accountServiceTestSuite) TestetAccount() { Positions: []*AccountPosition{ { Symbol: "BTCUSD_201225", + PositionAmt: "0", InitialMargin: "0", MaintMargin: "0", UnrealizedProfit: "0.00000000", @@ -169,6 +173,7 @@ func (s *accountServiceTestSuite) TestetAccount() { }, { Symbol: "BTCUSD_201225", + PositionAmt: "0", InitialMargin: "0", MaintMargin: "0", UnrealizedProfit: "0.00000000", @@ -182,6 +187,7 @@ func (s *accountServiceTestSuite) TestetAccount() { }, { Symbol: "BTCUSD_201225", + PositionAmt: "0", InitialMargin: "0", MaintMargin: "0", UnrealizedProfit: "0.00000000", @@ -240,5 +246,6 @@ func (s *accountServiceTestSuite) assertAccountEqual(e, a *Account) { r.Equal(e.Positions[i].PositionSide, a.Positions[i].PositionSide, "PositionSide") r.Equal(e.Positions[i].Symbol, a.Positions[i].Symbol, "Symbol") r.Equal(e.Positions[i].UnrealizedProfit, a.Positions[i].UnrealizedProfit, "UnrealizedProfit") + r.Equal(e.Positions[i].PositionAmt, a.Positions[i].PositionAmt, "PositionAmt") } }