BitShares Forum

Main => Technical Support => Topic started by: litepresence on January 29, 2018, 06:09:06 pm

Title: I need some help getting started with pybitshares
Post by: litepresence on January 29, 2018, 06:09:06 pm
experienced python algo trader... very good w/ quant, databases, plotting, backtesting, etc...
but least favorite task is connectivity; moving from one api to another.


just getting started w/ pybitshares:

not fully understanding what I need to do; so please ELI5

thanks,

litepresence

I just need basic trading functions:

buy/sell/cancel
list open orders
ticker
balances
orderbook



first try first fail:



Code: [Select]
from bitshares.account import Account
account = Account("xeroc")
print(account)
print(account.balances)




Code: [Select]
xyz@xyz ~/Python/EV $ python3 bitsharestest.py

Traceback (most recent call last):
  File "bitsharestest.py", line 14, in <module>
    account = Account("xeroc")
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/account.py", line 50, in __init__
    bitshares_instance=None
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/blockchainobject.py", line 69, in __init__
    self.bitshares = bitshares_instance or shared_bitshares_instance()
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/instance.py", line 15, in shared_bitshares_instance
    SharedInstance.instance = bts.BitShares()
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/bitshares.py", line 151, in __init__
    **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/bitshares.py", line 180, in connect
    self.rpc = BitSharesNodeRPC(node, rpcuser, rpcpassword, **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/bitsharesapi/bitsharesnoderpc.py", line 23, in __init__
    super(BitSharesNodeRPC, self).__init__(*args, **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/grapheneapi/graphenewsrpc.py", line 64, in __init__
    self.wsconnect()
  File "/home/xyz/.local/lib/python3.4/site-packages/grapheneapi/graphenewsrpc.py", line 79, in wsconnect
    self.ws = websocket.WebSocket(sslopt=sslopt_ca_certs)
TypeError: __init__() got an unexpected keyword argument 'sslopt'



seems like no matter what I do I get this TypeError

why?  what is sslopt?  what do I have to do to fix the problem?

???
Title: Re: I need some help getting started with pybitshares
Post by: sschiessl on January 30, 2018, 05:31:58 am
How is your system setup?

Is this all installed?
http://docs.pybitshares.com/en/latest/installation.html
Title: Re: I need some help getting started with pybitshares
Post by: xeroc on January 30, 2018, 09:05:38 am
To me, this looks like the wrong or an outdated `websocket` library is installed.
The correct package is called `websocket-client` in pip3
Title: Re: I need some help getting started with pybitshares
Post by: litepresence on January 30, 2018, 01:18:33 pm
To me, this looks like the wrong or an outdated `websocket` library is installed.
The correct package is called `websocket-client` in pip3


Code: [Select]
xyz@xyz ~ $ pip install websocket-client

Requirement already satisfied (use --upgrade to upgrade): websocket-client in ./.local/lib/python2.7/site-packages
Cleaning up...

xyz@xyz ~ $ pip install websocket-client --upgrade

Requirement already up-to-date: websocket-client in ./.local/lib/python2.7/site-packages
Cleaning up...

xyz@xyz ~ $ pip3 install websocket-client --upgrade

Downloading/unpacking websocket-client
  Downloading websocket_client-0.46.0-py2.py3-none-any.whl (200kB): 200kB downloaded
Downloading/unpacking six from https://pypi.python.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl#md5=866ab722be6bdfed6830f3179af65468 (from websocket-client)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: websocket-client, six
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 206, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 193, in clobber
    os.makedirs(destsubdir)
  File "/usr/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/websocket_client-0.46.0.dist-info'
Storing debug log for failure in /home/xyz/.pip/pip.log

xyz@xyz ~ $ sudo pip3 install websocket-client --upgrade
[sudo] password for xyz:

Downloading/unpacking websocket-client
  Downloading websocket_client-0.46.0-py2.py3-none-any.whl (200kB): 200kB downloaded
Downloading/unpacking six from https://pypi.python.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl#md5=866ab722be6bdfed6830f3179af65468 (from websocket-client)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: websocket-client, six
  Found existing installation: six 1.5.2
    Not uninstalling six at /usr/lib/python3/dist-packages, owned by OS
Successfully installed websocket-client six
Cleaning up...


xyz@xyz ~ $ cd Python/EV
xyz@xyz ~/Python/EV $ python3 bitsharestest.py

Traceback (most recent call last):
  File "bitsharestest.py", line 11, in <module>
    account = Account("xeroc")
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/account.py", line 50, in __init__
    bitshares_instance=None
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/blockchainobject.py", line 69, in __init__
    self.bitshares = bitshares_instance or shared_bitshares_instance()
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/instance.py", line 15, in shared_bitshares_instance
    SharedInstance.instance = bts.BitShares()
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/bitshares.py", line 151, in __init__
    **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/bitshares/bitshares.py", line 180, in connect
    self.rpc = BitSharesNodeRPC(node, rpcuser, rpcpassword, **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/bitsharesapi/bitsharesnoderpc.py", line 23, in __init__
    super(BitSharesNodeRPC, self).__init__(*args, **kwargs)
  File "/home/xyz/.local/lib/python3.4/site-packages/grapheneapi/graphenewsrpc.py", line 64, in __init__
    self.wsconnect()
  File "/home/xyz/.local/lib/python3.4/site-packages/grapheneapi/graphenewsrpc.py", line 79, in wsconnect
    self.ws = websocket.WebSocket(sslopt=sslopt_ca_certs)
TypeError: __init__() got an unexpected keyword argument 'sslopt'



no change

TypeError: __init__() got an unexpected keyword argument 'sslopt'
Title: Re: I need some help getting started with pybitshares
Post by: litepresence on January 30, 2018, 01:22:24 pm
How is your system setup?

Is this all installed?
http://docs.pybitshares.com/en/latest/installation.html

I have both python 2 and python 3 installed.

xyz@xyz ~ $ python --version
Python 2.7.6
xyz@xyz ~ $ python3 --version
Python 3.4.3

xyz@xyz ~ $ cat /etc/linuxmint/info
RELEASE=17.3
CODENAME=rosa
EDITION="Cinnamon 64-bit"
DESCRIPTION="Linux Mint 17.3 Rosa"
DESKTOP=Gnome
TOOLKIT=GTK


I did everything mentioned in the installation page of the docs for pybitshares.

Title: Re: I need some help getting started with pybitshares
Post by: xeroc on January 30, 2018, 02:55:00 pm
pybitshares only works with python3. So pip3 must be used.

Can you remove the websocket* folders in
/home/xyz/.local/lib/python3.4/site-packages/
and reinstall websocket-client, please
Title: Re: I need some help getting started with pybitshares
Post by: litepresence on January 30, 2018, 04:59:29 pm
works!

:D

huge

days and days of rabbit holes

finally can see my acct balance!



...next trade functions



oh btw... perhaps u don't want to keep your PORNXXX coins held on your public xeroc bitshares account

 :o
Title: Re: I need some help getting started with pybitshares
Post by: Greggs49 on August 06, 2019, 10:11:50 am
I am using pybitshares for generating wallet accounts for my users, I hit the bitshares.wallet.create() and want to store the keys to database but this function always returns null and when I check bitshares.wallet.created() it results true Walgreens Survey (https://www.walgreenslistens.us/).
Title: Re: I need some help getting started with pybitshares
Post by: abit on August 06, 2019, 10:46:16 pm
I am using pybitshares for generating wallet accounts for my users, I hit the bitshares.wallet.create() and want to store the keys to database but this function always returns null and when I check bitshares.wallet.created() it results true.
Please ask in https://t.me/pybitshares

Perhaps you can call dump keys or a similar function.
Title: Re: I need some help getting started with pybitshares
Post by: Sheila68 on August 20, 2019, 10:22:00 am
Exchange, Bridges, and Gateways represent business that trade or exchange assets that are located inside a Graphene network (e.g. BitShares) against assets that are located outside the blockchain network. For instance, exchanges trade lite blue (https://liteblue.me).
Title: I need some help getting started with pybitshares
Post by: Daviddrync on August 29, 2019, 10:24:20 pm
After updating to the new client, i cant play with shugo console it doesnt apply the changes to the fov in 64bit. in 32bit, it works good. Is there any way to fix this?
Title: I need some help getting started with pybitshares
Post by: Daviddrync on August 29, 2019, 10:28:46 pm
After updating to the new client, i cant play with shugo console it doesnt apply the changes to the fov in 64bit. in 32bit, it works good. Is there any way to fix this?
Title: I need some help getting started with pybitshares
Post by: Daviddrync on August 29, 2019, 10:34:47 pm
After updating to the new client, i cant play with shugo console it doesnt apply the changes to the fov in 64bit. in 32bit, it works good. Is there any way to fix this?
Title: I need some help getting started with pybitshares
Post by: Daviddrync on August 29, 2019, 10:39:16 pm
After updating to the new client, i cant play with shugo console it doesnt apply the changes to the fov in 64bit. in 32bit, it works good. Is there any way to fix this?
Title: Re: I need some help getting started with pybitshares
Post by: Daviddrync on August 29, 2019, 10:40:29 pm
After updating to the new client, i cant play with shugo console it doesnt apply the changes to the fov in 64bit. in 32bit, it works good. Is there any way to fix this?
Title: Re: I need some help getting started with pybitshares
Post by: Bunting547 on November 08, 2019, 04:55:15 am
I assume the reader is comfortable with obtaining private keys for his BitShares account and using computers and programming in general. The more experience you have the easier it will be mygiftcardsite (https://www.mygiftcardsite.us/)