| Crates.io | etf-matcher-vector-config-loader |
| lib.rs | etf-matcher-vector-config-loader |
| version | 0.3.0 |
| created_at | 2025-01-29 19:44:27.35842+00 |
| updated_at | 2025-02-06 22:29:43.072492+00 |
| description | Download and parse ETF Matcher ticker vector configurations. |
| homepage | |
| repository | https://github.com/jzombie/rust-etf-matcher-vector-config-loader |
| max_upload_size | |
| id | 1535245 |
| size | 57,321 |
A Rust library for downloading and parsing ETF Matcher vector configurations for ticker similarity search downstream tasks.
Retrieve all available configurations and print their paths:
use etf_matcher_vector_config_loader::get_all_etf_matcher_configs;
fn main() {
let configs = get_all_etf_matcher_configs().unwrap();
println!("Available Configurations:");
for (key, config) in configs.iter() {
println!("{} -> {}", key, config.path);
}
}
🔹 Example Output:
Available Configurations:
default -> v5.SPY-CORR-NO-SCALE-2.ticker_vectors_collection.flatbuffers.bin
v5-sma-lstm-stacks -> v5.SMA-LSTM-STACKS.autoencoder.ticker_vectors_collection.flatbuffers.bin
Retrieve a specific ETF vector configuration (e.g., "v5-sma-lstm-stacks"):
use etf_matcher_vector_config_loader::get_etf_matcher_config_by_key;
fn main() {
let config = get_etf_matcher_config_by_key("v5-sma-lstm-stacks").unwrap();
println!("Vector Config Path: {}", config.path);
println!("Description: {:?}", config.description.unwrap_or("No description".to_string()));
println!("Feature Count: {:?}", config.features.unwrap_or(0));
}
🔹 Example Output:
Vector Config Path: v5.SMA-LSTM-STACKS.autoencoder.ticker_vectors_collection.flatbuffers.bin
Description: "v5 SMA LSTM STACKS"
Feature Count: 158
Retrieve the ticker vectors collection and symbol map, then initialize repositories.
use etf_matcher_vector_config_loader::{get_ticker_vectors_collection_by_key, get_symbol_map};
fn main() {
// Load ticker vectors collection
// Where `default` represents the key of the default configuration
let ticker_vectors_collection_bytes: Vec<u8> = get_ticker_vectors_collection_by_key("default")
.map_err(|err| format!("Error when loading ticker vectors collection. {:?}", err))
.expect("Failed to load ticker vectors collection");
// Load ticker symbol map
// In most cases, the ticker symbol map includes all available ticker vector
// collections. However, some entities may not be mapped if the chosen ticker
// vector collection has not been recently updated.
let ticker_symbol_map_bytes: Vec<u8> = get_symbol_map()
.map_err(|err| format!("Error when loading ticker symbol map. {:?}", err))
.expect("Failed to load ticker symbol map");
// Example usage
println!("Ticker vector repository and symbol mapper initialized successfully.");
}
🔹 Example Output:
Ticker vector repository and symbol mapper initialized successfully.
MIT License (c) 2025 Jeremy Harris.