def new(self, inMkt, inType, inLimit, inAmount): try: buda = Buda.Auth(cr.k, cr.s) res = buda.new_order(inMkt, inType, "limit", inLimit, inAmount) except Exception: pass
def myOrders(self, inMkt, inStatus): try: buda = Buda.Auth(cr.k, cr.s) self.orderList = buda.order_pages(inMkt, None, None, inStatus) except Exception: pass
def getBalances(self, inCur): try: buda = Buda.Auth(cr.k, cr.s) res = buda.balance(inCur) self.setBalances(res.id, res.amount.amount, res.available_amount.amount, res.frozen_amount.amount, res.pending_withdraw_amount.amount) except Exception: pass
def _setup(self, config): # Get API_KEY and API_SECRET from credentials credentials = settings.credentials['Buda'] key = credentials['key'] secret = credentials['secret'] # Initialize a Buda Auth client self.buda_basic = Buda.Auth(key, secret) self.buda_auth = buda.BudaAuth(key, secret) self.buda_trading = buda.BudaTrading( 'btcclp', dry_run=self.dry_run, timeout=self.timeout, logger=self.log, store=self.store) self.buda_wallets = self.buda_trading.wallet_client('CLP') self.bitstamp = Bitstamp.Public() self.daily_investment = settings.investment['monthly'] / 30 self.transactions = json.loads(self.store.get('transactions') or '[]') now = datetime.datetime.now() last_transaction = self.transactions[-1] if len(self.transactions) > 0 else None last_transaction_date = datetime.datetime.strptime(last_transaction['date'], "%b %d %Y %H:%M:%S") if last_transaction else None self.amount_investment = self.calculate_amount_investment(now, last_transaction_date)
def cancel(self, orderId): try: buda = Buda.Auth(cr.k, cr.s) buda.cancel_order(orderId) except Exception: pass
def client(self) -> Buda.Auth: self.check_credentials() return Buda.Auth(**self.credentials, **self.client_params)
def setUp(self): self.client = Buda.Auth(API_KEY, API_SECRET, base_url=HOST)
def test_key_secret(self): with self.assertRaises(TypeError): Buda.Auth()
def setUp(self): self.client = Buda.Auth('BAD_KEY', 'BAD_SECRET', base_url=HOST)
def setUp(self): self.client = Buda.Auth(API_KEY, API_SECRET, TEST)
def test_key_secret(self): self.assertRaises(ValueError, lambda: Buda.Auth())
def setUp(self): self.client = Buda.Auth('BAD_KEY', 'BAD_SECRET')