Skip to content

Instantly share code, notes, and snippets.

@sigwo
Last active February 5, 2016 19:26
Show Gist options
  • Save sigwo/97e8d4d7b4e32f485f53 to your computer and use it in GitHub Desktop.
Save sigwo/97e8d4d7b4e32f485f53 to your computer and use it in GitHub Desktop.
This is my code.
var redis = require('redis');
client = redis.createClient()
var bittrex = require('node.bittrex.api');
var capbalance = "";
var capexchange = "";
var coin1 = 'DGB';
function rate(callback) {
client.hget('Exchange_Rates', 'digibyte', function(err, exchange) {
capexchange = exchange;
callback(capexchange);
});
};
function balance(callback) {
bittrex.getbalance({ currency : coin1 }, function(data) {
capbalance = data.result.Balance;
callback(capbalance);
});
};
function sell(exchange, balances) {
bittrex.selllimit({market: 'BTC-' + coin1, quantity: balances, rate: exchange}, function(data) {
console.log('Balance:', balances);
console.log('Rate:', exchange);
console.log(data);
});
client.quit();
};
function execute() {
rate(function() {
balance(function() {
sell(capexchange,capbalance);
});
});
};
execute();
This is what I get:
Balance: 1053.56220242
Rate: 0.00000038
{ success: false,
message: 'DUST_TRADE_DISALLOWED_MIN_VALUE_50K_SAT',
result: null }
SUCCESS!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment