nfriedly / Coin-Allocator

Bitcoin/Altcoin/USD trading bot. Was moderately profitable, until the exchange got hacked. No longer under active development.
51 stars 7 forks source link

secondary_currency_code error #4

Open ghost opened 9 years ago

ghost commented 9 years ago

Hello

getting the error below

./cryptsy.sh
fetching current data...
fetching history to compute gains...

TypeError: Cannot read property 'secondary_currency_code' of undefined
    at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:269:40
    at Function.map (/home/jason/bin/Coin-Allocator/node_modules/lodash/dist/lodash.js:3508:27)
    at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:263:28
    at Cryptsy.parseResponse (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:131:21)
    at null.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:102:14)
    at Request.self.callback (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:129:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:873:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:824:12)
nfriedly commented 9 years ago

hum, I wonder if cryptsy changed their API... On Nov 28, 2014 4:58 AM, "iHashFury" notifications@github.com wrote:

Hello

getting the error below

./cryptsy.sh fetching current data... fetching history to compute gains...

TypeError: Cannot read property 'secondary_currency_code' of undefined at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:269:40 at Function.map (/home/jason/bin/Coin-Allocator/node_modules/lodash/dist/lodash.js:3508:27) at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:263:28 at Cryptsy.parseResponse (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:131:21) at null. (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:102:14) at Request.self.callback (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:129:22) at Request.emit (events.js:98:17) at Request. (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:873:14) at Request.emit (events.js:117:20) at IncomingMessage. (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:824:12)

— Reply to this email directly or view it on GitHub https://github.com/nfriedly/Coin-Allocator/issues/4.

ghost commented 9 years ago

Could be a change in the XRP market.

nfriedly commented 9 years ago

hey, can you post your cryptsy.sh file (without the public/private keys if it has them)?

ghost commented 9 years ago

Hello

# run my target allocation 
# note the --yes parameter is required to have it run as a scheduled task
# the --no-compute-gains param is optional but recommended because speeds things up.
# my keys are stored in the CRYPTSY_PUBKLIC_KEY and CRYPTSY_PRIVATE_KEY on heroku (run `heroku config:add 'KEY=value'`)

#coin and variables
allocation=""
threshold="2.69"
#conigecko top 9 "[symbol] [%]"
coinA="BTC 20"
coinB="DOGE 10"
coinC="LTC 10"
coinD="BC 0"
coinE="DRK 10"
coinF="XRP 20"
coinG="USD 20"
coinH="VTC 0"
coinI="PPC 0"
#and jason pick or $
coinJ="RDD 10"

#keys
publickey="##########"
privatekey="###########"

#script
node cli.js --allocation.$coinA $allocation --allocation.$coinB $allocation --allocation.$coinC $allocation --allocation.$coinD $allocation  --allocation.$coinE $allocation --allocation.$coinF $allocation --allocation.$coinG $allocation --allocation.$coinH $allocation --allocation.$coinI $allocation --allocation.$coinJ $allocation --threshold $threshold --public-key $publickey --private-key $privatekey

#--no-format --no-compute-gains --yes

### to update
#git pull
#npm update -g coin-allocator
### to update

also tried

node cli.js --allocation.BTC 20 --allocation.DOGE 10  --allocation.LTC 10 --allocation.DRK 10  --allocation.XRP 20 --allocation.USD 20 --allocation.RDD 10 --public-key ######### --private-key #########

and

node cli.js --allocation.BTC 20 --allocation.DOGE 10  --allocation.LTC 10 --allocation.DRK 10 --allocation.USD 40 --allocation.RDD 10 --public-key ######### --private-key #########

got the same error.

nfriedly commented 9 years ago

Hum, that's really odd - they're all working for me. If you add --debug to the command, does it change anything?

ghost commented 9 years ago

Tried on Archlinux and ArchlinuxArm.

ArchlinuxArm

[jason@i4p Coin-Allocator]$ node cli.js --allocation.BTC 20 --allocation.DOGE 10  --allocation.LTC 10 --allocation.DRK 10  --allocation.XRP 20 --allocation.USD 20 --allocation.RDD 10 --public-key ######### --private-key ######### --debug
fetching current data...
fetching history to compute gains...

TypeError: Cannot read property 'secondary_currency_code' of undefined
    at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:269:40
    at Function.map (/home/jason/bin/Coin-Allocator/node_modules/lodash/dist/lodash.js:3508:27)
    at /home/jason/bin/Coin-Allocator/exchanges/cryptsy.js:263:28
    at Cryptsy.parseResponse (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:131:21)
    at null.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/cryptsy.js:102:14)
    at Request.self.callback (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:372:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:1317:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/jason/bin/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:1265:12)
[jason@i4p Coin-Allocator]$

Archlinux

[jason@sam Coin-Allocator]$ node cli.js --allocation.BTC 20 --allocation.DOGE 10  --allocation.LTC 10 --allocation.DRK 10  --allocation.XRP 20 --allocation.USD 20 --allocation.RDD 10 --public-key ######### --private-key ######### --debug
fetching current data...
fetching history to compute gains...

TypeError: Cannot read property 'secondary_currency_code' of undefined
    at /home/jason/tmp/git/Coin-Allocator/exchanges/cryptsy.js:269:40
    at Function.map (/home/jason/tmp/git/Coin-Allocator/node_modules/lodash/dist/lodash.js:3508:27)
    at /home/jason/tmp/git/Coin-Allocator/exchanges/cryptsy.js:263:28
    at Cryptsy.parseResponse (/home/jason/tmp/git/Coin-Allocator/node_modules/cryptsy/cryptsy.js:131:21)
    at null.<anonymous> (/home/jason/tmp/git/Coin-Allocator/node_modules/cryptsy/cryptsy.js:102:14)
    at Request.self.callback (/home/jason/tmp/git/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:129:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/home/jason/tmp/git/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:873:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/jason/tmp/git/Coin-Allocator/node_modules/cryptsy/node_modules/request/request.js:824:12)
[jason@sam Coin-Allocator]$
nfriedly commented 9 years ago

OK, I just published a v0.10.1 that displays the debug output a bit earlier and it should also give a more helpful error message in the event that it cannot find a market. Please update and try again.

Also, I think the issue may be happening while computing the trade history - can you try it with the --no-compute-gains flag to bypass the history part entirely?

ghost commented 9 years ago

--no-compute-gains bypass works so my cron job is back up and running :)

Below is the --debug error without it.

module.js:340
    throw err;
          ^
Error: Cannot find module 'lodash'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/jason/tmp/git/Coin-Allocator/cli.js:12:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Hope this helps

nfriedly commented 9 years ago

Cool, glad it's working for you with the --no-compute-gains, that tells me I'm on the right track.

Although, that's not quite the error I was expecting... I think I might just disable compute-gains by default, because I have an inclining about the root cause, but it's going to take me a while to fix it.