zheng-hao / ga-bitbot

Automatically exported from code.google.com/p/ga-bitbot
GNU General Public License v3.0
0 stars 0 forks source link

bcbookie.py crashes on buy attempt with TypeError: unsupported operand type(s) for -: 'unicode' and 'int' #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

    I'm running the latest git release. After successfully running the 
gal.py with [PyPy 1.6.0 with GCC 4.5.2], I have imported the API key and 
manually ran the bcbookie.py with [Python 2.7.1+]. After a few sleep cycles it 
tries to buy a few shares and crashes with an error message pasted below. 
Please advise what to do next, or feel free to ask for more data or more 
detailed troubleshooting.

Grateful in advance!

---------

sleeping...
________________________________________________________________________________

________________________________________________________________________________
    update: current price: 6.300  account market value: 4.4100 @ Mon Jan  9 17:10:41 2012
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
checking open orders
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
checking held positions
--------------------------------------------------------------------------------
main: Availble Funds (USDS,BTCS) :(u'0', u'0.7')
buy: order validated
Traceback (most recent call last):
  File "bcbookie.py", line 550, in <module>
    b.buy(0.5,t['buy'],commit,t['target'],t['stop'],60 * 5,t['stop_age'])
  File "bcbookie.py", line 278, in buy
    if (self.funds() - self.balance_committed) > cost and qty >= 0.01:
TypeError: unsupported operand type(s) for -: 'unicode' and 'int'

Original issue reported on code.google.com by purge...@gmail.com on 9 Jan 2012 at 4:18

GoogleCodeExporter commented 8 years ago
The 'funds' function wasn't casting the returned data as a float which caused 
the error. Fixed on the repo.

Original comment by brian.mo...@gmail.com on 9 Jan 2012 at 11:00