Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. from functions import *
  2. file = "bots.json"
  3.  
  4. users = loadUsers(file)
  5. bonds=getAllBonds()
  6. i=0
  7. while i < len(users):
  8. bonds=getAllBonds()
  9. username=users[str(i)]['user']
  10. password=users[str(i)]['passwort']
  11. agname=users[str(i)]['ag']
  12. securityAccount=getSecurityAccount(agname)
  13. j = 0
  14. auth = authGen(username, password)
  15. cash = getCashBySecurityAccount(securityAccount)
  16. deleteAllOrders(securityAccount, auth)
  17. while j < len(bonds) and cash>=100:
  18. price = bonds[j]['priceSpread']['askPrice']
  19. askSize = bonds [j]['priceSpread']['askSize']
  20. faceValue = bonds[j]['faceValue']
  21. issuer = bonds[j]['issuer']['listing']['name']
  22. #print str(price)+' '+str(askSize)+' '+str(faceValue)+' '+str(issuer)+' '+str(cash)
  23. if price!= None and askSize!=None and price!= None and price<=faceValue and issuer=='Alpha Bank':
  24. cash = cash - float(price)*float(askSize)
  25. securityIdentifier = bonds[j]['listing']['securityIdentifier']
  26. buySecurity(securityIdentifier, securityAccount, askSize, price, auth)
  27. j=j+1
  28. i=i+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement