Main > Technical Support
Very slow market buy with pybitshares API
ParadoximA:
Hi everyone. I've been trying out the pybitshares API and can get it to do almost everything I need. However, when I buy or sell on the market, it takes between 10 and 20 minutes before the transaction shows up. During that time, python is using a lot of CPU. Am I doing something wrong, or is that normal? Market queries etc are instant. Buying and selling with the web interface is also instant. When I added the private key, it also took several minutes (I thought python had crashed, and I restarted it a few times, before allowing it to finally add the key).
Here's what I did:
I created a new account (account model) using my browser, then created a new wallet using the pybitshares API, then imported my private key (bitshares.wallet.addPrivateKey('xxxxx')).
Below is the code that produces the problem.
--- Code: ---from bitshares import BitShares
from bitshares.market import Market
from bitshares.price import Price
from bitshares.amount import Amount
from bitshares.account import Account
import time
account = Account("xxxxx")
Node1="wss://bitshares.openledger.info/ws"#Nuremberg, Germany
bitshares=BitShares(Node1,nobroadcast=False)
market = Market("BTS:USD")
print(market.bitshares.wallet.unlock("xxxxx"))
USD_Bal=account.balance('USD')
print('Buying BTS')
print(market.buy(\
Price(0.115, "USD/BTS"),\
Amount(USD_Bal/0.115*0.5, "BTS"),\
account="xxxxx",\
returnOrderId='head'\
))
--- End code ---
I've tried without the returnOrderId='head' setting, it's still slow. Any ideas?
Navigation
[0] Message Index
[*] Previous page
Go to full version