use of org.knowm.xchange.btcturk.dto.account.BTCTurkUserTransactions in project XChange by knowm.
the class TradeDataFetchIntegration method Tests.
@Test
public void Tests() throws IOException, InterruptedException {
if (!BTCTurkDemoUtilsTest.BTCTURK_APIKEY.isEmpty()) {
// PlaceOrderAndOpenOrders Test
Thread.sleep(1000);
List<BTCTurkOpenOrders> openOrders = btcTurkTradeService.getBTCTurkOpenOrders(CurrencyPair.ETH_TRY);
Boolean result = false;
if (openOrders.isEmpty()) {
Thread.sleep(1000);
BTCTurkExchangeResult exchangeResult = btcTurkTradeService.placeLimitOrder(new BigDecimal("0.01"), new BigDecimal(713), CurrencyPair.ETH_TRY, BTCTurkOrderTypes.Sell);
Thread.sleep(1000);
result = btcTurkTradeService.cancelOrder(exchangeResult.getId());
} else {
result = btcTurkTradeService.cancelOrder(openOrders.get(0).getId());
}
assertThat(result).isEqualTo(true);
// UserTransactions Test
Thread.sleep(1000);
List<BTCTurkUserTransactions> userTransactions = btcTurkTradeService.getBTCTurkUserTransactions();
assertThat(userTransactions.size()).isEqualTo(25);
} else
assertThat(tradeService).isNotEqualTo(null);
}
use of org.knowm.xchange.btcturk.dto.account.BTCTurkUserTransactions in project XChange by knowm.
the class BTCTurkTradeService method getTradeHistory.
@Override
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
List<UserTrade> trades = new ArrayList<UserTrade>();
List<BTCTurkUserTransactions> transactions = super.getBTCTurkUserTransactions();
for (BTCTurkUserTransactions transaction : transactions) {
if (transaction.getOperation().equals(BTCTurkOperations.trade))
trades.add(new UserTrade.Builder().type(((transaction.getAmount().compareTo(BigDecimal.ZERO) > 0) ? OrderType.ASK : OrderType.BID)).originalAmount(transaction.getAmount()).price(transaction.getPrice()).timestamp(transaction.getDate()).id(transaction.getId()).feeAmount(transaction.getFee()).feeCurrency(transaction.getCurrency()).build());
}
long lastId = transactions.stream().map(t -> Long.parseLong(t.getId())).max(Long::compareTo).orElse(0L);
return new UserTrades(trades, lastId, TradeSortType.SortByTimestamp);
}
use of org.knowm.xchange.btcturk.dto.account.BTCTurkUserTransactions in project XChange by knowm.
the class BTCTurkAccountService method getFundingHistory.
@Override
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException {
List<FundingRecord> records = new ArrayList<>();
List<BTCTurkUserTransactions> transactions = super.getBTCTurkUserTransactions();
for (BTCTurkUserTransactions transaction : transactions) {
if (!transaction.getOperation().equals(BTCTurkOperations.trade))
records.add(BTCTurkAdapters.adaptTransaction(transaction));
}
return records;
}
Aggregations