maxme / bitcoin-arbitrage

Bitcoin arbitrage - opportunity detector
MIT License
2.47k stars 857 forks source link

sometime fiat conversion rate is parsed as int from JSON #34

Closed sscarduzio closed 9 years ago

sscarduzio commented 10 years ago

Fixes this error by forcing conversion to float

pydev debugger: starting
Traceback (most recent call last):
  File "/Applications/eclipse/plugins/org.python.pydev_2.8.2.2013090511/pysrc/pydevd.py", line 1446, in <module>
    debugger.run(setup['file'], None, None)
  File "/Applications/eclipse/plugins/org.python.pydev_2.8.2.2013090511/pysrc/pydevd.py", line 1092, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "/Applications/eclipse/plugins/org.python.pydev_2.8.2.2013090511/pysrc/_pydev_execfile.py", line 38, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrage.py", line 72, in <module>
    main()
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrage.py", line 69, in main
    cli.main()
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrage.py", line 64, in main
    self.create_arbitrer(args)
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrage.py", line 38, in create_arbitrer
    self.arbitrer = Arbitrer()
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrer.py", line 17, in __init__
    self.init_markets(config.markets)
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/arbitrer.py", line 26, in init_markets
    market_name + '()')
  File "<string>", line 1, in <module>
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/public_markets/btceeur.py", line 10, in __init__
    super(BtceEUR, self).__init__("EUR")
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/public_markets/market.py", line 18, in __init__
    self.fc.update()
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/fiatconverter.py", line 64, in update
    self.update_currency_pair(currency)
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/fiatconverter.py", line 52, in update_currency_pair
    rate = self.get_currency_pair(code_from, code_to)
  File "/Users/sscarduzio/git/bitcoin-arbitrage/arbitrage/fiatconverter.py", line 35, in get_currency_pair
    rate = data["rate"] * (1.0 - self.bank_fee)
TypeError: can't multiply sequence by non-int of type 'float'
maxme commented 10 years ago

Thanks! I'm merging 7aa48e16358fb569493564349f66f9a380591188 - will review what's PubNub is before merging the rest.