Author Topic: I need some help getting started with pybitshares  (Read 2640 times)

0 Members and 1 Guest are viewing this topic.

Offline litepresence

I need some help getting started with pybitshares
« 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]
[email protected] ~/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?

???
« Last Edit: January 30, 2018, 01:23:09 pm by litepresence »

Online sschiessl

Re: I need some help getting started with pybitshares
« Reply #1 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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12896
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: I need some help getting started with pybitshares
« Reply #2 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
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline litepresence

Re: I need some help getting started with pybitshares
« Reply #3 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]
[email protected] ~ $ pip install websocket-client

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

[email protected] ~ $ pip install websocket-client --upgrade

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

[email protected] ~ $ 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

[email protected] ~ $ 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...


[email protected] ~ $ cd Python/EV
[email protected] ~/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'
« Last Edit: January 30, 2018, 01:55:53 pm by litepresence »

Offline litepresence

Re: I need some help getting started with pybitshares
« Reply #4 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.

[email protected] ~ $ python --version
Python 2.7.6
[email protected] ~ $ python3 --version
Python 3.4.3

[email protected] ~ $ 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.

« Last Edit: January 30, 2018, 01:34:55 pm by litepresence »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12896
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: I need some help getting started with pybitshares
« Reply #5 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
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline litepresence

Re: I need some help getting started with pybitshares
« Reply #6 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

Offline Greggs49

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: I need some help getting started with pybitshares
« Reply #7 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.
« Last Edit: August 07, 2019, 07:23:34 am by Greggs49 »

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3880
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: I need some help getting started with pybitshares
« Reply #8 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.
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline Sheila68

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: I need some help getting started with pybitshares
« Reply #9 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.
« Last Edit: August 21, 2019, 10:35:39 am by Sheila68 »

Offline Daviddrync

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://ritualnyagent.flyland.ru/
I need some help getting started with pybitshares
« Reply #10 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?

Offline Daviddrync

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://ritualnyagent.flyland.ru/
I need some help getting started with pybitshares
« Reply #11 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?

Offline Daviddrync

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://ritualnyagent.flyland.ru/
I need some help getting started with pybitshares
« Reply #12 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?

Offline Daviddrync

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://ritualnyagent.flyland.ru/
I need some help getting started with pybitshares
« Reply #13 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?

Offline Daviddrync

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://ritualnyagent.flyland.ru/
Re: I need some help getting started with pybitshares
« Reply #14 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?

Offline Bunting547

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • BitShares: Tierra
Re: I need some help getting started with pybitshares
« Reply #15 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
« Last Edit: November 09, 2019, 11:12:46 am by Bunting547 »