Eloque / CexControl

Python utility to connect to Cex.IO
25 stars 15 forks source link

<type 'exceptions.KeyError'> #13

Open drak42 opened 10 years ago

drak42 commented 10 years ago

Hi,

This error has just popped up in the last few days.

This has been working perfectly until this though, awesome app.

Any ideas?

Cheers

Chris

Eloque commented 10 years ago

I've seen it popup a few times as well it keeps working afterwards. I think it might be a network issue or type issue, but can't narrow it down yet.

Eloque commented 10 years ago

Looks like they removed key pairs for exchanges, I am investigating.

Eloque commented 10 years ago

I think they removed the NMC/GHS market.

Eloque commented 10 years ago

Fixed.

drak42 commented 10 years ago

Awesome! will give it a go.

thanks

drak42 commented 10 years ago

Working perfectly!

GuyPaddock commented 10 years ago

Still getting this one:

======= CexControl version 0.9.6 =======
Attempting to load Settings
File found, loaded
File found, loaded

Configuration created, attempting save
Save successfull, attempting reload
========================================
Account       : guypaddock
GHS balance   : 1584.64191019
========================================
BTC Threshold: 0.00001000
BTC Reserve  : 0.00000000
NMC Threshold: 0.00001000
NMC Reserve  : 0.00000000
IXC Threshold: 0.00001000
IXC Reserve  : 0.00000000
LTC Threshold: 0.00001000
LTC Reserve  : 0.00000000
Efficiency Threshold: 1.0
Hold coins below efficiency threshold: False

Start cycle at Fri Oct 31 11:00:27 2014
GHS balance: 1584.64191019

BTC Balance: 0.00000003
NMC Balance: 0.83545576
IXC Balance: 0.41232540
LTC Balance: 0.00000000
Unexpected error:
<type 'exceptions.KeyError'>
An error occurred, skipping cycle
GuyPaddock commented 10 years ago

Here's the traceback:

Traceback (most recent call last):
  File "./CexControl.py", line 276, in main
    TradeLoop(context, settings)
  File "./CexControl.py", line 338, in TradeLoop
    ReinvestCoinByClass(context, settings.IXC, "BTC")
  File "./CexControl.py", line 538, in ReinvestCoinByClass
    TradeCoin( Context, CoinName, TargetCoin, InvestableSaldo )
  File "./CexControl.py", line 556, in TradeCoin
    Price = GetPriceByCoin( Context, CoinName, TargetCoin )
  File "./CexControl.py", line 711, in GetPriceByCoin
    return GetPrice(Context, Ticker)
  File "./CexControl.py", line 747, in GetPrice
    Ask = ticker["ask"]
KeyError: 'ask'
GuyPaddock commented 10 years ago

This appears to be for the "IXC/BTC" pair. Then again, hard to tell since it's the first pair it looks like it's trying to retrieve.

EDIT: Nope, it fails on NMC as well. The result of the ticker call is "{u'error': u"Cannot read property 'value' of null"}"

EDIT 2: It looks like CEX's API is broken for the IXC/BTC, LTC/BTC, and NMC/BTC. Hitting these URLs yields that property error from their side:

https://cex.io/api/ticker/IXC/BTC https://cex.io/api/ticker/LTC/BTC https://cex.io/api/ticker/NMC/BTC

This works though: https://cex.io/api/ticker/GHS/BTC

Eloque commented 10 years ago

Can reproduce now. That is strange.

Eloque commented 10 years ago

It's a different error for https://cex.io/api/ticker/BTC/GHS then it is for https://cex.io/api/ticker/IXC/BTC.

One is null value, the other an invalid symbol pair.

Eloque commented 10 years ago

The URL's come and go in availability, I am going to chalk this up to Cex IO availability.

GuyPaddock commented 10 years ago

Technically, it's /GHS/BTC, not BTC/GHS. The former will yield the invalid symbol pair message.

Very strange, that symbol pair is back up now.

papermache commented 9 years ago

Howdy,

Also getting this error. Readout is:

Configuration created, attempting save

Save successfull, attempting reload

Account : fenjamin

GHS balance : 264.54567774

BTC Threshold: 0.00438012 BTC Reserve : 0.00002000 NMC Threshold: 0.00000000 NMC Reserve : 0.00000000 Efficiency Threshold: 1.0 Hold coins below efficiency threshold: False

Start cycle at Wed Dec 31 23:02:08 2014 Cancel order failed GHS balance: 264.54567774

Unexpected error: type 'exceptions.KeyError' An error occurred, skipping cycle

Cycle completed, idle for 150 seconds

Is it me? Is it Eloque? Is it Cex? Forgive the cute GHS balance, am new to this.

Eloque commented 9 years ago

I can't seem to reproduce this. Does it still occur?

papermache commented 9 years ago

Yep.

Config file settings:

{"username": "fenjamin", "NMCReserve": "0.0", "secret": "*_", "NMCThreshold": "0.0", "key": "_", "BTCReserve": "2e-05", "BTCThreshold": "0.00438012", "HoldCoins": false, "EfficiencyThreshold": "1.0"}

papermache commented 9 years ago

Currently debugging in Microsoft Visual Studio. Any chance for a profit calculator accounting for this script?

Best

Eloque commented 9 years ago

You are debugging a Python script in MVS? Also, I can't reproduce your error atm.