Esempio 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
Esempio 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
 def getCurrentPrice(self,currencyPair):
     btceApi = api('','',False)
     ticker = btceApi.get_param(currencyPair, 'ticker')
     return ticker['ticker']
Esempio 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()
 def getCurrentPrice(self, currencyPair):
     btceApi = api('', '', False)
     ticker = btceApi.get_param(currencyPair, 'ticker')
     return ticker['ticker']
Esempio n. 6
0
 def orders(self, pair):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.ActiveOrders(pair)
Esempio n. 7
0
 def info(self):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.getInfo()
Esempio 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)
Esempio n. 9
0
 def cancelorder(self, pair):
     api = btceapi.api(self._apikey, self._secret, True)
     return api.CancelOrder(pair)
Esempio 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