function [secid,date1,exdate,cp_flag,strike_price,best_bid,best_offer,volume,open_interest,impl_volatility,delta,optionid,index_flag,issuer,exercise_style] = importfile_fast(filename)
%IMPORTFILE_FAST Fast import of option prices CSV using readtable
%
%   Based on auto-generated importfile.m, but a much faster version
%   using readtable with pre-specified column types

% Pre-specify import options to avoid auto-detection overhead
opts = delimitedTextImportOptions('NumVariables', 15);
opts.DataLines = [2, Inf];  % Skip header row
opts.Delimiter = ',';

% Define variable names
opts.VariableNames = {'secid', 'date1', 'exdate', 'cp_flag', 'strike_price', ...
    'best_bid', 'best_offer', 'volume', 'open_interest', 'impl_volatility', ...
    'delta', 'optionid', 'index_flag', 'issuer', 'exercise_style'};

% Define variable types - specify exactly to avoid auto-detection
opts.VariableTypes = {'double', 'datetime', 'datetime', 'categorical', 'double', ...
    'double', 'double', 'double', 'double', 'double', ...
    'double', 'double', 'double', 'double', 'char'};

% Set datetime format
opts = setvaropts(opts, {'date1', 'exdate'}, 'InputFormat', 'MM/dd/yyyy');

% Read the table
fprintf('Reading %s...\n', filename);
tic;
T = readtable(filename, opts);
fprintf('Read complete in %.1f seconds.\n', toc);

% Extract columns as separate variables (to match original function signature)
secid = T.secid;
date1 = T.date1;
exdate = T.exdate;
cp_flag = T.cp_flag;
strike_price = T.strike_price;
best_bid = T.best_bid;
best_offer = T.best_offer;
volume = T.volume;
open_interest = T.open_interest;
impl_volatility = T.impl_volatility;
delta = T.delta;
optionid = T.optionid;
index_flag = T.index_flag;
issuer = T.issuer;
exercise_style = T.exercise_style;

end
