This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Genar Trias Ortiz
committed
Dec 5, 2017
1 parent
5c21008
commit 93a1c95
Showing
7 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
40087 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import bittrex from 'node-bittrex-api' | ||
import debug from 'debug' | ||
|
||
module.exports = class BittrexExchange { | ||
constructor (bitrexOpts) { | ||
this.bittrexOps = bitrexOpts | ||
bittrex.options(bitrexOpts) | ||
} | ||
|
||
getBalances (cb) { | ||
bittrex.getbalances(function (data, err) { | ||
if (err) { | ||
cb(err) | ||
} | ||
|
||
cb(null, data.result) | ||
}) | ||
} | ||
|
||
getOrders (cb) { | ||
bittrex.getorderhistory({}, function (data, err) { | ||
if (err) { | ||
cb(err) | ||
} | ||
|
||
return cb(null, data) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,5 +33,9 @@ | |
"balance": { | ||
"dataSource": null, | ||
"public": true | ||
}, | ||
"order": { | ||
"dataSource": null, | ||
"public": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import BittrexExchange from '../exchanges/bittrex' | ||
|
||
module.exports = function (Order) { | ||
Order.getOrders = (cb) => { | ||
const bitrexOpts = Order.app.get('bittrex') | ||
const exchange = new BittrexExchange(bitrexOpts) | ||
|
||
exchange.getOrders((err, data) => { | ||
if (err) { | ||
cb(err) | ||
} | ||
|
||
cb(null, data) | ||
}) | ||
} | ||
|
||
Order.remoteMethod('getOrders', { | ||
http: { verb: 'get', path: '/' }, | ||
returns: {type: 'array', root: true} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "order", | ||
"plural": "orders", | ||
"base": "Model", | ||
"idInjection": true, | ||
"options": { | ||
"validateUpsert": true | ||
}, | ||
"properties": {}, | ||
"validations": [], | ||
"relations": {}, | ||
"acls": [], | ||
"methods": {} | ||
} |