Skip to content

osslabz/mexc-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mexc-Client

GitHub GitHub Workflow Status Maven Central

Connects to MEXC's Websocket API and allows to subscrive to various data channels.

Features:

  • OHLC streaming for all supported intervals
  • Robust connection lost detection with automatic re-connect and resubscribe to previously subscribed topics

QuickStart

Maven

<dependency>
    <groupId>net.osslabz</groupId>
    <artifactId>mexc-client</artifactId>
    <version>0.0.1</version>
</dependency>

Usage

MexcClient client = new MexcClient();
client.subscribe(new CurrencyPair("BTC", "USDT"), Interval.PT1M, ohlc -> {
    log.debug("{}", ohlc);
});


client.unsubscribe(new CurrencyPair("BTC", "USDT"), Interval.PT1M);
client.close();

Logging

This project uses slf4j-api but doesn't package an implementation. This is up to the using application. For the tests logback is backing slf4j as implementation, with a default configuration logging to STOUT.

Compatibility

mexc-client targets Java 17.