Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public BalanceUpdateTimeSeriesBuilder add(long timestamp,
double depositing,
int scale) {

if (total < 0.0 || available < 0.0 || frozen < 0.0 || borrowed < 0.0 || loaned < 0.0 || withdrawing < 0.0 || depositing < 0.0) {
throw new RuntimeException("negative value is not allowed.");
}

writeLock.lock();
try {
Element element = new Element(timestamp, symbol, owner, updateCause, total, available, frozen, borrowed, loaned, withdrawing, depositing, scale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ private record Element(long timestamp, double open, double high, double low, dou
private Element[] elements = new Element[0];

public BarTimeSeriesBuilder add(long timestamp, double open, double high, double low, double close, double volume) {

if (open < 0.0 || high < 0.0 || low < 0.0 || close < 0.0 || volume < 0.0) {
throw new RuntimeException("negative value is not allowed.");
}

writeLock.lock();
try {
Element element = new Element(timestamp, open, high, low, close, volume);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public MyOrdersTimeSeriesBuilder add(long timestamp,
@Nullable OrderCondition orderCondition,
@Nullable String orderConditionRule) {

if (fee < 0.0 || price < 0.0 || limitPrice < 0.0 || stopPrice < 0.0 || takeProfitPrice < 0.0 || trailingPrice < 0.0 || initialAmount < 0.0 || executedAmount < 0.0) {
throw new RuntimeException("negative value is not allowed.");
}

writeLock.lock();
try {
Element element = new Element(timestamp, orderId, symbol, side, owner, tradeState, orderType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public OrderBookUpdateTimeSeriesBuilder add(long timestamp,
double askAmount,
double spread) {

if (bidPrice < 0.0 || askPrice < 0.0 || bidAmount < 0.0 || askAmount < 0.0 || spread < 0.0) {
throw new RuntimeException("negative value is not allowed.");
}

writeLock.lock();
try {
Element element = new Element(timestamp, bidOrderId, askOrderId, bidPrice, askPrice, bidAmount, askAmount, spread);
Expand Down
Loading