paracas downloader 🚧
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
[package]
|
||||
name = "paracas-lib"
|
||||
description = "High-performance Rust library for downloading Dukascopy tick data"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
documentation.workspace = true
|
||||
authors.workspace = true
|
||||
keywords.workspace = true
|
||||
categories.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[features]
|
||||
default = ["full"]
|
||||
full = ["fetch", "aggregate", "format", "parquet"]
|
||||
fetch = ["dep:paracas-fetch"]
|
||||
aggregate = ["dep:paracas-aggregate"]
|
||||
format = ["dep:paracas-format"]
|
||||
parquet = ["format", "paracas-format/parquet"]
|
||||
|
||||
[dependencies]
|
||||
paracas-types = { workspace = true }
|
||||
paracas-instruments = { workspace = true }
|
||||
paracas-fetch = { workspace = true, optional = true }
|
||||
paracas-aggregate = { workspace = true, optional = true }
|
||||
paracas-format = { workspace = true, optional = true }
|
||||
@@ -0,0 +1,56 @@
|
||||
# paracas-lib
|
||||
|
||||
High-performance Rust library for downloading historical tick data from Dukascopy.
|
||||
|
||||
## Features
|
||||
|
||||
- **Fast**: Concurrent downloads with connection pooling
|
||||
- **Flexible**: CSV, JSON, and Parquet output formats
|
||||
- **Complete**: All 1000+ Dukascopy instruments supported
|
||||
- **Aggregation**: Built-in OHLCV aggregation
|
||||
|
||||
## Quick Start
|
||||
|
||||
```rust,ignore
|
||||
use paracas_lib::prelude::*;
|
||||
use futures::StreamExt;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Get instrument
|
||||
let registry = InstrumentRegistry::global();
|
||||
let instrument = registry.get("eurusd").unwrap();
|
||||
|
||||
// Create client
|
||||
let client = DownloadClient::with_defaults()?;
|
||||
|
||||
// Define date range
|
||||
let range = DateRange::new(
|
||||
chrono::NaiveDate::from_ymd_opt(2024, 1, 1).unwrap(),
|
||||
chrono::NaiveDate::from_ymd_opt(2024, 1, 1).unwrap(),
|
||||
)?;
|
||||
|
||||
// Stream ticks
|
||||
let mut stream = tick_stream(&client, instrument, range);
|
||||
while let Some(batch) = stream.next().await {
|
||||
let batch = batch?;
|
||||
println!("Downloaded {} ticks for {:?}", batch.len(), batch.hour);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
## Crates
|
||||
|
||||
This is a facade crate that re-exports functionality from:
|
||||
|
||||
- `paracas-types` - Core types (Tick, Instrument, DateRange)
|
||||
- `paracas-instruments` - Instrument registry
|
||||
- `paracas-fetch` - HTTP client and data fetching
|
||||
- `paracas-aggregate` - OHLCV aggregation
|
||||
- `paracas-format` - Output formatters
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see [LICENSE](../../LICENSE) for details.
|
||||
@@ -0,0 +1,88 @@
|
||||
//! High-performance Rust library for downloading Dukascopy tick data.
|
||||
//!
|
||||
//! This is a facade crate that re-exports functionality from the paracas
|
||||
//! workspace crates for convenient access.
|
||||
//!
|
||||
//! # Quick Start
|
||||
//!
|
||||
//! ```ignore
|
||||
//! use paracas_lib::prelude::*;
|
||||
//! use futures::StreamExt;
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
//! let registry = InstrumentRegistry::global();
|
||||
//! let instrument = registry.get("eurusd").unwrap();
|
||||
//! let client = DownloadClient::with_defaults()?;
|
||||
//!
|
||||
//! let range = DateRange::new(
|
||||
//! chrono::NaiveDate::from_ymd_opt(2024, 1, 1).unwrap(),
|
||||
//! chrono::NaiveDate::from_ymd_opt(2024, 1, 1).unwrap(),
|
||||
//! )?;
|
||||
//!
|
||||
//! let mut stream = tick_stream(&client, instrument, range);
|
||||
//! while let Some(batch) = stream.next().await {
|
||||
//! println!("Downloaded {} ticks", batch?.len());
|
||||
//! }
|
||||
//!
|
||||
//! Ok(())
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![doc(issue_tracker_base_url = "https://github.com/factordynamics/paracas/issues/")]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![warn(missing_docs)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
// Re-export core types
|
||||
pub use paracas_types::*;
|
||||
|
||||
// Re-export instrument registry
|
||||
pub use paracas_instruments::InstrumentRegistry;
|
||||
|
||||
// Re-export fetch functionality
|
||||
#[cfg(feature = "fetch")]
|
||||
pub use paracas_fetch::{
|
||||
ClientConfig, DecompressError, DownloadClient, DownloadError, ParseError, TickBatch,
|
||||
tick_stream, tick_stream_resilient,
|
||||
};
|
||||
|
||||
// Re-export aggregation
|
||||
#[cfg(feature = "aggregate")]
|
||||
pub use paracas_aggregate::{Ohlcv, TickAggregator};
|
||||
|
||||
// Re-export formatters
|
||||
#[cfg(feature = "format")]
|
||||
pub use paracas_format::{CsvFormatter, FormatError, Formatter, JsonFormatter, OutputFormat};
|
||||
|
||||
#[cfg(all(feature = "format", feature = "parquet"))]
|
||||
pub use paracas_format::ParquetFormatter;
|
||||
|
||||
/// Prelude module for convenient imports.
|
||||
///
|
||||
/// ```
|
||||
/// use paracas_lib::prelude::*;
|
||||
/// ```
|
||||
pub mod prelude {
|
||||
pub use paracas_types::{
|
||||
Category, DateRange, DateRangeError, Instrument, ParacasError, RawTick, Result, Tick,
|
||||
Timeframe,
|
||||
};
|
||||
|
||||
pub use paracas_instruments::InstrumentRegistry;
|
||||
|
||||
#[cfg(feature = "fetch")]
|
||||
pub use paracas_fetch::{
|
||||
ClientConfig, DownloadClient, TickBatch, tick_stream, tick_stream_resilient,
|
||||
};
|
||||
|
||||
#[cfg(feature = "aggregate")]
|
||||
pub use paracas_aggregate::{Ohlcv, TickAggregator};
|
||||
|
||||
#[cfg(feature = "format")]
|
||||
pub use paracas_format::{CsvFormatter, Formatter, JsonFormatter, OutputFormat};
|
||||
|
||||
#[cfg(all(feature = "format", feature = "parquet"))]
|
||||
pub use paracas_format::ParquetFormatter;
|
||||
}
|
||||
Reference in New Issue
Block a user