1.0.8 • Published 10 years ago

gatherbtcdata v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

Gather Bitcoin Data

Package for gathering data from Bitcoin Markets including preparation for insertion into a mongodb database. As there aren't any databases available for depths from markets, this module allows to create such a database.

Warning: This module is a work in progress and might not work as advertised!

##Usage Example

const BtcDataGatherer = require('gatherbtcdata');

let gatherer = new BtcDataGatherer();
launchRuntime();

function launchRuntime(){
    gatherer.connectDatabase();
    //for conversionrates go get a api key at openexchangerates.org and enter into config.json
    //(https://openexchangerates.org/api/latest.json?app_id=somekeyforyourapp")
    //doConversionRates();//do conversionRates initially to allow proper standardization
    //setInterval(doConversionRates, 86400000); //get and set conversionRates every 24hrs
    runtime();
    setInterval(runtime, 2000); //gathering data every 2 seconds
}

//gets and sets conversionRates 
//this is needed for successful standardization of incoming data
function doConversionRates() {
    gatherer.getConversionRates()
        .then(conversionRates => {
                gatherer.setConversionRates(conversionRates);
            }
        );
}

function runtime(){
    let timestamp = Date.now();
    gatherer.queueTimestamp(timestamp); //for successful standardization queueing timestamps is required for proper 
                                        //order in returned data arrays.
    gatherer.getEverything(timestamp) //gets all the data from all markets and their specified methods f.e. depth
    .then(marketInfo => {
        let marketInfoArray = gatherer.standardizeMarketInfo(marketInfo);
        gatherer.insertArray(marketInfoArray); //inserting array into mongodb database
    })
}
1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago