market-data
A Rust lib to fetch & enhance historical time-series stock market data.
Usage
Check the Example folder for more examples.
use anyhow::Result;
use lazy_static::lazy_static;
use market_data::{Iex, MarketClient};
use std::env::var;
lazy_static! {
static ref TOKEN: String = var("IEX_TOKEN").expect("IEX_TOKEN env variable is required");
}
fn main() -> Result<()> {
let mut site = Iex::new(TOKEN.to_string());
site.for_series("AAPL".to_string(), "3m".to_string());
let client = MarketClient::new(site);
let client = client.create_endpoint()?.get_data()?;
let data = client.transform_data()?;
println!("{}", data);
let enhanced_data = data
.enhance_data()
.with_sma(10)
.with_ema(20)
.with_ema(6)
.with_rsi(14)
.calculate();
println!("{}", enhanced_data);
Ok(())
}
Supported Publishers
Selected a number of sites that offer Free Tier, new Publishers can be added, your contribution is welcome.
So far the following are supported.
Alternative series providers, to be implemented: