X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=ccxt_wrapper.py;h=aaccc612ba036ff92123d377aed2ff208c02725d;hb=512972fa1df14df4e208a1182096b1c51b5d38d1;hp=f30c7d20fd6434e2ae36a22e11676ba27da5235b;hpb=52ea19aa73348a523b3b884e2a7fb749b2bf4f19;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/ccxt_wrapper.py b/ccxt_wrapper.py index f30c7d2..aaccc61 100644 --- a/ccxt_wrapper.py +++ b/ccxt_wrapper.py @@ -66,6 +66,13 @@ class poloniexE(poloniex): def nanoseconds(): return int(time.time() * 1000000000) + def is_dust_trade(self, amount, rate): + if abs(amount) < decimal.Decimal("0.000001"): + return True + if abs(amount * rate) < decimal.Decimal("0.0001"): + return True + return False + def fetch_margin_balance(self): """ portfolio.market.privatePostGetMarginPosition({"currencyPair": "BTC_DASH"}) @@ -292,6 +299,10 @@ class poloniexE(poloniex): "total": decimal.Decimal(summary["totalValue"]), } + def fetch_nth_order_book(self, symbol, action, number): + book = self.fetch_order_book(symbol, limit=number) + return decimal.Decimal(book[action + "s"][-1][0]) + def nonce(self): """ Wrapped to allow nonce with other libraries