Ejemplo n.º 1
0
def sell(wallet, amount, sprice):# ' ' ^ Sell
	wallets = btceapi.api.Trade(btceapi.api(config.API_KEY,config.API_SECRET), CUR1name.lower() + "_" + CUR2name.lower(), 'sell', sprice, float("%.4f"% amount))
	if wallets['success'] == 1:
		wallet[CUR1name] = wallets['return']['funds'][CUR1name.lower()]
		wallet[CUR2name] = wallets['return']['funds'][CUR2name.lower()]
	else:
		print wallets['error']
	return wallet
Ejemplo n.º 2
0
def buy(wallet, amount, bprice):# this buys 'amount' of cur1 at 'bprice', and returns a new wallet
	wallets = btceapi.api.Trade(btceapi.api(config.API_KEY,config.API_SECRET), CUR1name.lower() + "_" + CUR2name.lower(), 'buy', bprice, float("%.4f"% amount))
	if wallets['success'] == 1:
		wallet[CUR1name] = wallets['return']['funds'][CUR1name.lower()]
		wallet[CUR2name] = wallets['return']['funds'][CUR2name.lower()]
	else:
		print wallets['error']
	return wallet
Ejemplo n.º 3
0
 def getCurrentPrice(self,currencyPair):
     btceApi = api('','',False)
     ticker = btceApi.get_param(currencyPair, 'ticker')
     return ticker['ticker']
Ejemplo n.º 4
0
 def __init__(self, Keys):
   self.__API = api(api_key=Keys.Key, api_secret=Keys.Secret, wait_for_nonce=True)
   self.__A   = MyAlgos()
Ejemplo n.º 5
0
 def getCurrentPrice(self, currencyPair):
     btceApi = api('', '', False)
     ticker = btceApi.get_param(currencyPair, 'ticker')
     return ticker['ticker']
Ejemplo n.º 6
0
 def orders(self, pair):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.ActiveOrders(pair)
Ejemplo n.º 7
0
 def info(self):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.getInfo()
Ejemplo n.º 8
0
 def sell(self, rate, qty):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.Trade(self._active_pair, "sell", rate, qty)
Ejemplo n.º 9
0
 def cancelorder(self, pair):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.CancelOrder(pair)
Ejemplo n.º 10
0
def getwallet():# Gets the wallet for use initially
	accountdata = btceapi.api.getInfo(btceapi.api(config.API_KEY, config.API_SECRET))
	wallet = {CUR1name : accountdata['return']['funds'][CUR1name.lower()], CUR2name : accountdata['return']['funds'][CUR2name.lower()]};
	return wallet