Skip to content

Instantly share code, notes, and snippets.

@kzzzr
Created January 31, 2022 13:36
Show Gist options
  • Save kzzzr/d466ad1ca815f39bbfd92fa9d5fe25c8 to your computer and use it in GitHub Desktop.
Save kzzzr/d466ad1ca815f39bbfd92fa9d5fe25c8 to your computer and use it in GitHub Desktop.
Fetching exchange rates
## Enable debugging messages and exit on error
# set -ex
## Assign variables directly or use ENV variables
TS=`date +"%Y-%m-%d-%H-%M-%S-%Z"`
# OXR_TOKEN=''
# BASE_CURRENCY='RUB'
# SYMBOLS='AED,EUR,GBP,RUB,USD'
## Chain commands
curl -H "Authorization: Token $OXR_TOKEN" \
"https://openexchangerates.org/api/historical/$BUSINESS_DT.json?base=$BASE_CURRENCY&symbols=$SYMBOLS" \
| aws s3 cp - s3://$BUCKET/$BUCKET_PATH/$BUSINESS_DT-$BASE_CURRENCY-$TS.json
## Print log messages
echo "FETCHED s3://$BUCKET/$BUCKET_PATH/$BUSINESS_DT-$BASE_CURRENCY-$TS.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment