NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#!/bin/bash
############################################################################
# File Name : rangeLoad.sh
# Description : This is the script do the loading of MBIS data between startDate and endDate.
# This is the utility that can be used to load historical data.
#
# YYYYMMDD Name Description
# ------------------------------------------------------------------------ #
# 20180126 Yiting Nan Created
############################################################################

#if APP_NAME not found run env file.
source config/MBIS.env

if [ $# -eq 0 ] || [ $# -eq 1 ] || [ $# -gt 3 ] || [ "${1}" = "?" ];then printf "
Error: Invalid number of parameters
Usage: rangeLoad.sh [SOURCEDATA] [STARTDATE] [ENDDATE]
SOURCEDATA -- quotes | peer_index | curve
STARTDATE, ENDDATE -- YYYYMMDD format,
Loading range is [STARTDATE, ENDDATE), STARTDATE included, ENDDATE not.
ENDDATE is optional. If not specified, current date will be used.
ENDDATE should be later than STARTDATE
Example: rangeLoad.sh quotes 20130101
This will load all quotes data from 2013-01-01 to current date.
rangeLoad.sh curve 20171201 20171231
It would load the curve data for December 2017.

";exit 1;fi

SOURCEDATA="${1,,}"
if [ ${SOURCEDATA} != "quotes" ] && [ ${SOURCEDATA} != "peer_index" ] && [ ${SOURCEDATA} != "curve" ];then printf "
Error: Invalid SOURCEDATA
Usage: rangeLoad.sh [SOURCEDATA] [STARTDATE] [ENDDATE]
SOURCEDATA -- quotes | peer_index | curve
STARTDATE, ENDDATE -- YYYYMMDD format
ENDDATE is optional. If not specified, will use current date.
ENDDATE should be later than STARTDATE
Example: rangeLoad.sh quotes 20130101
This will load all quotes data from 2013-01-01 to current date.
rangeLoad.sh curve 20171201 20171231
It would load the curve data for December 2017.

";exit 1;fi

STARTDATE="${2}"

#ENDDATE is optional. If not specified, will use current date.
if [ $# -eq 2 ]
then
ENDDATE=`date +%Y%m%d`
else
#11111 check it is in right date format and it is a valid date.
ENDDATE="${3}"
fi

if [[ $STARTDATE > $ENDDATE ]];then printf "
Error: STARTDATE should be before ENDDATE
Usage: rangeLoad.sh [SOURCEDATA] [STARTDATE] [ENDDATE]
SOURCEDATA -- quotes | peer_index | curve
STARTDATE, ENDDATE -- YYYYMMDD format
ENDDATE is optional. If not specified, will use current date.
ENDDATE should be later than STARTDATE
Example: rangeLoad.sh quotes 20130101
This will load all quotes data from 2013-01-01 to current date.
rangeLoad.sh curve 20171201 20171231
This will load the curve data for December 2017.
";exit 1;fi

LOG_FILE="${LOG_DIR}/range_${STARTDATE}_${ENDDATE}.log"

echo `date` " Start range load between " ${STARTDATE} "and " ${ENDDATE} >> ${LOG_FILE}

processDATE=$STARTDATE

####### Validate input date is a valid business day ######
# Day of the week: Sunday -- Saturday is 0..6
while [[ $processDATE < $ENDDATE ]]
do
week_of_day=$(date -d ${processDATE} +%w)
if [[ $week_of_day -eq 0 ]] || [[ $week_of_day -eq 6 ]]
then
echo `date`" " $processDATE " is weekend. Continue on next date. " >> ${LOG_FILE}
else
#Turn off holiday check
rev_num=0
# rev_num=`sqlplus ${ORA_METADATA_CONNECTION} << EOF
#whenever sqlerror exit 1;
#set pagesize 0
#set feedback off
#set heading off
#select count(*) from MD_HOLIDAY where holiday_category='${HOLIDAY_SCHEDULE}' and holiday_date=to_date('$processDATE', 'YYYYMMDD');
#exit;
#EOF`
if [ $rev_num -eq 1 ]
then
echo `date` $processDATE " is a holiday. Continue on next date " >> ${LOG_FILE}
else
echo `date` $processDATE " is a valid business day, load $SOURCEDATA datasets. " >> ${LOG_FILE}

if [ "${SOURCEDATA}" = "quotes" ]
then
${WORK_DIR}/SingleDataset.sh quotes $processDATE
fi

if [ "${SOURCEDATA}" = "peer_index" ]
then
${WORK_DIR}/SingleDataset.sh peer_index $processDATE
fi

if [ "${SOURCEDATA}" = "curve" ]
then
${WORK_DIR}/SingleDataset.sh curve $processDATE DAILY
${WORK_DIR}/SingleDataset.sh curve $processDATE HOURLY
fi
fi
fi
processDATE=$(date -d "$processDATE + 1 days " +%Y%m%d)
done

echo `date` " Finishing range load between " ${STARTDATE} "and " ${ENDDATE} >> ${LOG_FILE}




     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.