Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix delivery API without positionAmt bugs #354

Merged
merged 1 commit into from Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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")
}
}