From 3f6cba7a969a1980f1f47a4a50fe1f3ec8e074ff Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:20:01 -0500 Subject: [PATCH 01/15] Create arkenstone.json --- coins/arkenstone.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/arkenstone.json diff --git a/coins/arkenstone.json b/coins/arkenstone.json new file mode 100644 index 0000000..d767bdd --- /dev/null +++ b/coins/arkenstone.json @@ -0,0 +1,5 @@ +{ + "name": "Arkenstone", + "symbol": "ARS", + "algorithm": "sha256" +} From 17d3170aa2d6c4d59422049cd7b34827513b3fee Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:21:23 -0500 Subject: [PATCH 02/15] Create 21coin.json --- coins/21coin.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/21coin.json diff --git a/coins/21coin.json b/coins/21coin.json new file mode 100644 index 0000000..8aa9ea5 --- /dev/null +++ b/coins/21coin.json @@ -0,0 +1,5 @@ +{ + "name": "21coin", + "symbol": "21", + "algorithm": "sha256" +} From e95a4e3a764f4bab14ff2ca667113ee858b589b2 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:23:10 -0500 Subject: [PATCH 03/15] Create arkhash.json --- coins/arkhash.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 coins/arkhash.json diff --git a/coins/arkhash.json b/coins/arkhash.json new file mode 100644 index 0000000..a8fbb9e --- /dev/null +++ b/coins/arkhash.json @@ -0,0 +1,6 @@ +{ + "name": "Arkhash", + "symbol": "ARK", + "algorithm": "sha256", + "txMessages" : true +} From a1f9b7dc89b27c5d3b9ea7ffaa117391926536a6 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:23:51 -0500 Subject: [PATCH 04/15] Create bitraam.json --- coins/bitraam.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/bitraam.json diff --git a/coins/bitraam.json b/coins/bitraam.json new file mode 100644 index 0000000..4a46ae7 --- /dev/null +++ b/coins/bitraam.json @@ -0,0 +1,5 @@ +{ + "name": "BitRaam", + "symbol": "BRM", + "algorithm": "sha256" +} From 5a44c548543ed65e0c79f9bd956c5fbdd739736c Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:25:03 -0500 Subject: [PATCH 05/15] Create continuumcoin.json --- coins/continuumcoin.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/continuumcoin.json diff --git a/coins/continuumcoin.json b/coins/continuumcoin.json new file mode 100644 index 0000000..21a3b6e --- /dev/null +++ b/coins/continuumcoin.json @@ -0,0 +1,5 @@ +{ + "name": "Continuumcoin", + "symbol": "CTM", + "algorithm": "sha256" +} From e65984fe7cb3b1a7ffe74c2a356a4027dec11c71 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:25:37 -0500 Subject: [PATCH 06/15] Create fastcoinsha.json --- coins/fastcoinsha.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/fastcoinsha.json diff --git a/coins/fastcoinsha.json b/coins/fastcoinsha.json new file mode 100644 index 0000000..d4e0882 --- /dev/null +++ b/coins/fastcoinsha.json @@ -0,0 +1,5 @@ +{ + "name": "Fastcoinsha", + "symbol": "FSS", + "algorithm": "sha256" +} From ee0815befa3f4a084490a1cdbcf7358abd3c20ad Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:27:05 -0500 Subject: [PATCH 07/15] Create stashcoin.json --- coins/stashcoin.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/stashcoin.json diff --git a/coins/stashcoin.json b/coins/stashcoin.json new file mode 100644 index 0000000..6c2a50a --- /dev/null +++ b/coins/stashcoin.json @@ -0,0 +1,5 @@ +{ + "name": "Stashcoin", + "symbol": "STA", + "algorithm": "sha256" +} From 5b308168bf32eaab34c34ecc70c6fb3a0101baea Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 19:28:06 -0500 Subject: [PATCH 08/15] Create wearesatoshi.json --- coins/wearesatoshi.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 coins/wearesatoshi.json diff --git a/coins/wearesatoshi.json b/coins/wearesatoshi.json new file mode 100644 index 0000000..01ed43d --- /dev/null +++ b/coins/wearesatoshi.json @@ -0,0 +1,5 @@ +{ + "name": "WeAreSatoshi", + "symbol": "WAS", + "algorithm": "sha256" +} From 5983b3a7de3852f4bfea690e70904e7bfd8258c7 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Thu, 22 May 2014 20:22:36 -0500 Subject: [PATCH 09/15] Update arkhash.json --- coins/arkhash.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coins/arkhash.json b/coins/arkhash.json index a8fbb9e..da4d780 100644 --- a/coins/arkhash.json +++ b/coins/arkhash.json @@ -1,6 +1,5 @@ { "name": "Arkhash", "symbol": "ARK", - "algorithm": "sha256", - "txMessages" : true + "algorithm": "sha256" } From b016c751069d375c8820fb55f5ae43ecd8d3ae15 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:13:30 -0500 Subject: [PATCH 10/15] Update tekcoin.json --- coins/tekcoin.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coins/tekcoin.json b/coins/tekcoin.json index 44ba31b..f63f94b 100644 --- a/coins/tekcoin.json +++ b/coins/tekcoin.json @@ -2,4 +2,6 @@ "name": "Tekcoin", "symbol": "TEK", "algorithm": "sha256" + "algorithm": "sha256", + "txMessages": "true" } From c42a64742f1faf2d41fa95b7b5c50d085c97ad5b Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:18:33 -0500 Subject: [PATCH 11/15] Update tekcoin.json --- coins/tekcoin.json | 1 - 1 file changed, 1 deletion(-) diff --git a/coins/tekcoin.json b/coins/tekcoin.json index f63f94b..4b3a276 100644 --- a/coins/tekcoin.json +++ b/coins/tekcoin.json @@ -1,7 +1,6 @@ { "name": "Tekcoin", "symbol": "TEK", - "algorithm": "sha256" "algorithm": "sha256", "txMessages": "true" } From 64b48388fc2fd7e81112ab930d446db8764f6082 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:31:49 -0500 Subject: [PATCH 12/15] Create apiCoinWarz.js --- libs/apiCoinWarz.js | 204 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 libs/apiCoinWarz.js diff --git a/libs/apiCoinWarz.js b/libs/apiCoinWarz.js new file mode 100644 index 0000000..2153df4 --- /dev/null +++ b/libs/apiCoinWarz.js @@ -0,0 +1,204 @@ +ar request = require('request'); +var nonce = require('nonce'); + +module.exports = function() { + 'use strict'; + + // Module dependencies + + // Constants + var version = '0.1.0', + PUBLIC_API_URL = 'http://pubapi.cryptsy.com/api.php', + PRIVATE_API_URL = 'https://api.cryptsy.com/api', + USER_AGENT = 'nomp/node-open-mining-portal' + + // Constructor + function Cryptsy(key, secret){ + // Generate headers signed by this user's key and secret. + // The secret is encapsulated and never exposed + this._getPrivateHeaders = function(parameters){ + var paramString, signature; + + if (!key || !secret){ + throw 'Cryptsy: Error. API key and secret required'; + } + + // Sort parameters alphabetically and convert to `arg1=foo&arg2=bar` + paramString = Object.keys(parameters).sort().map(function(param){ + return encodeURIComponent(param) + '=' + encodeURIComponent(parameters[param]); + }).join('&'); + + signature = crypto.createHmac('sha512', secret).update(paramString).digest('hex'); + + return { + Key: key, + Sign: signature + }; + }; + } + + // If a site uses non-trusted SSL certificates, set this value to false + Cryptsy.STRICT_SSL = true; + + // Helper methods + function joinCurrencies(currencyA, currencyB){ + return currencyA + '_' + currencyB; + } + + // Prototype + Cryptsy.prototype = { + constructor: Cryptsy, + + // Make an API request + _request: function(options, callback){ + if (!('headers' in options)){ + options.headers = {}; + } + + options.headers['User-Agent'] = USER_AGENT; + options.json = true; + options.strictSSL = Cryptsy.STRICT_SSL; + + request(options, function(err, response, body) { + callback(err, body); + }); + + return this; + }, + + // Make a public API request + _public: function(parameters, callback){ + var options = { + method: 'GET', + url: PUBLIC_API_URL, + qs: parameters + }; + + return this._request(options, callback); + }, + + // Make a private API request + _private: function(parameters, callback){ + var options; + + parameters.nonce = nonce(); + options = { + method: 'POST', + url: PRIVATE_API_URL, + form: parameters, + headers: this._getPrivateHeaders(parameters) + }; + + return this._request(options, callback); + }, + + + ///// + + + // PUBLIC METHODS + + getTicker: function(callback){ + var parameters = { + method: 'marketdatav2' + }; + + return this._public(parameters, callback); + }, + + getOrderBook: function(currencyA, currencyB, callback){ + var parameters = { + command: 'returnOrderBook', + currencyPair: joinCurrencies(currencyA, currencyB) + }; + + return this._public(parameters, callback); + }, + + getTradeHistory: function(currencyA, currencyB, callback){ + var parameters = { + command: 'returnTradeHistory', + currencyPair: joinCurrencies(currencyA, currencyB) + }; + + return this._public(parameters, callback); + }, + + + ///// + + + // PRIVATE METHODS + + myBalances: function(callback){ + var parameters = { + command: 'returnBalances' + }; + + return this._private(parameters, callback); + }, + + myOpenOrders: function(currencyA, currencyB, callback){ + var parameters = { + command: 'returnOpenOrders', + currencyPair: joinCurrencies(currencyA, currencyB) + }; + + return this._private(parameters, callback); + }, + + myTradeHistory: function(currencyA, currencyB, callback){ + var parameters = { + command: 'returnTradeHistory', + currencyPair: joinCurrencies(currencyA, currencyB) + }; + + return this._private(parameters, callback); + }, + + buy: function(currencyA, currencyB, rate, amount, callback){ + var parameters = { + command: 'buy', + currencyPair: joinCurrencies(currencyA, currencyB), + rate: rate, + amount: amount + }; + + return this._private(parameters, callback); + }, + + sell: function(currencyA, currencyB, rate, amount, callback){ + var parameters = { + command: 'sell', + currencyPair: joinCurrencies(currencyA, currencyB), + rate: rate, + amount: amount + }; + + return this._private(parameters, callback); + }, + + cancelOrder: function(currencyA, currencyB, orderNumber, callback){ + var parameters = { + command: 'cancelOrder', + currencyPair: joinCurrencies(currencyA, currencyB), + orderNumber: orderNumber + }; + + return this._private(parameters, callback); + }, + + withdraw: function(currency, amount, address, callback){ + var parameters = { + command: 'withdraw', + currency: currency, + amount: amount, + address: address + }; + + return this._private(parameters, callback); + } + }; + + return Cryptsy; +}(); From 248507b5eeb4478741477c40426077d4bb146959 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:46:51 -0500 Subject: [PATCH 13/15] Update apiCoinWarz.js --- libs/apiCoinWarz.js | 107 ++++---------------------------------------- 1 file changed, 9 insertions(+), 98 deletions(-) diff --git a/libs/apiCoinWarz.js b/libs/apiCoinWarz.js index 2153df4..dd0a550 100644 --- a/libs/apiCoinWarz.js +++ b/libs/apiCoinWarz.js @@ -7,9 +7,8 @@ module.exports = function() { // Module dependencies // Constants - var version = '0.1.0', - PUBLIC_API_URL = 'http://pubapi.cryptsy.com/api.php', - PRIVATE_API_URL = 'https://api.cryptsy.com/api', + var version = '0.0.1', + PUBLIC_API_URL = 'http://www.coinwarz.com/v1/api/profitability/?apikey=YOUR_API_KEY&algo=all', USER_AGENT = 'nomp/node-open-mining-portal' // Constructor @@ -20,7 +19,7 @@ module.exports = function() { var paramString, signature; if (!key || !secret){ - throw 'Cryptsy: Error. API key and secret required'; + throw 'CoinWarz: Error. API key and secret required'; } // Sort parameters alphabetically and convert to `arg1=foo&arg2=bar` @@ -46,8 +45,8 @@ module.exports = function() { } // Prototype - Cryptsy.prototype = { - constructor: Cryptsy, + CoinWarz.prototype = { + constructor: CoinWarz, // Make an API request _request: function(options, callback){ @@ -57,7 +56,7 @@ module.exports = function() { options.headers['User-Agent'] = USER_AGENT; options.json = true; - options.strictSSL = Cryptsy.STRICT_SSL; + options.strictSSL = CoinWarz.STRICT_SSL; request(options, function(err, response, body) { callback(err, body); @@ -77,21 +76,6 @@ module.exports = function() { return this._request(options, callback); }, - // Make a private API request - _private: function(parameters, callback){ - var options; - - parameters.nonce = nonce(); - options = { - method: 'POST', - url: PRIVATE_API_URL, - form: parameters, - headers: this._getPrivateHeaders(parameters) - }; - - return this._request(options, callback); - }, - ///// @@ -125,80 +109,7 @@ module.exports = function() { }, - ///// - - - // PRIVATE METHODS - - myBalances: function(callback){ - var parameters = { - command: 'returnBalances' - }; - - return this._private(parameters, callback); - }, - - myOpenOrders: function(currencyA, currencyB, callback){ - var parameters = { - command: 'returnOpenOrders', - currencyPair: joinCurrencies(currencyA, currencyB) - }; - - return this._private(parameters, callback); - }, - - myTradeHistory: function(currencyA, currencyB, callback){ - var parameters = { - command: 'returnTradeHistory', - currencyPair: joinCurrencies(currencyA, currencyB) - }; - - return this._private(parameters, callback); - }, - - buy: function(currencyA, currencyB, rate, amount, callback){ - var parameters = { - command: 'buy', - currencyPair: joinCurrencies(currencyA, currencyB), - rate: rate, - amount: amount - }; - - return this._private(parameters, callback); - }, - - sell: function(currencyA, currencyB, rate, amount, callback){ - var parameters = { - command: 'sell', - currencyPair: joinCurrencies(currencyA, currencyB), - rate: rate, - amount: amount - }; - - return this._private(parameters, callback); - }, - - cancelOrder: function(currencyA, currencyB, orderNumber, callback){ - var parameters = { - command: 'cancelOrder', - currencyPair: joinCurrencies(currencyA, currencyB), - orderNumber: orderNumber - }; - - return this._private(parameters, callback); - }, - - withdraw: function(currency, amount, address, callback){ - var parameters = { - command: 'withdraw', - currency: currency, - amount: amount, - address: address - }; - - return this._private(parameters, callback); - } - }; - - return Cryptsy; + //// + + return CoinWarz; }(); From 2b2887eca1dba2898997b1972770cd6b56a2c429 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:51:24 -0500 Subject: [PATCH 14/15] Update profitSwitch.js --- libs/profitSwitch.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/profitSwitch.js b/libs/profitSwitch.js index 9836f2f..2a99928 100644 --- a/libs/profitSwitch.js +++ b/libs/profitSwitch.js @@ -4,6 +4,7 @@ var bignum = require('bignum'); var algos = require('stratum-pool/lib/algoProperties.js'); var util = require('stratum-pool/lib/util.js'); +var CoinWarz = require('./apiCoinWarz.js'); var Cryptsy = require('./apiCryptsy.js'); var Poloniex = require('./apiPoloniex.js'); var Mintpal = require('./apiMintpal.js'); @@ -64,6 +65,10 @@ module.exports = function(logger){ // // setup APIs // + var coinwarzApi = new CpinWarz( + // 'API_KEY', + // 'API_SECRET' + ); var poloApi = new Poloniex( // 'API_KEY', // 'API_SECRET' From f9f329fb1b026f167d6c20ca65cd650352f42237 Mon Sep 17 00:00:00 2001 From: ob1100 Date: Fri, 23 May 2014 11:55:20 -0500 Subject: [PATCH 15/15] Update apiCoinWarz.js --- libs/apiCoinWarz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/apiCoinWarz.js b/libs/apiCoinWarz.js index dd0a550..172d2b7 100644 --- a/libs/apiCoinWarz.js +++ b/libs/apiCoinWarz.js @@ -1,4 +1,4 @@ -ar request = require('request'); +var request = require('request'); var nonce = require('nonce'); module.exports = function() {