-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
Get (and use) personalized fees on CEXIO as returned by the API at https://cex.io/api/get_myfee for live and paper trading. The fees get recalculated (by CEX) and refreshed (by us) every day at midnight (GMT) The timer uses UTC so this works regardless of the bots local timezone.
Good! I was planning to add dynamic fees to Bitfinex and Cexio exchanges. This looks like even better approach. Let's test in the wild? |
lib/engine.js
Outdated
@@ -30,6 +30,9 @@ module.exports = function container (get, set, clear) { | |||
console.error('error: could not find product "' + s.product_id + '"') | |||
process.exit(1) | |||
} | |||
if ((so.mode === 'live' || so.mode === 'paper') && selector_parts[0] === 'cexio') { | |||
s.exchange.setFees({asset: s.asset, currency: s.currency}) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to prevent this from ending up as an exchange-specific hack in lib/engine.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was initially considering adding the setFees: function() to every exchange (as a pseudo call doing nothing for now except for CEX) but didn't want to change to many files.
But if this gets adopted for other exchanges i don't see a reason to not do it in a cleaner/less hackish/none exchange-specific way.
Your call :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second thought i could add a new exchange property (called dynamicFees or whatever) and check for it in engine.js
Let me update the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@nedievas As long as the exchange and API-module supports it (like yours does) this should be fairly easy to adopt for other exchanges (change the pair format, JSON fields and adjust the time the update should occur) The only odd thing i noticed about CEX is that the API returns four fees in total (taker buy/sell and maker buy/sell) will the front page only lists maker/taker fees. The buy/sell fees are the same (at least for me) so this uses the median of each. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 awesome work, and thanks for refactoring it!
Get (and use) personalized fees on CEXIO as returned by the API at https://cex.io/api/get_myfee for live and paper trading.
The fees get recalculated (by CEX) and refreshed (by us) every day at midnight (GMT)
The timer uses UTC so this works regardless of the bots local timezone.