Skip to content

Commit

Permalink
fix delivery without positionAmt bugs (#354)
Browse files Browse the repository at this point in the history
Co-authored-by: willshi <willshi@silot.ai>
  • Loading branch information
drinkthere and willshi-Silot committed Mar 14, 2022
1 parent 09e883c commit 0276e22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions v2/delivery/account_service.go
Expand Up @@ -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"`
Expand Down
7 changes: 7 additions & 0 deletions v2/delivery/account_service_test.go
Expand Up @@ -83,6 +83,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
"positions": [
{
"symbol": "BTCUSD_201225",
"positionAmt": "0",
"initialMargin": "0",
"maintMargin": "0",
"unrealizedProfit": "0.00000000",
Expand All @@ -96,6 +97,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
},
{
"symbol": "BTCUSD_201225",
"positionAmt": "0",
"initialMargin": "0",
"maintMargin": "0",
"unrealizedProfit": "0.00000000",
Expand All @@ -109,6 +111,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
},
{
"symbol": "BTCUSD_201225",
"positionAmt": "0",
"initialMargin": "0",
"maintMargin": "0",
"unrealizedProfit": "0.00000000",
Expand Down Expand Up @@ -156,6 +159,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
Positions: []*AccountPosition{
{
Symbol: "BTCUSD_201225",
PositionAmt: "0",
InitialMargin: "0",
MaintMargin: "0",
UnrealizedProfit: "0.00000000",
Expand All @@ -169,6 +173,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
},
{
Symbol: "BTCUSD_201225",
PositionAmt: "0",
InitialMargin: "0",
MaintMargin: "0",
UnrealizedProfit: "0.00000000",
Expand All @@ -182,6 +187,7 @@ func (s *accountServiceTestSuite) TestetAccount() {
},
{
Symbol: "BTCUSD_201225",
PositionAmt: "0",
InitialMargin: "0",
MaintMargin: "0",
UnrealizedProfit: "0.00000000",
Expand Down Expand Up @@ -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")
}
}

0 comments on commit 0276e22

Please sign in to comment.