Skip to content

Commit a91fdcb

Browse files
committed
an order might not be immediately executed
1 parent 7ec2ff4 commit a91fdcb

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/com/bitso/Bitso.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,19 @@ public BigDecimal placeSellMarketOrder(BigDecimal majorToSpend, BitsoBook book)
281281
return null;
282282
}
283283

284+
public void waitUntilProcessed(String id) {
285+
while(true) {
286+
BitsoLookupOrders blo = lookupOrder(id);
287+
BookOrder bo = blo.list.get(0);
288+
if (bo.status == BookOrder.STATUS.COMPLETE) return;
289+
try {
290+
Thread.sleep(100);
291+
} catch (InterruptedException e) {
292+
e.printStackTrace();
293+
}
294+
}
295+
}
296+
284297
public String getDepositAddress() {
285298
return quoteEliminator(sendBitsoPost(baseUrl + "bitcoin_deposit_address"));
286299
}
@@ -585,6 +598,7 @@ public BookOrder findMatchingOrders(JSONObject o, BitsoBook book) {
585598
}
586599

587600
String id = o.getString("id");
601+
waitUntilProcessed(id);
588602
int counter = 0;
589603
if (++counter < 5) {
590604
BookOrder bo = findMatchingOrders(id, book);

0 commit comments

Comments
 (0)