Skip to content

Instantly share code, notes, and snippets.

@marcelometal
Created November 15, 2020 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelometal/40c4117b39a1178304c614e52ef784e7 to your computer and use it in GitHub Desktop.
Save marcelometal/40c4117b39a1178304c614e52ef784e7 to your computer and use it in GitHub Desktop.
Importar YAML para finance wallet API
PURCHASES_TYPE="stocks fiis treasuries-direct certificates-of-deposit stocks-funds ficfi"
for X in $PURCHASES_TYPE; do
echo "Inserting $X data...";
DATA=$(python3 -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' < $X.yaml | jq -c '.[]')
for ITEM in $DATA; do
curl -X POST "http://localhost:8889/api/v1/$X/operations" -H 'Content-Type: application/json' -d "$ITEM";
done
echo "done!";
echo "";
echo "";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment