Search in sources :

Example 1 with SynchronizedValueFactory

use of si.mazi.rescu.SynchronizedValueFactory in project XChange by knowm.

the class BleutradeExchangeIntegration method shouldCreateNonceFactory.

@Test
public void shouldCreateNonceFactory() {
    // when
    SynchronizedValueFactory factory = exchange.getNonceFactory();
    // then
    assertThat(factory).isNotNull();
    assertThat(factory instanceof AtomicLongIncrementalTime2013NonceFactory).isTrue();
}
Also used : AtomicLongIncrementalTime2013NonceFactory(org.knowm.xchange.utils.nonce.AtomicLongIncrementalTime2013NonceFactory) SynchronizedValueFactory(si.mazi.rescu.SynchronizedValueFactory) Test(org.junit.Test)

Example 2 with SynchronizedValueFactory

use of si.mazi.rescu.SynchronizedValueFactory in project XChange by knowm.

the class IdexExchange method getNonceFactory.

@Override
public SynchronizedValueFactory<Long> getNonceFactory() {
    return (SynchronizedValueFactory) () -> {
        Long ret = null;
        try {
            ReturnNextNonceResponse var10000 = getNextNonceApi().nextNonce(new NextNonceReq().address(getExchangeSpecification().getApiKey()));
            ret = var10000.getNonce().longValue();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ret;
    };
}
Also used : NextNonceReq(org.knowm.xchange.idex.dto.NextNonceReq) ReturnNextNonceResponse(org.knowm.xchange.idex.dto.ReturnNextNonceResponse) IOException(java.io.IOException) SynchronizedValueFactory(si.mazi.rescu.SynchronizedValueFactory)

Aggregations

SynchronizedValueFactory (si.mazi.rescu.SynchronizedValueFactory)2 IOException (java.io.IOException)1 Test (org.junit.Test)1 NextNonceReq (org.knowm.xchange.idex.dto.NextNonceReq)1 ReturnNextNonceResponse (org.knowm.xchange.idex.dto.ReturnNextNonceResponse)1 AtomicLongIncrementalTime2013NonceFactory (org.knowm.xchange.utils.nonce.AtomicLongIncrementalTime2013NonceFactory)1