forked from joaopsilva/binance-java-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[joaopsilva#26] UserDataStream new event.
- Loading branch information
Daniel
committed
Aug 21, 2019
1 parent
f51ee15
commit 976d2c8
Showing
5 changed files
with
302 additions
and
12 deletions.
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
src/main/java/com/binance/api/client/domain/event/ListStatusEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
package com.binance.api.client.domain.event; | ||
|
||
import com.binance.api.client.domain.account.Order; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
|
||
import java.util.List; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class ListStatusEvent { | ||
|
||
@JsonProperty("e") | ||
private String eventType; | ||
|
||
@JsonProperty("E") | ||
private long eventTime; | ||
|
||
@JsonProperty("s") | ||
private String symbol; | ||
|
||
@JsonProperty("g") | ||
private long orderListId; | ||
|
||
@JsonProperty("c") | ||
private String contingencyType; | ||
|
||
@JsonProperty("l") | ||
private String listStatusType; | ||
|
||
@JsonProperty("L") | ||
private String listOrderStatus; | ||
|
||
@JsonProperty("r") | ||
private String listRejectReason; | ||
|
||
@JsonProperty("C") | ||
private String listClientOrderId; | ||
|
||
@JsonProperty("T") | ||
private long transactionTime; | ||
|
||
@JsonProperty("O") | ||
@JsonDeserialize(contentUsing = OrderDeserializer.class) | ||
private List<Order> orders; | ||
|
||
public String getEventType() { | ||
return eventType; | ||
} | ||
|
||
public void setEventType(String eventType) { | ||
this.eventType = eventType; | ||
} | ||
|
||
public long getEventTime() { | ||
return eventTime; | ||
} | ||
|
||
public void setEventTime(long eventTime) { | ||
this.eventTime = eventTime; | ||
} | ||
|
||
public String getSymbol() { | ||
return symbol; | ||
} | ||
|
||
public void setSymbol(String symbol) { | ||
this.symbol = symbol; | ||
} | ||
|
||
public long getOrderListId() { | ||
return orderListId; | ||
} | ||
|
||
public void setOrderListId(long orderListId) { | ||
this.orderListId = orderListId; | ||
} | ||
|
||
public String getContingencyType() { | ||
return contingencyType; | ||
} | ||
|
||
public void setContingencyType(String contingencyType) { | ||
this.contingencyType = contingencyType; | ||
} | ||
|
||
public String getListStatusType() { | ||
return listStatusType; | ||
} | ||
|
||
public void setListStatusType(String listStatusType) { | ||
this.listStatusType = listStatusType; | ||
} | ||
|
||
public String getListOrderStatus() { | ||
return listOrderStatus; | ||
} | ||
|
||
public void setListOrderStatus(String listOrderStatus) { | ||
this.listOrderStatus = listOrderStatus; | ||
} | ||
|
||
public String getListRejectReason() { | ||
return listRejectReason; | ||
} | ||
|
||
public void setListRejectReason(String listRejectReason) { | ||
this.listRejectReason = listRejectReason; | ||
} | ||
|
||
public String getListClientOrderId() { | ||
return listClientOrderId; | ||
} | ||
|
||
public void setListClientOrderId(String listClientOrderId) { | ||
this.listClientOrderId = listClientOrderId; | ||
} | ||
|
||
public long getTransactionTime() { | ||
return transactionTime; | ||
} | ||
|
||
public void setTransactionTime(long transactionTime) { | ||
this.transactionTime = transactionTime; | ||
} | ||
|
||
public List<Order> getOrders() { | ||
return orders; | ||
} | ||
|
||
public void setOrders(List<Order> orders) { | ||
this.orders = orders; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ListStatusEvent{" + | ||
"eventType='" + eventType + '\'' + | ||
", eventTime=" + eventTime + | ||
", symbol='" + symbol + '\'' + | ||
", orderListId=" + orderListId + | ||
", contingencyType='" + contingencyType + '\'' + | ||
", listStatusType='" + listStatusType + '\'' + | ||
", listOrderStatus='" + listOrderStatus + '\'' + | ||
", listRejectReason='" + listRejectReason + '\'' + | ||
", listClientOrderId='" + listClientOrderId + '\'' + | ||
", transactionTime=" + transactionTime + | ||
", orders=" + orders + | ||
'}'; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/binance/api/client/domain/event/OrderDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.binance.api.client.domain.event; | ||
|
||
import com.binance.api.client.domain.account.Order; | ||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.ObjectCodec; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
import java.io.IOException; | ||
|
||
public class OrderDeserializer extends JsonDeserializer<Order> { | ||
|
||
@Override | ||
public Order deserialize(JsonParser jp, DeserializationContext ctx) throws IOException { | ||
ObjectCodec oc = jp.getCodec(); | ||
JsonNode node = oc.readTree(jp); | ||
final String symbol = node.get("s").asText(); | ||
final long orderId = node.get("i").asLong(); | ||
final String clientOrderId = node.get("c").asText(); | ||
|
||
Order order = new Order(); | ||
order.setSymbol(symbol); | ||
order.setOrderId(orderId); | ||
order.setClientOrderId(clientOrderId); | ||
return order; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/main/java/com/binance/api/client/domain/event/OutboundAccountPositionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.binance.api.client.domain.event; | ||
|
||
import com.binance.api.client.domain.account.AssetBalance; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
import org.apache.commons.lang3.builder.ToStringStyle; | ||
|
||
import java.util.List; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class OutboundAccountPositionEvent { | ||
|
||
@JsonProperty("e") | ||
private String eventType; | ||
|
||
@JsonProperty("E") | ||
private long eventTime; | ||
|
||
@JsonProperty("u") | ||
private long lastAccountUpdate; | ||
|
||
@JsonProperty("B") | ||
@JsonDeserialize(contentUsing = AssetBalanceDeserializer.class) | ||
private List<AssetBalance> balances; | ||
|
||
public String getEventType() { | ||
return eventType; | ||
} | ||
|
||
public void setEventType(String eventType) { | ||
this.eventType = eventType; | ||
} | ||
|
||
public long getEventTime() { | ||
return eventTime; | ||
} | ||
|
||
public void setEventTime(long eventTime) { | ||
this.eventTime = eventTime; | ||
} | ||
|
||
public long getLastAccountUpdate() { | ||
return lastAccountUpdate; | ||
} | ||
|
||
public void setLastAccountUpdate(long lastAccountUpdate) { | ||
this.lastAccountUpdate = lastAccountUpdate; | ||
} | ||
|
||
public List<AssetBalance> getBalances() { | ||
return balances; | ||
} | ||
|
||
public void setBalances(List<AssetBalance> balances) { | ||
this.balances = balances; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) | ||
.append("eventType", eventType) | ||
.append("eventTime", eventTime) | ||
.append("lastAccountUpdate", lastAccountUpdate) | ||
.append("balances", balances) | ||
.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters