Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PyWaves authored Jun 21, 2017
1 parent ed25b57 commit ad43e7b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ __pywaves.Address(address, publicKey, privateKey, seed)__ _Creates a new Address

`buy(assetPair, amount price, maxLifetime=30*86400, matcherFee=DEFAULT_MATCHER_FEE)` post a buy order

`tradableBalance(assetPair)` get tradable balance for the specified asset pair

`sell(assetPair, amount, price, maxLifetime=30*86400, matcherFee=DEFAULT_MATCHER_FEE)` post a sell order

`lease(recipient, amount, txFee=DEFAULT_LEASE_FEE)` post a lease transaction
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
CHAIN = 'mainnet'
CHAIN_ID = 'W'
PYWAVES_DIR='/Users/paolo/.pywaves'
MATCHER = 'http://dev.pywaves.org:6886'
MATCHER = 'https://nodes.wavesnodes.com'
MATCHER_PUBLICKEY = ''

DATAFEED = 'http://marketdata.wavesplatform.com'
Expand Down
10 changes: 10 additions & 0 deletions address.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ def sell(self, assetPair, amount, price, maxLifetime=30 * 86400, matcherFee=pywa
if id!=-1:
return pywaves.Order(id, assetPair, self)

def tradableBalance(self, assetPair):
try:
balances = pywaves.wrapper('/matcher/orderbook/%s/%s/tradableBalance/%s' % ('WAVES' if assetPair.asset1.assetId == '' else assetPair.asset1.assetId, 'WAVES' if assetPair.asset2.assetId == '' else assetPair.asset2.assetId, self.address), host=pywaves.MATCHER)
amountBalance = balances['WAVES' if assetPair.asset1.assetId == '' else assetPair.asset1.assetId]
priceBalance = balances['WAVES' if assetPair.asset2.assetId == '' else assetPair.asset2.assetId]
except:
amountBalance = 0
priceBalance = 0
return amountBalance, priceBalance

def lease(self, recipient, amount, txFee=pywaves.DEFAULT_LEASE_FEE):
if not self.privateKey:
logging.error('Private key required')
Expand Down

0 comments on commit ad43e7b

Please sign in to comment.