def bitcUpdate(): conn = btcde.Connection(key, secret) logging.getLogger().setLevel(logging.ERROR) logging.getLogger('requests.packages.urllib3').setLevel(logging.ERROR) coins = defaultdict(float) for name, data in conn.showAccountInfo()['data']['balances'].items(): amount = float(data['total_amount']) if amount != .0: coins[name] += amount del coins["btg"] combinedValue = .0 data = {} for a in coins: sleep(.5) amount = coins[a] price = float(conn.showRates(a + 'eur')['rates']['rate_weighted']) value = price * amount data[a] = {'amount': amount, 'price': price, 'value': value} combinedValue += value return { 'marketname': 'bitcoin.de', 'timestamp': time(), 'value': combinedValue, 'coinData': data }
def DeleteOrder(): global current_trading_pair conn = btcde.Connection(api_key, api_secret) order = btcde.deleteOrder(conn, order_id=OrderIDInput.get(), trading_pair=current_trading_pair) OrderIDInput.delete(0, END)
def ExbuyOrder(): global current_trading_pair conn = btcde.Connection(api_key, api_secret) order = btcde.executeTrade(conn, order_id=OrderIDInput.get(), OrderType='buy', trading_pair=current_trading_pair, amount=float(Mengeeingabe.get()))
def KaufOrder(): global current_trading_pair conn = btcde.Connection(api_key, api_secret) order = btcde.createOrder( conn, OrderType='buy', trading_pair=current_trading_pair, max_amount=float(Mengeeingabe.get()), price=float(Preiseingabe.get()), min_amount=float(Minmenge.get()), new_order_for_remaining_amount=new_order_for_remaining_amount) OrderIDInput.delete(0, END) OrderIDInput.insert(0, str(order.get('order_id')))
def setUp(self): self.XAPIKEY = 'f00b4r' self.XAPISECRET = 'b4rf00' self.conn = btcde.Connection(self.XAPIKEY, self.XAPISECRET) self.XAPINONCE = self.conn.nonce
import btcde btcde_key, btcde_secret = open('bitcoinde.key').read().split('\n')[0:2] bt = btcde.Connection(btcde_key, btcde_secret) show_orders = lambda x, y: btcde.showOrderbook( bt, x, y, order_requirements_fullfilled=1) orderbooks = { k: v for k, v in zip( btcde.valid_trading_pair, map( lambda x: { k: v for k, v in zip( btcde.valid_order_type, map(lambda y: show_orders(y, x), btcde.valid_order_type)) }, btcde.valid_trading_pair)) }
def __init__(self, api_key, api_secret): self.connection = btcde.Connection(api_key, api_secret)
def AvAmount(): global dic conn = btcde.Connection(api_key, api_secret) account = btcde.showAccountInfo(conn) dic = (account.get('data'))