Search in sources :

Example 1 with DownloadResult

use of io.everytrade.server.plugin.api.connector.DownloadResult in project everytrade-plugins by everytrade-io.

the class BlockchainDownloaderTest method btcBuySellWithFeesTest.

@Test
void btcBuySellWithFeesTest() {
    List<TxInfo> txs = List.of(depositOnAddress(ADDRESS, 1_000_000), withdrawalFromAddress(ADDRESS, 100_000));
    var blockchainDownloader = new BlockchainDownloader(mockClient(txs), null, 0, emptySet(), FIAT, BTC, true, true, true, true);
    DownloadResult result = blockchainDownloader.download(ADDRESS);
    var buyCluster = findOneCluster(result, BUY);
    assertBuySell(buyCluster, BUY, new BigDecimal("0.009999"));
    assertFees(buyCluster);
    var sellCluster = findOneCluster(result, SELL);
    assertBuySell(sellCluster, SELL, new BigDecimal("0.000999"));
    assertFees(sellCluster);
}
Also used : TxInfo(com.generalbytes.bitrafael.server.api.dto.TxInfo) DownloadResult(io.everytrade.server.plugin.api.connector.DownloadResult) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 2 with DownloadResult

use of io.everytrade.server.plugin.api.connector.DownloadResult in project everytrade-plugins by everytrade-io.

the class BlockchainDownloaderTest method btcDepositWithdrawalWithoutFeesTest.

@Test
void btcDepositWithdrawalWithoutFeesTest() {
    List<TxInfo> txs = List.of(depositOnAddress(ADDRESS, 1_000_000), withdrawalFromAddress(ADDRESS, 100_000));
    var blockchainDownloader = new BlockchainDownloader(mockClient(txs), null, 0, emptySet(), FIAT, BTC, false, false, false, false);
    DownloadResult result = blockchainDownloader.download(ADDRESS);
    var depositCluster = findOneCluster(result, DEPOSIT);
    assertEquals(0, depositCluster.getRelated().size());
    assertDepositWithdrawal(depositCluster, DEPOSIT, new BigDecimal("0.009999"));
    var withdrawalCluster = findOneCluster(result, WITHDRAWAL);
    assertEquals(0, withdrawalCluster.getRelated().size());
    assertDepositWithdrawal(withdrawalCluster, WITHDRAWAL, new BigDecimal("0.000999"));
}
Also used : TxInfo(com.generalbytes.bitrafael.server.api.dto.TxInfo) DownloadResult(io.everytrade.server.plugin.api.connector.DownloadResult) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 3 with DownloadResult

use of io.everytrade.server.plugin.api.connector.DownloadResult in project everytrade-plugins by everytrade-io.

the class BlockchainDownloaderTest method btcDepositWithdrawalWithFeesTest.

@Test
void btcDepositWithdrawalWithFeesTest() {
    List<TxInfo> txs = List.of(depositOnAddress(ADDRESS, 1_000_000), withdrawalFromAddress(ADDRESS, 100_000));
    var blockchainDownloader = new BlockchainDownloader(mockClient(txs), null, 0, emptySet(), FIAT, BTC, false, false, true, true);
    DownloadResult result = blockchainDownloader.download(ADDRESS);
    var depositCluster = findOneCluster(result, DEPOSIT);
    assertEquals(0, depositCluster.getRelated().size());
    assertDepositWithdrawal(depositCluster, DEPOSIT, new BigDecimal("0.009999"));
    var withdrawalCluster = findOneCluster(result, WITHDRAWAL);
    assertEquals(0, withdrawalCluster.getRelated().size());
    assertDepositWithdrawal(withdrawalCluster, WITHDRAWAL, new BigDecimal("0.000999"));
}
Also used : TxInfo(com.generalbytes.bitrafael.server.api.dto.TxInfo) DownloadResult(io.everytrade.server.plugin.api.connector.DownloadResult) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 4 with DownloadResult

use of io.everytrade.server.plugin.api.connector.DownloadResult in project everytrade-plugins by everytrade-io.

the class BlockchainEthDownloaderTest method ethBuySellWithoutFeesTest.

@Test
void ethBuySellWithoutFeesTest() throws Exception {
    var txs = List.of(depositOnAddress(ADDRESS, ONE_ETH.multiply(TEN)), withdrawFromAddress(ADDRESS, ONE_ETH));
    var downloader = new BlockchainEthDownloader(ADDRESS, "apiKey", FIAT, true, true, false, false, mockClient(txs, emptyList()));
    DownloadResult result = downloader.download(null);
    var buyCluster = findOneCluster(result, BUY);
    assertEquals(0, buyCluster.getRelated().size());
    assertBuySell(buyCluster, BUY, TEN);
    var sellCluster = findOneCluster(result, SELL);
    assertEquals(0, sellCluster.getRelated().size());
    assertBuySell(sellCluster, SELL, ONE);
}
Also used : DownloadResult(io.everytrade.server.plugin.api.connector.DownloadResult) Test(org.junit.jupiter.api.Test)

Example 5 with DownloadResult

use of io.everytrade.server.plugin.api.connector.DownloadResult in project everytrade-plugins by everytrade-io.

the class CoinbaseConnector method getTransactions.

@Override
public DownloadResult getTransactions(String lastTransactionId) {
    CoinbaseDownloader coinbaseDownloader = new CoinbaseDownloader(exchange);
    DownloadResult download = coinbaseDownloader.download(lastTransactionId);
    return download;
}
Also used : DownloadResult(io.everytrade.server.plugin.api.connector.DownloadResult)

Aggregations

DownloadResult (io.everytrade.server.plugin.api.connector.DownloadResult)16 Test (org.junit.jupiter.api.Test)8 TxInfo (com.generalbytes.bitrafael.server.api.dto.TxInfo)5 ParseResult (io.everytrade.server.plugin.api.parser.ParseResult)4 BigDecimal (java.math.BigDecimal)4 ArrayList (java.util.ArrayList)3 ParsingProblem (io.everytrade.server.plugin.api.parser.ParsingProblem)2 TransactionCluster (io.everytrade.server.plugin.api.parser.TransactionCluster)2 AddressInfo (com.generalbytes.bitrafael.server.api.dto.AddressInfo)1 Transaction (com.generalbytes.bitrafael.tools.transaction.Transaction)1 OrderInfo (com.okcoin.commons.okex.open.api.bean.spot.result.OrderInfo)1 APIConfiguration (com.okcoin.commons.okex.open.api.config.APIConfiguration)1 SpotOrderAPIServive (com.okcoin.commons.okex.open.api.service.spot.SpotOrderAPIServive)1 SpotOrderApiServiceImpl (com.okcoin.commons.okex.open.api.service.spot.impl.SpotOrderApiServiceImpl)1 SupportedExchange (io.everytrade.server.model.SupportedExchange)1 EveryTradeApiTransactionBean (io.everytrade.server.parser.exchange.EveryTradeApiTransactionBean)1 GbApiTransactionBean (io.everytrade.server.parser.exchange.GbApiTransactionBean)1 ConnectorDescriptor (io.everytrade.server.plugin.api.connector.ConnectorDescriptor)1 IConnector (io.everytrade.server.plugin.api.connector.IConnector)1 KeyManagementException (java.security.KeyManagementException)1