Barter-Integration
High-performance, low-level framework for composing flexible web integrations. The core Socket abstraction provides customisable communication over any asynchronous protocol (WebSocket, FIX, etc.), with built-in translation between server & client data models.
Utilised by other Barter trading ecosystem crates to build robust financial exchange integrations,
primarily for public data collection & trade execution. It is:
- Low-Level: Translates raw data streams communicated over the web into any desired data model using arbitrary data transformations.
- Flexible: Compatible with any protocol (WebSocket, FIX, etc.), any input/output model, and any user defined transformations.
See: Barter, Barter-Data & Barter-Execution
Overview
Barter-Integration is a high-performance, low-level framework for composing flexible web integrations. It presents an
extensible core abstraction called the ExchangeStream. At a high level, an ExchangeStream is made up of a few
major components:
- Inner Stream/Sink (eg/ WebSocket, FIX socket, etc).
- ProtocolParser that is capable of parsing input protocol messages (eg/ WebSocket, FIX, etc.) as exchange specific message.
- Transformer that transforms from exchange specific message into an iterator of desired outputs.
Example
Consume Binance Futures tick-by-tick Trades and calculate a rolling sum of volume.
use ;
use ;
use ;
use json;
use FromStr;
use connect_async;
use debug;
// Convenient type alias for an `ExchangeStream` utilising a tungstenite `WebSocket`
type ExchangeWsStream<Exchange> = ;
// Communicative type alias for what the VolumeSum the Transformer is generating
type VolumeSum = f64;
/// See Barter-Data for a comprehensive real-life example, as well as code you can use out of the
/// box to collect real-time public market data from many exchanges.
async
/// Deserialize a `String` as the desired type.
For a larger, "real world" example, see the Barter-Data repository.
Getting Help
Firstly, see if the answer to your question can be found in the API Documentation. If the answer is not there, I'd be happy to help to Chat and try answer your question via Discord.
Contributing
Thanks for your help in improving the Barter ecosystem! Please do get in touch on the discord to discuss development, new features, and the future roadmap.
Related Projects
In addition to the Barter-Integration crate, the Barter project also maintains:
Barter: High-performance, extensible & modular trading components with batteries-included. Contains a pre-built trading Engine that can serve as a live-trading or backtesting system.Barter-Data: A high-performance WebSocket integration library for streaming public data from leading cryptocurrency exchanges.Barter-Execution: Financial exchange integrations for trade execution - yet to be released!
Roadmap
- Add new default ProtocolParser implementations to enable integration with other popular systems such as Kafka.
Licence
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Barter-Integration by you, shall be licensed as MIT, without any additional terms or conditions.