An open API service indexing awesome lists of open source software.

https://github.com/osslabz/mexc-client

A websocket client for the MEXC API
https://github.com/osslabz/mexc-client

crypto cryptocurrencies cryptocurrency exchange mexc mexc-api mexc-client mexc-java-client mexc-websocket-client websocket websocket-client

Last synced: about 1 year ago
JSON representation

A websocket client for the MEXC API

Awesome Lists containing this project

README

          

Mexc-Client
============
![GitHub](https://img.shields.io/github/license/osslabz/mexc-client)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/mexc-client/build-on-push.yml?branch=dev&label=build&logo=git)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/mexc-client/build-release-on-main-push.yml?branch=main&label=perform-release&logo=semanticrelease)
[![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/mexc-client?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/mexc-client)

Connects to [MEXC's Websocket API](https://www.mexc.com/mexc-api) and allows to subscribe 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
------

```xml

net.osslabz
mexc-client
0.0.1

```

Usage
------

```java

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.