File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ func toGlobalPositionRisk(positions []binanceapi.FuturesPositionRisk) []types.Po
285
285
for i , position := range positions {
286
286
retPositions [i ] = types.PositionRisk {
287
287
LiquidationPrice : position .LiquidationPrice ,
288
- PositionSide : types . PositionType (position .PositionSide ),
288
+ PositionSide : toGlobalPositionSide (position .PositionSide ),
289
289
Symbol : position .Symbol ,
290
290
MarkPrice : position .MarkPrice ,
291
291
EntryPrice : position .EntryPrice ,
@@ -304,3 +304,14 @@ func toGlobalPositionRisk(positions []binanceapi.FuturesPositionRisk) []types.Po
304
304
}
305
305
return retPositions
306
306
}
307
+
308
+ func toGlobalPositionSide (positionSide string ) types.PositionType {
309
+ switch positionSide {
310
+ case "LONG" :
311
+ return types .PositionLong
312
+ case "SHORT" :
313
+ return types .PositionShort
314
+ default :
315
+ return types .PositionType (positionSide )
316
+ }
317
+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ func TestToGlobalPositionRisk(t *testing.T) {
37
37
38
38
risk := risks [0 ]
39
39
assert .Equal (t , "BTCUSDT" , risk .Symbol )
40
- assert .Equal (t , types .PositionType ( "LONG" ) , risk .PositionSide )
40
+ assert .Equal (t , types .PositionLong , risk .PositionSide )
41
41
assert .Equal (t , fixedpoint .MustNewFromString ("51000" ), risk .MarkPrice )
42
42
assert .Equal (t , fixedpoint .MustNewFromString ("50000" ), risk .EntryPrice )
43
43
assert .Equal (t , fixedpoint .MustNewFromString ("1.0" ), risk .PositionAmount )
You can’t perform that action at this time.
0 commit comments