[ReleaseCandidate] Module "GrapheneExchange" - Simple Python Trading Interface

Started by xeroc, January 11, 2016, 02:08:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

iHashFury

Do I need to open another RPC wallet port to get this bad boy running?

feed port ArchlinuxARM:
206136ms th_a       main.cpp:169                  main                 ] wdata.ws_server: ws://localhost:8090
206165ms th_a       main.cpp:174                  main                 ] wdata.ws_user:  wdata.ws_password: 
206256ms th_a       main.cpp:240                  main                 ] Listening for incoming HTTP RPC requests on 127.0.0.1:8093


installed and feeds working without issues:
[jason@i4p python-graphenelib]$ make install-user
python setup.py install --user
/usr/lib/python3.5/site-packages/setuptools/dist.py:285: UserWarning: Normalizing '0.2-rc5' to '0.2rc5'
  normalized_version,
running install
running bdist_egg
running egg_info
writing top-level names to graphenelib.egg-info/top_level.txt
writing dependency_links to graphenelib.egg-info/dependency_links.txt
writing graphenelib.egg-info/PKG-INFO
reading manifest file 'graphenelib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'graphenelib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/base58.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/memo.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/transactions.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/account.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/dictionary.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/bip38.py -> build/bdist.linux-armv7l/egg/graphenebase
copying build/lib/graphenebase/__init__.py -> build/bdist.linux-armv7l/egg/graphenebase
creating build/bdist.linux-armv7l/egg/grapheneextra
copying build/lib/grapheneextra/proposal.py -> build/bdist.linux-armv7l/egg/grapheneextra
copying build/lib/grapheneextra/__init__.py -> build/bdist.linux-armv7l/egg/grapheneextra
creating build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/graphenewsprotocol.py -> build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/graphenewsrpc.py -> build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/grapheneclient.py -> build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/grapheneapi.py -> build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/graphenews.py -> build/bdist.linux-armv7l/egg/grapheneapi
copying build/lib/grapheneapi/__init__.py -> build/bdist.linux-armv7l/egg/grapheneapi
creating build/bdist.linux-armv7l/egg/grapheneexchange
copying build/lib/grapheneexchange/exchange.py -> build/bdist.linux-armv7l/egg/grapheneexchange
copying build/lib/grapheneexchange/grapheneexchange.py -> build/bdist.linux-armv7l/egg/grapheneexchange
copying build/lib/grapheneexchange/__init__.py -> build/bdist.linux-armv7l/egg/grapheneexchange
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/base58.py to base58.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/memo.py to memo.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/transactions.py to transactions.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/account.py to account.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/dictionary.py to dictionary.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/bip38.py to bip38.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/graphenebase/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneextra/proposal.py to proposal.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneextra/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/graphenewsprotocol.py to graphenewsprotocol.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/graphenewsrpc.py to graphenewsrpc.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/grapheneclient.py to grapheneclient.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/grapheneapi.py to grapheneapi.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/graphenews.py to graphenews.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneapi/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneexchange/exchange.py to exchange.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneexchange/grapheneexchange.py to grapheneexchange.cpython-35.pyc
byte-compiling build/bdist.linux-armv7l/egg/grapheneexchange/__init__.py to __init__.cpython-35.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying graphenelib.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying graphenelib.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying graphenelib.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying graphenelib.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/graphenelib-0.2rc5-py3.5.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing graphenelib-0.2rc5-py3.5.egg
Removing /home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg
Copying graphenelib-0.2rc5-py3.5.egg to /home/jason/.local/lib/python3.5/site-packages
graphenelib 0.2rc5 is already the active version in easy-install.pth

Installed /home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg
Processing dependencies for graphenelib==0.2rc5
Finished processing dependencies for graphenelib==0.2rc5
[jason@i4p python-graphenelib]$ pip install --user --upgrade -r requirements.txt graphenelib
Requirement already up-to-date: graphenelib in /home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg
Requirement already up-to-date: autobahn in /home/jason/.local/lib/python3.5/site-packages (from -r requirements.txt (line 1))
Requirement already up-to-date: requests in /home/jason/.local/lib/python3.5/site-packages (from -r requirements.txt (line 2))
Requirement already up-to-date: pycrypto in /usr/lib/python3.5/site-packages (from -r requirements.txt (line 3))
Requirement already up-to-date: scrypt in /home/jason/.local/lib/python3.5/site-packages (from -r requirements.txt (line 4))
Requirement already up-to-date: ecdsa in /home/jason/.local/lib/python3.5/site-packages (from -r requirements.txt (line 5))
Requirement already up-to-date: websocket-client in /home/jason/.local/lib/python3.5/site-packages (from -r requirements.txt (line 6))
Requirement already up-to-date: six>=1.9.0 in /usr/lib/python3.5/site-packages (from autobahn->-r requirements.txt (line 1))
Requirement already up-to-date: txaio>=2.2.0 in /home/jason/.local/lib/python3.5/site-packages (from autobahn->-r requirements.txt (line 1))


error on Archlinux and ArchlinuxARM:
[jason@i4p python-graphenelib]$ python3 ~/tmp/git/python-graphenelib/scripts/exchange-simpleticker-stats/main.py
Traceback (most recent call last):
  File "/home/jason/tmp/git/python-graphenelib/scripts/exchange-simpleticker-stats/main.py", line 1, in <module>
    from grapheneexchange import GrapheneExchange
  File "/home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg/grapheneexchange/__init__.py", line 2, in <module>
  File "/home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg/grapheneexchange/exchange.py", line 1, in <module>
ImportError: cannot import name 'GrapheneClient'
[jason@i4p python-graphenelib]$ python3 ~/tmp/git/python-graphenelib/scripts/exchange-bridge-market-maker/main.py
Traceback (most recent call last):
  File "/home/jason/tmp/git/python-graphenelib/scripts/exchange-bridge-market-maker/main.py", line 1, in <module>
    from grapheneexchange import GrapheneExchange
  File "/home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg/grapheneexchange/__init__.py", line 2, in <module>
  File "/home/jason/.local/lib/python3.5/site-packages/graphenelib-0.2rc5-py3.5.egg/grapheneexchange/exchange.py", line 1, in <module>
ImportError: cannot import name 'GrapheneClient'



feeds port Ubuntu
2812934ms th_a       main.cpp:169                  main                 ] wdata.ws_server: ws://localhost:8090
2813021ms th_a       main.cpp:174                  main                 ] wdata.ws_user:  wdata.ws_password: 
2813141ms th_a       main.cpp:240                  main                 ] Listening for incoming HTTP RPC requests on 127.0.0.1:8092


error on Ubuntu:
Successfully installed graphenelib requests six
Cleaning up...
:~/tmp/python-graphenelib$ python3 ~/tmp/python-graphenelib/scripts/exchange-simpleticker-stats/main.py
Traceback (most recent call last):
  File "tmp/python-graphenelib/scripts/exchange-simpleticker-stats/main.py", line 1, in <module>
    from grapheneexchange import GrapheneExchange
ImportError: No module named 'grapheneexchange'

roadscape

http://cryptofresh.com  |  witness: roadscape


xeroc

I am running archlinux as well ..

Try

  make install-user

In the library root dir ..

iHashFury

Quote from: xeroc on January 12, 2016, 06:32:38 PM
You need to upgrade the python-graphenelib library .. read the README.md

pip install --user --upgrade -r requirements.txt graphenelib ran without errors, also tried a fresh git clone.

Could it be a Archlinux specific issue as feeds are working fine. Will try on an Ubuntu server tomorrow.


xeroc


iHashFury

I would like to run this bot but I'm stuck on No module named 'grapheneexchange'

python3 ~/tmp/git/python-graphenelib/scripts/exchange-simpleticker-stats/main.py
Traceback (most recent call last):
  File "/home/jason/tmp/git/python-graphenelib/scripts/exchange-simpleticker-stats/main.py", line 1, in <module>
    from grapheneexchange import GrapheneExchange
ImportError: No module named 'grapheneexchange'


python3 ~/tmp/git/python-graphenelib/scripts/exchange-bridge-market-maker/main.py
Traceback (most recent call last):
  File "/home/jason/tmp/git/python-graphenelib/scripts/exchange-bridge-market-maker/main.py", line 1, in <module>
    from grapheneexchange import GrapheneExchange
ImportError: No module named 'grapheneexchange'


Do I need to set parameters in  python-graphenelib/grapheneexchange/grapheneexchange.py ?

ebit

telegram:ebit521
[url="https://weibo.com/ebiter"]https://weibo.com/ebiter[/url]

kuro112

hey this is awesome, i dabble in python myself but this blows me away.

nice job.
CTO @ Freebie, LLC

xeroc

I just fixed some bugs in the "sell" and "buy" methods .. It is important for the bot developer to understand that prices should always be denoted in 'quote'.
For example: in the USD_BTS market .. a price of 0.5 means ... every 1 BTS costs 0.5 USD.

Further .. I implemented a POC for a bot that places orders around the peg in markets that are supposed to trade near 1 (BTC:OPENBTC, etc...)
The script can be found here:
https://github.com/xeroc/python-graphenelib/blob/master/scripts/exchange-bridge-market-maker
Documentation is here:
http://python-graphenelib.readthedocs.org/en/latest/scripts-exchange-bridge-market-maker.html

I hope to see alot tighter pegs in some of these markets ..


abit

BitShares committee member: abit
BitShares witness: in.abit

cass

█║▌║║█  - - -  The quieter you become, the more you are able to hear  - - -  █║▌║║█

Riverhead



I can verify that the exchange-simpleticker-stats example works on a clean 14.04 install :D.


Great work Xeroc!