{"id":13601569,"url":"https://github.com/barter-rs/barter-data-rs","last_synced_at":"2025-04-11T04:31:07.150Z","repository":{"id":61160326,"uuid":"548482991","full_name":"barter-rs/barter-data-rs","owner":"barter-rs","description":"NOTE: Barter-Data migrated to Barter monorepo: https://www.github.com/barter-rs/barter-rs","archived":true,"fork":false,"pushed_at":"2024-07-12T20:14:01.000Z","size":859,"stargazers_count":102,"open_issues_count":0,"forks_count":62,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-10-13T18:57:37.829Z","etag":null,"topics":["algo-trading","algorithmic-trading","algotrading","backtesting","backtesting-engine","backtesting-frameworks","backtesting-trading-strategies","crypto-bot","event-driven","hft","high-frequency-trading","market-making","quant","quantitative-finance","rust","trading-bot","trading-platform","trading-simulator","trading-strategies","trading-systems"],"latest_commit_sha":null,"homepage":"https://github.com/orgs/barter-rs/repositories","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barter-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-09T17:00:33.000Z","updated_at":"2024-10-11T02:30:05.000Z","dependencies_parsed_at":"2024-01-13T19:40:32.748Z","dependency_job_id":"f475d00d-1f4e-4c59-a0b7-039789edd32e","html_url":"https://github.com/barter-rs/barter-data-rs","commit_stats":{"total_commits":329,"total_committers":10,"mean_commits":32.9,"dds":"0.45592705167173253","last_synced_commit":"a6abe29e9c6195b40ba6c7c31f9586d9a534c112"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barter-rs%2Fbarter-data-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barter-rs%2Fbarter-data-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barter-rs%2Fbarter-data-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barter-rs%2Fbarter-data-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barter-rs","download_url":"https://codeload.github.com/barter-rs/barter-data-rs/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223458422,"owners_count":17148465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algo-trading","algorithmic-trading","algotrading","backtesting","backtesting-engine","backtesting-frameworks","backtesting-trading-strategies","crypto-bot","event-driven","hft","high-frequency-trading","market-making","quant","quantitative-finance","rust","trading-bot","trading-platform","trading-simulator","trading-strategies","trading-systems"],"created_at":"2024-08-01T18:01:04.736Z","updated_at":"2024-11-07T04:31:08.191Z","avatar_url":"https://github.com/barter-rs.png","language":"Rust","funding_links":[],"categories":["Rust","algorithmic-trading"],"sub_categories":[],"readme":"\n# Barter-Data\n\n**NOTE: This repository has been migrated to the new Barter monorepo: https://www.github.com/barter-rs/barter-rs**\n\n**This repo is still accessible due to historical \u0026 SEO purposes, but it will be archived / removed in the upcoming weeks.**\n\n\nA high-performance WebSocket integration library for streaming public market data from leading cryptocurrency \nexchanges - batteries included. It is:\n* **Easy**: Barter-Data's simple StreamBuilder interface allows for easy \u0026 quick setup (see example below!).\n* **Normalised**: Barter-Data's unified interface for consuming public WebSocket data means every Exchange returns a normalised data model.\n* **Real-Time**: Barter-Data utilises real-time WebSocket integrations enabling the consumption of normalised tick-by-tick data.\n* **Extensible**: Barter-Data is highly extensible, and therefore easy to contribute to with coding new integrations!\n\n**See: [`Barter`], [`Barter-Integration`], [`Barter-Execution`] \u0026 [`Barter-Macro`]**\n\n[![Crates.io][crates-badge]][crates-url]\n[![MIT licensed][mit-badge]][mit-url]\n[![Build Status][actions-badge]][actions-url]\n[![Discord chat][discord-badge]][discord-url]\n\n[crates-badge]: https://img.shields.io/crates/v/barter-data.svg\n[crates-url]: https://crates.io/crates/barter-data\n\n[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[mit-url]: https://gitlab.com/open-source-keir/financial-modelling/trading/barter-data-rs/-/blob/main/LICENCE\n\n[actions-badge]: https://gitlab.com/open-source-keir/financial-modelling/trading/barter-data-rs/badges/-/blob/main/pipeline.svg\n[actions-url]: https://gitlab.com/open-source-keir/financial-modelling/trading/barter-data-rs/-/commits/main\n\n[discord-badge]: https://img.shields.io/discord/910237311332151317.svg?logo=discord\u0026style=flat-square\n[discord-url]: https://discord.gg/wE7RqhnQMV\n\n[API Documentation] |\n[Chat]\n\n[`Barter`]: https://crates.io/crates/barter\n[`Barter-Integration`]: https://crates.io/crates/barter-integration\n[`Barter-Execution`]: https://crates.io/crates/barter-execution\n[`Barter-Macro`]: https://crates.io/crates/barter-macro\n[API Documentation]: https://docs.rs/barter-data/latest/barter_data\n[Chat]: https://discord.gg/wE7RqhnQMV\n\n## Overview\nBarter-Data is a high-performance WebSocket integration library for streaming public market data from leading cryptocurrency \nexchanges. It presents an easy-to-use and extensible set of interfaces that can deliver normalised exchange data in real-time.\n\nFrom a user perspective, the major component is the `StreamBuilder` structures that assists in initialising an \narbitrary number of exchange `MarketStream`s using input `Subscription`s. Simply build your dream set of \n`MarketStreams` and `Barter-Data` will do the rest!\n\n### Supported Exchange Subscriptions\n\n|        Exchange         |         Constructor Code         |               InstrumentKinds               |                SubscriptionKinds                 |\n|:-----------------------:|:--------------------------------:|:-------------------------------------------:|:------------------------------------------------:|\n|     **BinanceSpot**     |     `BinanceSpot::default()`     |                    Spot                     | PublicTrades \u003cbr\u003e OrderBooksL1 \u003cbr\u003e OrderBooksL2 |\n|  **BinanceFuturesUsd**  |  `BinanceFuturesUsd::default()`  |                  Perpetual                  | PublicTrades \u003cbr\u003e OrderBooksL1 \u003cbr\u003e OrderBooksL2 |\n|      **Bitfinex**       |            `Bitfinex`            |                    Spot                     |                   PublicTrades                   |\n|       **Bitmex**        |             `Bitmex`             |                  Perpetual                  |                   PublicTrades                   |\n|      **BybitSpot**      |      `BybitSpot::default()`      |                    Spot                     |                   PublicTrades                   |\n| **BybitPerpetualsUsd**  | `BybitPerpetualsUsd::default()`  |                  Perpetual                  |                   PublicTrades                   |\n|      **Coinbase**       |            `Coinbase`            |                    Spot                     |                   PublicTrades                   |\n|     **GateioSpot**      |     `GateioSpot::default()`      |                    Spot                     |                   PublicTrades                   |\n|  **GateioFuturesUsd**   |  `GateioFuturesUsd::default()`   |                   Future                    |                   PublicTrades                   |\n|  **GateioFuturesBtc**   |  `GateioFuturesBtc::default()`   |                   Future                    |                   PublicTrades                   |\n| **GateioPerpetualsUsd** | `GateioPerpetualsUsd::default()` |                  Perpetual                  |                   PublicTrades                   |\n| **GateioPerpetualsBtc** | `GateioPerpetualsBtc::default()` |                  Perpetual                  |                   PublicTrades                   |\n|  **GateioOptionsBtc**   |    `GateioOptions::default()`    |                   Option                    |                   PublicTrades                   |\n|       **Kraken**        |             `Kraken`             |                    Spot                     |          PublicTrades \u003cbr\u003e OrderBooksL1          |\n|         **Okx**         |              `Okx`               | Spot \u003cbr\u003e Future \u003cbr\u003e Perpetual \u003cbr\u003e Option |                   PublicTrades                   |\n\n\n## Examples\nSee barter-data-rs/examples for a more comprehensive selection of examples! \n\n### Multi Exchange Public Trades\n```rust,no_run\nuse barter_data::{\n    exchange::{\n        binance::{futures::BinanceFuturesUsd, spot::BinanceSpot},\n        bitmex::Bitmex,\n        bybit::{futures::BybitPerpetualsUsd, spot::BybitSpot},\n        coinbase::Coinbase,\n        gateio::{\n            option::GateioOptions,\n            perpetual::{GateioPerpetualsBtc, GateioPerpetualsUsd},\n            spot::GateioSpot,\n        },\n        okx::Okx,\n    },\n    streams::Streams,\n    subscription::trade::PublicTrades,\n};\nuse barter_integration::model::instrument::kind::{\n    FutureContract, InstrumentKind, OptionContract, OptionExercise, OptionKind,\n};\nuse chrono::{TimeZone, Utc};\nuse futures::StreamExt;\nuse tracing::info;\n\n#[tokio::main]\nasync fn main() {\n    // Initialise PublicTrades Streams for various exchanges\n    // '--\u003e each call to StreamBuilder::subscribe() creates a separate WebSocket connection\n    let streams = Streams::\u003cPublicTrades\u003e::builder()\n        .subscribe([\n            (BinanceSpot::default(), \"btc\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n            (BinanceSpot::default(), \"eth\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n        ])\n        .subscribe([\n            (BinanceFuturesUsd::default(), \"btc\", \"usdt\", InstrumentKind::Perpetual, PublicTrades),\n            (BinanceFuturesUsd::default(), \"eth\", \"usdt\", InstrumentKind::Perpetual, PublicTrades),\n        ])\n        .subscribe([\n            (Coinbase, \"btc\", \"usd\", InstrumentKind::Spot, PublicTrades),\n            (Coinbase, \"eth\", \"usd\", InstrumentKind::Spot, PublicTrades),\n        ])\n        .subscribe([\n            (GateioSpot::default(), \"btc\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n        ])\n        .subscribe([\n            (GateioPerpetualsUsd::default(), \"btc\", \"usdt\", InstrumentKind::Perpetual, PublicTrades),\n        ])\n        .subscribe([\n            (GateioPerpetualsBtc::default(), \"btc\", \"usd\", InstrumentKind::Perpetual, PublicTrades),\n        ])\n        .subscribe([\n            (GateioOptions::default(), \"btc\", \"usdt\", InstrumentKind::Option(put_contract()), PublicTrades),\n        ])\n        .subscribe([\n            (Okx, \"btc\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n            (Okx, \"btc\", \"usdt\", InstrumentKind::Perpetual, PublicTrades),\n            (Okx, \"btc\", \"usd\", InstrumentKind::Future(future_contract()), PublicTrades),\n            (Okx, \"btc\", \"usd\", InstrumentKind::Option(call_contract()), PublicTrades),\n        ])\n        .subscribe([\n            (BybitSpot::default(), \"btc\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n            (BybitSpot::default(), \"eth\", \"usdt\", InstrumentKind::Spot, PublicTrades),\n        ])\n        .subscribe([\n            (BybitPerpetualsUsd::default(), \"btc\", \"usdt\", InstrumentKind::Perpetual, PublicTrades),\n        ])\n        .subscribe([\n            (Bitmex, \"xbt\", \"usd\", InstrumentKind::Perpetual, PublicTrades)\n        ])\n        .init()\n        .await\n        .unwrap();\n\n    // Join all exchange PublicTrades streams into a single tokio_stream::StreamMap\n    // Notes:\n    //  - Use `streams.select(ExchangeId)` to interact with the individual exchange streams!\n    //  - Use `streams.join()` to join all exchange streams into a single mpsc::UnboundedReceiver!\n    let mut joined_stream = streams.join_map().await;\n\n    while let Some((exchange, trade)) = joined_stream.next().await {\n        info!(\"Exchange: {exchange}, MarketEvent\u003cPublicTrade\u003e: {trade:?}\");\n    }\n}\n```\n\n## Getting Help\nFirstly, see if the answer to your question can be found in the [API Documentation]. If the answer is not there, I'd be \nhappy to help via [Chat] and try answer your question via Discord. \n\n## Contributing\nThanks in advance for helping to develop the Barter ecosystem! Please do get hesitate to get touch via the Discord \n[Chat] to discuss development, new features, and the future roadmap.\n\n### Adding A New Exchange Connector\n1. Add a new `Connector` trait implementation in src/exchange/\u003cexchange_name\u003e.mod.rs (eg/ see exchange::okx::Okx).\n2. Follow on from \"Adding A New Subscription Kind For An Existing Exchange Connector\" below!\n\n### Adding A New SubscriptionKind For An Existing Exchange Connector\n1. Add a new `SubscriptionKind` trait implementation in src/subscription/\u003csub_kind_name\u003e.rs (eg/ see subscription::trade::PublicTrades).\n2. Define the `SubscriptionKind::Event` data model (eg/ see subscription::trade::PublicTrade).\n3. Define the `MarketStream` type the exchange `Connector` will initialise for the new `SubscriptionKind`: \u003cbr\u003e\n   ie/ `impl StreamSelector\u003cSubscriptionKind\u003e for \u003cExistingExchangeConnector\u003e { ... }`\n4. Try to compile and follow the remaining steps!\n5. Add a barter-data-rs/examples/\u003csub_kind_name\u003e_streams.rs example in the standard format :)\n\n## Related Projects\nIn addition to the Barter-Execution crate, the Barter project also maintains:\n* [`Barter`]: High-performance, extensible \u0026 modular trading components with batteries-included. Contains a\n  pre-built trading Engine that can serve as a live-trading or backtesting system.\n* [`Barter-Integration`]: High-performance, low-level framework for composing flexible web integrations.\n* [`Barter-Execution`]: High-performance WebSocket integration library for streaming public market data from leading\n  cryptocurrency exchanges.\n* [`Barter-Macro`]: Barter ecosystem macros.\n\n## Roadmap\n* Add support for more exchanges (easy to help with!)\n* Add support for more subscription kinds (easy to help with!)\n\n## Licence\nThis project is licensed under the [MIT license].\n\n[MIT license]: https://gitlab.com/open-source-keir/financial-modelling/trading/barter-data-rs/-/blob/main/LICENSE\n\n### Contribution\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in Barter-Data by you, shall be licensed as MIT, without any additional\nterms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarter-rs%2Fbarter-data-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarter-rs%2Fbarter-data-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarter-rs%2Fbarter-data-rs/lists"}