Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

CEXIO use "my" fees #967

Merged
merged 2 commits into from
Jan 3, 2018
Merged

CEXIO use "my" fees #967

merged 2 commits into from
Jan 3, 2018

Conversation

defkev
Copy link
Contributor

@defkev defkev commented Dec 21, 2017

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.

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.
@nedievas
Copy link
Contributor

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})
}
Copy link
Owner

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?

Copy link
Contributor Author

@defkev defkev Dec 22, 2017

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 :)

Copy link
Contributor Author

@defkev defkev Dec 22, 2017

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@defkev
Copy link
Contributor Author

defkev commented Dec 22, 2017

@nedievas
I am already running this on one of my CEX bots for +24 hours and so far no problems.

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.

@DeviaVir DeviaVir closed this Dec 28, 2017
@DeviaVir DeviaVir reopened this Dec 28, 2017
@DeviaVir DeviaVir changed the base branch from master to unstable December 28, 2017 16:58
Copy link
Owner

@DeviaVir DeviaVir left a 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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants