Skip to content

Commit

Permalink
Parametrized valueFactory.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpysniak committed Jul 30, 2014
1 parent dd4fc79 commit 065b3d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,45 @@ public interface ItBitAuthenticated {
@GET
@Path("?userId={userId}")
@Consumes(MediaType.APPLICATION_JSON)
ItBitAccountInfoReturn[] getInfo(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitAccountInfoReturn[] getInfo(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("userId") String userId) throws IOException;

@GET
@Path("/{walletId}")
@Consumes(MediaType.APPLICATION_JSON)
ItBitAccountInfoReturn getWallet(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitAccountInfoReturn getWallet(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("walletId") String walletId) throws IOException;

@GET
@Path("/{walletId}/orders")
@Consumes(MediaType.APPLICATION_JSON)
ItBitOrder[] getOrders(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitOrder[] getOrders(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@QueryParam("instrument") String instrument, @QueryParam("page") String page, @QueryParam("perPage") String perPage, @QueryParam("status") String status, @PathParam("walletId") String walletId)
throws IOException;

@GET
@Path("/{walletId}/orders/{orderId}")
@Consumes(MediaType.APPLICATION_JSON)
ItBitOrder getOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitOrder getOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("walletId") String walletId, @PathParam("orderId") String orderId) throws IOException;

@POST
@Path("/{walletId}/orders")
@Consumes(MediaType.APPLICATION_JSON)
ItBitOrder postOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitOrder postOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("walletId") String walletId, ItBitPlaceOrderRequest request) throws IOException;

/** Returns empty body, return object is always null */
@DELETE
@Path("/{walletId}/orders/{orderId}")
@Consumes(MediaType.APPLICATION_JSON)
Object cancelOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
Object cancelOrder(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("walletId") String walletId, @PathParam("orderId") String orderId) throws IOException;

@POST
@Path("/{walletId}/cryptocurrency_withdrawals")
@Consumes(MediaType.APPLICATION_JSON)
ItBitOrder requestWithdrawal(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory valueFactory,
ItBitOrder requestWithdrawal(@HeaderParam("Authorization") ParamsDigest signer, @HeaderParam("X-Auth-Timestamp") long timestamp, @HeaderParam("X-Auth-Nonce") ValueFactory<Long> valueFactory,
@PathParam("walletId") String walletId, ItBitPlaceOrderRequest request) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ItBitBasePollingService extends BaseExchangeService implements Base
protected static final ValueFactory<Long> valueFactory = new ValueFactory() {

private final long START_MILLIS = 1356998400000L; // Jan 1st, 2013 in milliseconds from epoch
private final AtomicLong lastNonce = new AtomicLong((int) ((System.currentTimeMillis() - START_MILLIS) / 250L));
private final AtomicLong lastNonce = new AtomicLong((System.currentTimeMillis() - START_MILLIS) / 250L);

@Override
public Long createValue() {
Expand Down

0 comments on commit 065b3d3

Please sign in to comment.