This commit is contained in:
Josh Harvey 2016-09-26 17:22:46 +03:00
parent ee37367c62
commit f62e65fe93
3 changed files with 83 additions and 0 deletions

16
jsconfig.json Normal file
View file

@ -0,0 +1,16 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=759670
// for the documentation about the jsconfig.json format
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules",
"bower_components",
"jspm_packages",
"tmp",
"temp"
]
}

View file

@ -11,6 +11,7 @@ const db = require('./postgresql_interface')
const logger = require('./logger')
const notifier = require('./notifier')
const T = require('./time')
const config = require('./config')
const tradeIntervals = {}
@ -178,6 +179,8 @@ exports.configure = function configure (config) {
cryptoCodes = config.crypto.cryptoCurrencies
cryptoCodes.forEach(cryptoCode => {
cryptoScopedConfig = config.cryptoScoped(cryptoCode, cachedConfig)
// TICKER [required] configure (or load)
loadOrConfigPlugin(
tickerPlugins[cryptoCode],

View file

@ -25,3 +25,67 @@ schemas:
v update migrate-config to match lamassu.json schema
- update machine name
---------------------------
- are plugins loaded globally or per machine?
- list all used plugins:
ticker, trade, wallet, info (?), idVerifier, email, sms
- wallet doesn't care about fiat
- look into how each plugin is used
- info plugin not used
- need either transitive closure of all cryptos accross machines,
or add new plugin when needed
- currently we're looking at all cryptos, so this is probably easier
- different machines can have different coins, currencies, etc
- necessitates different plugins
- do plugins require initialization and state?
probably not
- require caches, so probably not big penalty to require whenever a plugin is needed
- essentially, plugins just need their account info, plus some additional
special info, such as masterSeed, fiatCurrencies, etc
- deviceCurrency needs to be fixed. currently we're assuming one currency
globally
load ticker plugin (not really, remove this), pollRate (can supply actual deviceCurrency),
purchase/trader (also device specific), consolidateTrades (see what calls this),
checkBalances (*check callee)
* pollRate -- this sets lastRates which is keyed by crypto only, may need
to be keyed by fiat as well; probably better to fetch on demand, with throttle
see: https://github.com/sindresorhus/mem
* consolidateTrades: one trader for each crypto, or separate per crypto/fiat?
does consolidateTrades need fiat currency at all? even so, shouldn't this
be in the trade record?
example: operator may have machines in US and China; might want different exchanges
for china machines; same for ticker
options: configure per machine; configure per crypto/fiat
- crypto/fiat requires more admin dev work design
- also restricts configurability
- but global ticker/exchange doesn't make sense if fiats are different
- which means it would be required to define ticker/exchange for each
machine, even if they all have the same crypto/fiat
* checkBalances: used for notifier, to indicate if balances are too low;
how to do this generalized across all machines/currencies?
* possibly configure home currency for admin; probably a good idea for
transactions, statistics, etc
-> For now, keep it as is -- one exchange per crypto, see how we handle fiat
currencies now. (passed in on trade -- we assume that we're using machine currency, which may not be true)
- consider defining exchange fiat currency in exchange account config, we don't pass in fiat amount, anyway