Skip to content

Latest commit

 

History

History

crypto-prices

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

crypto-prices bitcoin zcash ethereum

Sequence that keeps printing current crypto prices for a provided pair of currencies every 3 seconds.


The video that illustrates the execution of the sample is on our YouTube channel How to check cryptocurrency prices using Scramjet?


💡 Please note that the sample below requires some previous installations before you start running it, you will find them here.

Running

Open two terminals and run the following commands:

The first terminal:

# start sth
scramjet-transform-hub

The second terminal

# go to 'crypto-prices' directory
cd samples/crypto-prices

# install dependencies
npm install

# transpile TS->JS and copy node_modules and package.json to dist/
npm run build

# deploy the Sequence from the dist/ directory, which contains transpiled code, package.json and node_modules
si seq deploy dist

# see the Instance output
si inst output -

💡NOTE: Command deploy performs three actions at once: pack, send and start the Sequence. It is the same as if you would run those three commands separately:

si seq pack dist/ -o crypto-prices.tar.gz    # compress 'dist/' directory into file named 'crypto-prices.tar.gz'

si seq send crypto-prices.tar.gz    # send packed Sequence to STH, this will output Sequence ID

si seq start -    # start the Sequence, this will output Instance ID

Output

Once you run si inst output - command you should get an output similar to this one:

"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"
"{\"data\":{\"base\":\"BTC\",\"currency\":\"USD\",\"amount\":\"40989.61\"}}\r\n"