looking for a bit of javascript loops. im trying to define a bunch of coin names with for (coin in coinnames){
and use "coin"
as a variable inside this loop. and i seem to be having troubles. i have tried brackets quotations and every mix in between.
var Cryptsy = require('cryptsy');
redis = require('redis');
client = redis.createClient()
var cryptsy = new Cryptsy('key', 'secret');
var bittrex = require('node.bittrex.api');
bittrex.options({
'apikey': 'key',
'apisecret': 'secret',
'stream': true,
'verbose': true,
'cleartext': true,
'baseUrl': 'https://bittrex.com/api/v1.1'
});
var coinnames = ['BTC', 'NEOS'];
for (coin in coinnames) {
client.hget("Exchange_Rates", "coin", function(err7, price) {
console.dir(coin + " Price: " + price);
console.dir(err7)
bittrex.sendCustomRequest('https://bittrex.com/api/v1.1/account/getbalances?apikey=key¤cy=coin', function(data) {
console.log(data.result[0].Balance);
setTimeout(function() {
bittrex.sendCustomRequest('https://bittrex.com/api/v1.1/market/selllimit?apikey=key&market=BTC-coin&quantity=data.result[0].Balance&rate=price', function(data) {
console.log(data);
}, true);
}, 20000);
}, true);
});
};