Add QuadrigaCX exchange and ticker (#176)
* Add QuadrigaCX exchange and ticker * Clean up code from QuadrigaCX
This commit is contained in:
parent
147db125dd
commit
bcf336741e
7 changed files with 238 additions and 12 deletions
28
lib/plugins/exchange/quadrigacx/quadrigacx.js
Normal file
28
lib/plugins/exchange/quadrigacx/quadrigacx.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const common = require('../../common/quadrigacx')
|
||||
const coinUtils = require('../../../coin-utils')
|
||||
|
||||
function buy (account, cryptoAtoms, fiatCode, cryptoCode) {
|
||||
return trade('buy', account, cryptoAtoms, fiatCode, cryptoCode)
|
||||
}
|
||||
|
||||
function sell (account, cryptoAtoms, fiatCode, cryptoCode) {
|
||||
return trade('sell', account, cryptoAtoms, fiatCode, cryptoCode)
|
||||
}
|
||||
|
||||
function trade (type, account, cryptoAtoms, fiatCode, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const market = common.buildMarket(fiatCode, cryptoCode)
|
||||
const options = {
|
||||
book: market,
|
||||
amount: coinUtils.toUnit(cryptoAtoms, cryptoCode).toFixed(8)
|
||||
}
|
||||
|
||||
return common.authRequest(account, '/' + type, options)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
buy,
|
||||
sell
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue