Function read_financial_data

Source
pub fn read_financial_data<P: AsRef<Path>>(
    file_path: P,
    has_header: bool,
    file_type: &str,
    delimiter: char,
) -> PolarsResult<(DataFrame, FinancialColumns)>
Expand description

Read a financial data file (CSV or Parquet) and standardize column names

This function attempts to identify and standardize OHLCV columns whether or not the file has headers.

§Arguments

  • file_path - Path to the file
  • has_header - Whether the file has headers
  • file_type - “csv” or “parquet”
  • delimiter - Delimiter for CSV files (default: ‘,’)

§Returns

A tuple with (DataFrame, FinancialColumns) where FinancialColumns contains the standardized column name mapping

§Example

use ta_lib_in_rust::util::file_utils::read_financial_data;

let (df, columns) = read_financial_data("data/prices.csv", true, "csv", ',').unwrap();
println!("Close column: {:?}", columns.close);