Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clients/margin-trading/docs/MarginAccountNewOrderResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
|**type** | **String** | type. | [optional] |
|**side** | **String** | side. | [optional] |
|**selfTradePreventionMode** | **String** | self Trade Prevention Mode. | [optional] |
|**marginBuyBorrowAmount** | **Long** | margin Buy Borrow Amount. | [optional] |
|**marginBuyBorrowAmount** | **String** | margin Buy Borrow Amount. | [optional] |
|**marginBuyBorrowAsset** | **String** | margin Buy Borrow Asset. | [optional] |
|**fills** | [**List<MarginAccountNewOrderResponseFillsInner>**](MarginAccountNewOrderResponseFillsInner.md) | fills list. | [optional] |



Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class MarginAccountNewOrderResponse {

@SerializedName(SERIALIZED_NAME_MARGIN_BUY_BORROW_AMOUNT)
@jakarta.annotation.Nullable
private Long marginBuyBorrowAmount;
private String marginBuyBorrowAmount;

public static final String SERIALIZED_NAME_MARGIN_BUY_BORROW_ASSET = "marginBuyBorrowAsset";

Expand Down Expand Up @@ -422,7 +422,7 @@ public void setSelfTradePreventionMode(
}

public MarginAccountNewOrderResponse marginBuyBorrowAmount(
@jakarta.annotation.Nullable Long marginBuyBorrowAmount) {
@jakarta.annotation.Nullable String marginBuyBorrowAmount) {
this.marginBuyBorrowAmount = marginBuyBorrowAmount;
return this;
}
Expand All @@ -433,11 +433,11 @@ public MarginAccountNewOrderResponse marginBuyBorrowAmount(
* @return marginBuyBorrowAmount
*/
@jakarta.annotation.Nullable
public Long getMarginBuyBorrowAmount() {
public String getMarginBuyBorrowAmount() {
return marginBuyBorrowAmount;
}

public void setMarginBuyBorrowAmount(@jakarta.annotation.Nullable Long marginBuyBorrowAmount) {
public void setMarginBuyBorrowAmount(@jakarta.annotation.Nullable String marginBuyBorrowAmount) {
this.marginBuyBorrowAmount = marginBuyBorrowAmount;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.binance.connector.client.margin_trading.rest.model;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.io.IOException;
import org.junit.jupiter.api.Test;

class MarginAccountNewOrderResponseTest {

@Test
void deserializesFractionalBorrowAmount() throws IOException {
MarginAccountNewOrderResponse response =
MarginAccountNewOrderResponse.fromJson("{\"marginBuyBorrowAmount\":\"0.001\"}");

assertEquals("0.001", response.getMarginBuyBorrowAmount());
assertEquals("0.001", MarginAccountNewOrderResponse.fromJson(response.toJson())
.getMarginBuyBorrowAmount());
}

@Test
void deserializesNumericFractionalBorrowAmount() throws IOException {
MarginAccountNewOrderResponse response =
MarginAccountNewOrderResponse.fromJson("{\"marginBuyBorrowAmount\":0.001}");

assertEquals("0.001", response.getMarginBuyBorrowAmount());
}

@Test
void preservesBorrowAmountScale() throws IOException {
MarginAccountNewOrderResponse response =
MarginAccountNewOrderResponse.fromJson(
"{\"marginBuyBorrowAmount\":\"0.00100\"}");

assertEquals("0.00100", response.getMarginBuyBorrowAmount());
}

@Test
void allowsNullOrMissingBorrowAmount() throws IOException {
assertNull(
MarginAccountNewOrderResponse.fromJson("{\"marginBuyBorrowAmount\":null}")
.getMarginBuyBorrowAmount());
assertNull(MarginAccountNewOrderResponse.fromJson("{}").getMarginBuyBorrowAmount());
}
}