We need to test the rebalance module, what it wants to achieve is to constantly check the balance between mixin and exchange. If the balance of an asset is too low in exchange or mixin, it should trigger rebalance (which is withdrawal from the account that has more balance to the account that has less balance).
We support multiple api keys, so the rebalance() inside rebalance.service.ts would check the balance of all exchange api keys, If the balance of some asset inside the api key is lower than the minimum rebalance amount we set in the database, it would compare the balance of the asset with mixin. And if mixin has sufficient balance, it would trigger a withdrawal from mixin to exchange address. Same applies to mixin account.
The minimum rebalance amount is set by using functions inside rebalance.repository.ts.
Now the overall logic is done, we need to test and debug the code.
We need to test the rebalance module, what it wants to achieve is to constantly check the balance between mixin and exchange. If the balance of an asset is too low in exchange or mixin, it should trigger rebalance (which is withdrawal from the account that has more balance to the account that has less balance).
We support multiple api keys, so the
rebalance()
insiderebalance.service.ts
would check the balance of all exchange api keys, If the balance of some asset inside the api key is lower than the minimum rebalance amount we set in the database, it would compare the balance of the asset with mixin. And if mixin has sufficient balance, it would trigger a withdrawal from mixin to exchange address. Same applies to mixin account.The minimum rebalance amount is set by using functions inside
rebalance.repository.ts
.Now the overall logic is done, we need to test and debug the code.
Related files: rebalance.service.ts rebalance.repository.ts