Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

dynamic market update for coinfalcon #1761

Merged
merged 1 commit into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions exchanges/coinfalcon-markets.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
16 changes: 4 additions & 12 deletions exchanges/coinfalcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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,
Expand Down
45 changes: 45 additions & 0 deletions util/genMarketFiles/update-coinfalcon.js
Original file line number Diff line number Diff line change
@@ -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);
});