BitShares Forum
		Main => Technical Support => Topic started by: j-v-h-silver on March 28, 2017, 09:48:58 pm
		
			
			- 
				Hello .. trying out the trading bot stakemachine by Xeroc ( many thanks for the work put in there ) I have it installed but when running against a test node ( before trying it out on the real exchange ) it fails at one line. Running on Ubuntu 14.04.5 LTS (Trusty Tahr) python3 in virtualenvs to make sure there are no Python version problems. Invalid syntax at   File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/strategies/maker.py", line 255
 placed_sell = self.sell(m, sell_price, sell_amount, returnID=True):
 
 Any help greatly appreciated
 John
 
 Traceback (most recent call last):
 File "/usr/local/bin/stakemachine", line 9, in <module>
 load_entry_point('stakemachine==0.0.2', 'console_scripts', 'stakemachine')()
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/__main__.py", line 137, in main
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/bot.py", line 108, in init
 File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
 return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
 File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
 File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 2164, in _find_spec
 File "<frozen importlib._bootstrap>", line 1940, in find_spec
 File "<frozen importlib._bootstrap>", line 1916, in _get_spec
 File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
 File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
 File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/strategies/maker.py", line 255
 placed_sell = self.sell(m, sell_price, sell_amount, returnID=True):
 ^
 SyntaxError: invalid syntax
 
 
 
- 
				Ok although I don't know Python I assumed the error  on line 255 was the colon .. but then how it could have worked for others I have no idea .. ( if that is the case ) so nothing ventured I removed the colon and reinstalled the package.
 Now I get a error on line 221 BUT it seems to be running the bot MakerWall2 which is perhaps more than it was.
 
 I will look at the github issues section for stakemachine and see if I am missing anything .. but any help here is greatly appreciated .. I am a DBA not a Python person .. Zero experience in it.
 
 Regards John
 
 }
 2017-03-29 07:17:47,779 - stakemachine.bot - INFO - Executing bot MakerWall2
 Traceback (most recent call last):
 File "/usr/local/bin/stakemachine", line 9, in <module>
 load_entry_point('stakemachine==0.0.2', 'console_scripts', 'stakemachine')()
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/__main__.py", line 142, in main
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/bot.py", line 137, in once
 File "/usr/local/lib/python3.4/dist-packages/stakemachine-0.0.2-py3.4.egg/stakemachine/strategies/maker.py", line 221, in place
 AttributeError: 'NoneType' object has no attribute 'get'
 
 
- 
				stakemachine has been unmaintained for some time ... you will need to install python-graphenelib **BELOW** 0.5.0
 Lot of stuff has changed since I wrote stakemachine ... give me some time to refractor it to properly work with pybitshares which is now my main focus of development
- 
				I'm not sure if this is appropriate or what you're looking for but https://btsbots.com/ works as an adroid app or in the webbrowser
 
 I don't mean to steal your thunder Xeroc!
- 
				I'm not sure if this is appropriate or what you're looking for but https://btsbots.com/ works as an adroid app or in the webbrowser
 
 I don't mean to steal your thunder Xeroc!
 
 No worries .. :)
- 
				Many Thank Xeroc .. and Permie
 I did notice the recent work by Alt on  https://btsbots.com/  and it looks good but with a quick runthrough for my immediate testing and future trading  stakemachine seems to give finer control BUT you need to know what Python is doing :-\
 That said I did a quick look for python videos on youtube using search terms "python tutes bitshares"  and the first 3 were [BitShares] Python Live Coding Parts I , 2 and 3 then some 56 videos on Python 3.4 Programming Tutorials.
 
 I have gone through Parts 1 and 2 and will look at 3 later today after working on SQL stuff I need to do for my day job but the very fact that there are 56  Python 3.4 Programming Tutorials from thenewboston56 shows its got a lot of bells and whistles ... probably much more than I can handle.
 
 I am glad I stumbled on the Bitshares Python ones as they are a good runthrough on Bitshares as well as Python.
 
 Many Thanks again
 Regards John
- 
				OOPs forgot to say I will try python-graphenelib **BELOW** 0.5.0 and see what happens then.
 I will use the latest github clone and leave the code as is with the above Library.
 If its still failing I will experiment with judiciously changing a little code ( blindfolded perhaps :-) one line or character at a time.
 
 Cheers John
- 
				OOPs forgot to say I will try python-graphenelib **BELOW** 0.5.0 and see what happens then.
 I will use the latest github clone and leave the code as is with the above Library.
 If its still failing I will experiment with judiciously changing a little code ( blindfolded perhaps :-) one line or character at a time.
 
 Cheers John
 
 Since you are learning python now, you may as well write your own quick bot using pybitshares. It's really easy: http://docs.pybitshares.com/en/latest/
 don't waste any of your time on python-graphenelib
- 
				Wow had a look at http://docs.pybitshares.com/en/latest/ ... Looks very extensive .. I will definitely give it a try long term .. but meanwhile stakemachine seems to be working but am getting an authorisation error. 
 I am not sure what authorisation its looking for since I made an account for it and gave it owner and active permissions for the bot. I turned off "safe mode" and the account "makerwall" has 10000 BTS and 10000 BTC in its account. This all may be wrong and it may just use "nathan" as thats the account and key in the config.yml file but when I originaly got the "missing required active authority" message I just tried adding permissions to the account.
 I used accounts "nathan" "id":"1.2.17" and also added permissions for "makerwall" "id":""1.2.21"
 
 I am thinking this is a permissions problem with my account setup but I cant really see where?
 Just learning one step at a time so any help is greatly appreciated.
 
 Cheers John
 
 vagrant@vagrant-ubuntu-trusty-64:~/stakemachine$ stakemachine -c configGU1.yml once
 2017-03-31 03:11:30,346 - stakemachine - INFO - Configuration: {
 "bots": {
 "makerwall": {
 "only_sell": false,
 "only_buy": false,
 "bot": "MakerSellBuyWalls",
 "target_price_offset_percentage": 1,
 "volume_percentage": 50,
 "target_price": "last",
 "markets": [
 "BTC:BTS"
 ],
 "symmetric_sides": true,
 "spread_percentage": 5,
 "amount": {
 "type": "absolute",
 "amounts": {
 "BTS": 2,
 "BTC": 2
 }
 },
 "module": "stakemachine.strategies.maker"
 }
 },
 "account": "nathan",
 "market_separator": ":",
 "reserves": {
 "BTS": 1000,
 "BTC": 1000
 },
 "safe_mode": false,
 "prefix": "BTC",
 "witness_url": "ws://192.168.0.18:8090"
 }
 2017-03-31 03:11:30,981 - stakemachine.bot - INFO - Executing bot makerwall
 2017-03-31 03:11:31,023 - stakemachine.strategies.basestrategy - INFO -  - Selling 2.000000 BTC for 20.500000 BTS @10.250000 BTS/BTC
 2017-03-31 03:11:31,997 - stakemachine.strategies.basestrategy - CRITICAL - An error occured while trying to sell: 3030001 tx_missing_active_auth: missing required active authority
 Missing Active Authority 1.2.17
 {"id":"1.2.17","auth":{"weight_threshold":1,"account_auths":[["1.2.17",1],["1.2.21",1]],"key_auths":[["GPH6rZGEFVeYQ74hFCqSea58q2GSfuFKQ6FsG5ikinWtSvcYsp95E",1],["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",1]],"address_auths":[]},"owner":{"weight_threshold":1,"account_auths":[["1.2.17",1],["1.2.21",1]],"key_auths":[["GPH6rZGEFVeYQ74hFCqSea58q2GSfuFKQ6FsG5ikinWtSvcYsp95E",1],["GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",1]],"address_auths":[]}}
 th_a  transaction.cpp:282 verify_authority
 
 {"ops":[[1,{"fee":{"amount":500000,"asset_id":"1.3.0"},"seller":"1.2.17","amount_to_sell":{"amount":20000,"asset_id":"1.3.4"},"min_to_receive":{"amount":205000,"asset_id":"1.3.2"},"expiration":"2017-03-31T16:11:31","fill_or_kill":false,"extensions":[]}]],"sigs":["GPH72L4MQk2wmcPQazPyUf5umjd7pVC1LXZtRhx8DnCKaJ7Hdv7cN"]}
 th_a  transaction.cpp:297 verify_authority
 
 
 
 
 
- 
				Hello All
 Looking at the last post I should clarify ... I tried running with my test account on the public testnet wss://node.testnet.bitshares.eu as well as the "test" witness node I set up  for myself witness_url: "ws://104.196.5.69:8090".
 With my "test" witness I used as test accounts "makerwall" (a new account created for testing stakemachine) and the "nathan" account that is used during the "make your own witness" walkthrough.
 Both had their accounts added to active and owner permissions via the webwallet with plenty of assets and lifetime membership.
 If I changed the WIF key entry in the config.yml file from the key in the "active permissions" to the one from "owner permissions" I get the return error wifNotActive so I am confident I used the correct WIF ( active permissions )
 File "/usr/local/lib/python3.4/dist-packages/graphenelib-0.4.4-py3.4.egg/grapheneexchange/exchange.py", line 218, in __init__
 grapheneexchange.exchange.WifNotActive
 
 Should I be using the cli-wallet command line program to set up these test accounts instead of the web wallet or light wallet?
 I wouldn't think that would make a difference and both makerwall and nathan can trade on my "test" witness node manually and an account aab-12345 on the public testnet so I am not sure what permissions are required here.
 
 Regards and thanks again for any assistance ... John
 
 Private key viewer active permissions makerwall
 
 PUBLIC KEY
 GPH6rZGEFVeYQ74hFCqSea58q2GSfuFKQ6FsG5ikinWtSvcYsp95E
 PRIVATE KEY (WIF - WALLET IMPORT FORMAT)
 5JEwbb4kxdRvo6D3EX73ztQiGpDUeQYXWnKHrgutnmP8w7H1fXa (hide)
 
 BRAINKEY POSITION
 6
 
 Private key viewer owner permissions makerwall
 
 PUBLIC KEY
 GPH56N4qftvsG2SY2av9V4bpAUXTwjXknsGgRFj9gvq7Xf2ALgw32
 PRIVATE KEY (WIF - WALLET IMPORT FORMAT)
 5JNfhKTzPRCheSghMHhCkng3UtqELGiF4BEvbWPDY25ANyLySBR (hide)
 
 BRAINKEY POSITION
 5
- 
				It seems much has changed with StakeMachine.
 
 And OpenSSL compatibility is a pain point presently.
- 
				https://github.com/xeroc/stakemachine/issues/15