Poloniex order fees
See original GitHub issuefetch_order() on the poloniex service returns 'fee': None
and doesn’t otherwise account for the fees.
Thus doing a buy/then sell gives an insufficient funds error from the exchange. Basically what I am doing is something like this:
uuid = polo.create_limit_buy_order("BCH/BTC", 0.00303204, rate)['id']
time.sleep(10)
order = polo.fetch_order(uuid)
# later on, sell it:
amount = order['filled'] # equals 0.00303204 as all was filled
polo.create_limit_sell_order("BCH/BTC", amount, rate)
When I sell, I get an insufficient funds error because I don’t have that much because Polo deducts the fees in BCH after buying it.
I would need to sell amount - fee
, but don’t have access to fee. Could you include it?
Really in addition to returning the fees, to me it would make more sense to directly include fields in the Order Structure that tell you how much you have as a result of the order. In the above example, I don’t really have 0.00303204 units of BCH, I only have 0.00302446 as a result of the buy and thats all I care about. It would be nice if CCXT did the filled - fee
calculation already otherwise I have to check fee structure and only deduct fee from filled if the fee currency is the destination one. In other words, the only thing I really care about is exactly how much more BCH is in my account and exactly how much less BTC is in my account.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:25 (15 by maintainers)
Top GitHub Comments
As for multiple API call, you may add option (in unified API for example), full/short which would tell you should you only make the most basic API call, or multiple API calls as needed.
I will be offline for next 2 weeks and then very busy the following 2 weeks, but if you haven’t make progress on this issue by then, maybe I can help. I was just a bit hesitant because I haven’t worked with JS in about 10 years so I am very rusty with it.
I just pulled up my old Polo code I wrote prior to using CCXT. Indeed I was caching the total quantity from the original buy/sell request by returning it as part of the ID (My ID was a tuple to encode quantity and orderID, etc so I didn’t have to cache it internally by the my Exchange class).
Additionally, I had found the only proper way to calculate the fee was to iterate each trade in the order, callulate the fee and round it down to 8 decimal places, and only then sum them together. Example: