diff --git a/exchanges/coinfalcon-markets.json b/exchanges/coinfalcon-markets.json new file mode 100644 index 000000000..1163a5c41 --- /dev/null +++ b/exchanges/coinfalcon-markets.json @@ -0,0 +1,163 @@ +{ + "assets": [ + "IOT", + "ETH", + "LTC", + "BTC", + "XRB", + "BCH", + "TAU", + "CRED", + "KIN" + ], + "currencies": [ + "BTC", + "EUR", + "ETH" + ], + "markets": [ + { + "pair": [ + "BTC", + "IOT" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "ETH" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "LTC" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "EUR", + "BTC" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "ETH", + "XRB" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "XRB" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "BCH" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "ETH", + "TAU" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "TAU" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "CRED" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "ETH", + "CRED" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "BTC", + "KIN" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + }, + { + "pair": [ + "ETH", + "KIN" + ], + "minimalOrder": { + "amount": 0, + "price": 0, + "order": 0 + } + } + ] +} \ No newline at end of file diff --git a/exchanges/coinfalcon.js b/exchanges/coinfalcon.js index e7cc12dc4..6523e45b1 100644 --- a/exchanges/coinfalcon.js +++ b/exchanges/coinfalcon.js @@ -2,6 +2,7 @@ const moment = require('moment'); const util = require('../core/util'); const _ = require('lodash'); const log = require('../core/log'); +const marketData = require('./coinfalcon-markets.json'); const CoinFalcon = require('coinfalcon'); @@ -236,18 +237,9 @@ Trader.getCapabilities = function () { return { name: 'CoinFalcon', slug: 'coinfalcon', - currencies: ['EUR', 'BTC'], - assets: ['BTC', 'LTC', 'ETH', 'IOT', 'BCH'], - markets: [ - // Euro pairs - { pair: ['EUR', 'BTC'], minimalOrder: { amount: 0.0, unit: 'asset' } }, - { pair: ['EUR', 'ETH'], minimalOrder: { amount: 0.0, unit: 'asset' } }, - // Bitcoin pairs - { pair: ['BTC', 'ETH'], minimalOrder: { amount: 0.0, unit: 'asset' } }, - { pair: ['BTC', 'LTC'], minimalOrder: { amount: 0.0, unit: 'asset' } }, - { pair: ['BTC', 'IOT'], minimalOrder: { amount: 0.0, unit: 'asset' } }, - { pair: ['BTC', 'BCH'], minimalOrder: { amount: 0.0, unit: 'asset' } } - ], + assets: marketData.assets, + currencies: marketData.currencies, + markets: marketData.markets, requires: ['key', 'secret'], providesHistory: 'date', providesFullHistory: true, diff --git a/util/genMarketFiles/update-coinfalcon.js b/util/genMarketFiles/update-coinfalcon.js new file mode 100644 index 000000000..53c8aeb85 --- /dev/null +++ b/util/genMarketFiles/update-coinfalcon.js @@ -0,0 +1,45 @@ +const _ = require('lodash'); +const fs = require('fs'); +const request = require('request-promise'); +const Promise = require('bluebird'); + +const options = { + url: 'https://coinfalcon.com/api/v1/markets', + headers: { + Connection: 'keep-alive', + 'User-Agent': 'Request-Promise', + }, + json: true, +}; + +request(options) + .then(body => { + if (!body && !body.data) { + throw new Error('Unable to fetch product list, response was empty'); + } + + let assets = _.unique(_.map(body.data, market => market.name.split('-')[0])); + let currencies = _.unique(_.map(body.data, market => market.name.split('-')[1])); + let pairs = _.map(body.data, market => { + var currency = market.name.split('-')[1]; + var asset = market.name.split('-')[0]; + return { + pair: [currency, asset], + minimalOrder: { + amount: 0.0, + price: 0.0, + order: 0.0, + }, + }; + }); + + return { assets: assets, currencies: currencies, markets: pairs }; + }) + .then(markets => { + fs.writeFileSync('../../exchanges/coinfalcon-markets.json', JSON.stringify(markets, null, 2)); + console.log(`Done writing CoinFalcon market data`); + }) + .catch(err => { + console.log(`Couldn't import products from CoinFalcon`); + console.log(err); + });