No BSD License  

Highlights from
Energy Bid Stack Viewer

image thumbnail
from Energy Bid Stack Viewer by Paul Taylor
Energy Bid Stack Viewer for Australian electricity market

get_data(DUID_str, DATE_from, DATE_to)
function [daily_data,period_data] = get_data(DUID_str, DATE_from, DATE_to)

% Set the mouse pointer to the hourglass
set(gcf,'pointer','watch')
drawnow

% Set the "DataReturnFormat" for the Database Toolbox so that the data is
% returned as a structure
setdbprefs('DataReturnFormat','structure');

try
    % Connect to the database
    conn = database('ENERGY_DATA', '', '');
    
    %=============================================
    % Get data from the NEMNET_DAILY_OFFER table
    daily_SQL = ['SELECT * from NEMNET_DAILY_OFFER WHERE DUID = ''' DUID_str ''' AND TRADING_DATETIME >= ', ...
                DATE_from ' AND TRADING_DATETIME <= ' DATE_to ' ORDER by VERSION_NO'];
  
    daily_curs = exec(conn, daily_SQL);
    daily_curs = fetch(daily_curs);
    daily_data = daily_curs.Data;        
    close(daily_curs);
    
    %=============================================
    % Get data from the NEMNET_PERIOD_OFFER table
    period_SQL = ['SELECT * from NEMNET_PERIOD_OFFER WHERE DUID = ''' DUID_str ''' AND TRADING_DATETIME >= ', ...
                DATE_from ' AND TRADING_DATETIME <= ' DATE_to ' ORDER by VERSION_NO'];
            
    period_curs = exec(conn, period_SQL);
    period_curs = fetch(period_curs);
    period_data = period_curs.Data;
    
    close(period_curs);
    %=============================================
    
    close(conn);
catch
    disp('Error occurred')
end

% reset the cursor to the default arrow
set(gcf,'pointer','arrow')

Contact us at files@mathworks.com