Skip to content

Instantly share code, notes, and snippets.

@lvturner
Created May 30, 2018 09:31
Show Gist options
  • Select an option

  • Save lvturner/c983424a2aacda52d21c3ebbe361c988 to your computer and use it in GitHub Desktop.

Select an option

Save lvturner/c983424a2aacda52d21c3ebbe361c988 to your computer and use it in GitHub Desktop.
const Promise = require('bluebird');
const db = require('./connection');
const TiingoNews = require('./grabbers/tiingo_news');
const TiingoCryptoPrice = require('./grabbers/tiingo_crypto_price');
const CoinMarketCap = require('./grabbers/coin_market_cap');
const BlockChainInfo = require('./grabbers/blockchain_info');
const StockTwitsSentiment = require('./grabbers/stocktwits_sentiment');
const StockTwitsMessageVolume = require('./grabbers/stocktwits_message_volume');
const GithubCodeFrequency = require('./grabbers/github_code_frequency');
let promiseArr = [];
const tn = new TiingoNews(db);
tn.setTicker('btc');
promiseArr.push(tn.beginImport());
const tp = new TiingoCryptoPrice(db);
tp.setTicker('btcusd');
promiseArr.push(tp.beginImport());
const cmc = new CoinMarketCap(db);
cmc.setTicker(1); // BTC == 1 on CoinMarketCap
promiseArr.push(cmc.beginImport());
const bci = new BlockChainInfo(db);
promiseArr.push(bci.beginImport());
const sts = new StockTwitsSentiment(db);
sts.setTicker('BTC.X');
promiseArr.push(sts.beginImport());
const stmv = new StockTwitsMessageVolume(db);
stmv.setTicker('BTC.X');
promiseArr.push(stmv.beginImport());
const ghcf = new GithubCodeFrequency(db);
ghcf.setTicker('bitcoin/bitcoin');
promiseArr.push(ghcf.beginImport());
Promise.all(promiseArr).then(() => {
console.log("Done!");
db.close();
}).catch((err) => {
console.log("error!");
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment