Skip to content

Latest commit

 

History

History
132 lines (105 loc) · 7.38 KB

README.md

File metadata and controls

132 lines (105 loc) · 7.38 KB

Maven Central

Aevo4J

What is Aevo4J?

Aevo4J is an unofficial implementation of Aevo's REST APIs and WebSockets in Java.

What is Aevo?

Aevo is a decentralized derivatives exchange built on Ethereum.

Receive a 10% discount on trading fees for 6 months + $25 credit after depositing $100+ by using our referral!

Features

  • Full coverage of the REST APIs and WebSockets
  • Automatic deserialization of responses into Java objects
  • Automatic authentication for private endpoints (REST APIs and WebSockets)
  • Orderbook checksum validator
  • Built-in order-signing for placing/editing orders

How Do I Use Aevo4J In My Project?

Note: Aevo4J requires Java 17 or higher!

Importing from Maven or Gradle

Maven

<dependency>
    <groupId>dev.alphaserpentis.web3</groupId>
    <artifactId>aevo4j</artifactId>
    <version>1.2.0</version>
</dependency>

Gradle

implementation 'dev.alphaserpentis.web3:aevo4j:1.2.0'

REST APIs

The PublicService and PrivateService class contains the REST APIs for the public and private endpoints respectively. These can be obtained via AevoHandler.getPublicService(Retrofit) or AevoHandler.getPrivateService(Retrofit, String, String, Boolean).

For Retrofit, you can either obtain a default Retrofit instance via AevoHandler.defaultRetrofit() and pass it inside the service. Alternatively, if you need to customize Retrofit for your needs, you can call the AevoHandler.getCustomRetrofit method and pass in your needed arguments.

Private Operations

Authentication

To authenticate a request, you have two methods:

  1. Use API Key + API Secret
  2. Use API Key + Signature + Timestamp (recommended)

Both methods are automatically handled by the library.

See the REST Authentication for more information.

Customizing Retrofit

The AevoHandler class has a method getCustomRetrofit available to pass in a custom call adapter factory and converter factory. However, you're not required to call this method if you need more customization.


WebSockets

You can get the websockets from the methods found in PublicWebSockets and PrivateWebSockets.

Alternatively, you can obtain the needed websockets from this table below:

Channel WebSocket Listener Class API Type
PUBLISH Channels ChannelsListener Public
PUBLISH Ping PingListener Public
SUBSCRIBE Orderbook OrderbookListener Public
SUBSCRIBE Ticker TickerListener Public
SUBSCRIBE Index IndexListener Public
SUBSCRIBE Trades TradesListener Public
SUBSCRIBE RFQs RFQsListener Public
PUBLISH Status StatusListener Private
PUBLISH Create Order CreateOrderListener Private
PUBLISH Edit Order EditOrderListener Private
PUBLISH Cancel Order CancelOrderListener Private
PUBLISH Cancel All Orders CancelAllOrdersListener Private
PUBLISH Create RFQ CreateRFQListener Private
PUBLISH Cancel RFQ CancelRFQListener Private
PUBLISH Create Quote RFQ CreateQuoteRFQListener Private
SUBSCRIBE Orders OrdersListener Private
SUBSCRIBE Fills FillsListener Private
SUBSCRIBE Positions PositionsListener Private

Authentication

Requests using private websockets are automatically authenticated by the library.


Order Signing

In order to place orders in either the REST APIs or WebSockets, you will need to be able to pass in a signature parameter. This signature is generated by signing the order payload with the signing key that was generated from the Aevo website.

See the Signing Orders for more information.

Example

  • Instrument ID: 2054 (Testnet ETH-PERP)
  • Side: BUY
  • Amount: 1.0 (contracts)
  • Price: 1000.0 (USD)
// Create the order payload
UnsignedOrder order = new UnsignedOrder.Builder(
        2054, // Instrument ID
        "YOUR WALLET ADDRESS", // maker address
        true, // true = buy, false = sell
        1000000, // amount of contracts (1.0)
        1000000000 // price in USD (1000.0)
).build();

// Sign the unsigned order
SignedOrder signedOrder = UnsignedOrder.signOrder(
        order, // the unsigned order payload
        true, // true if testnet, false if mainnet
        "YOUR SIGNING KEY" // the signing key generated from the Aevo website
);

Dependencies