github.com/mwlang/binance

Binance API wrappers for Crystal Language

Open this visualization on its own page →

Contributors

2

Lines of Code

990

From

2019-05-23

To

2020-11-10

About mwlang/binance

This is an unofficial Crystal language wrapper for the Binance cryptocurrency exchange, providing both REST and WebSocket API clients. The library supports both binance.com and binance.us endpoints and handles authentication automatically, allowing developers to interact with Binance trading services without manually generating cryptographic signatures. The wrapper deserializes JSON responses into strongly-typed Crystal objects called ServerResponse instances, making it easier to work with API data in a type-safe manner.

The REST API implementation covers a comprehensive range of endpoints, including public market data functions like ticker information, order book depth, and candlestick data, as well as authenticated user operations such as account information retrieval, order placement, order cancellation, and trade history queries. The WebSocket implementation supports streaming data for various market channels including aggregate trades, klines, ticker updates, and order book depth changes, with most streams providing deserialized JSON objects rather than raw hash data.

The project emphasizes test-driven development with a custom VCR-style recording system for capturing and replaying API interactions. Public API tests are committed to the repository with recorded cassettes, while authenticated API tests require developers to set up their own API credentials locally. The library requires Crystal version 0.35.1 or later and is designed to be developer-friendly with clear documentation, examples, and an expectation that contributions include comprehensive test coverage.

Share this video