Currently implemented are multiple permutations of trades routes, simplest would be to look for the primary stablecoin, BTC, or ETH quotes as they are most prevalent.
Simply put, if a coin has an allocation of 50%, and the target portfolio is 25%, we want to sell down to 25% maybe into USDT.
Now, what if we have BTC at an allocation of 15%, and target is 20%.
Assume that all other coins met their target already and now have a new 0 -> 20% of USDT allocation
We would create two orders, one to sell into USDT and one to buy BTC assuming it has USDT quote. You will find ETH/BTC always have USDT quote pairs on most exchanges. May help to keep a hardcoded reference of an exchanges favorite stablecoin
Instead of creating orders before hand, we can just check to make sure we have the pairs available and if we need to sell up or down.
We can check to see which base/quote has the lowest fees/commission to aid our decision if we have multiple
Unfortunately, Prices can change quickly, so we will want to confirm our balance several times before implementing a trade.
This will fix the issue where the balancer just gives up on a coin and gives it a relatively low allocation, and speed up the order execution.
Find best route (lowest fee trade, if we sell/buy will it aid another allocation?, is it even available)
Check balances, and iteratively execute orders until they go through (if market) we can also keep limit orders, but ideally I hope we can get limit orders to close <5 mins to complete any portfolio.
Exchanges will delist coins during rebalance process, so something to catch these trade errors, and report back. Maybe include a hedge currency to go into if the coin is unable to be purchased.
Currently implemented are multiple permutations of trades routes, simplest would be to look for the primary stablecoin, BTC, or ETH quotes as they are most prevalent. Simply put, if a coin has an allocation of 50%, and the target portfolio is 25%, we want to sell down to 25% maybe into USDT. Now, what if we have BTC at an allocation of 15%, and target is 20%. Assume that all other coins met their target already and now have a new 0 -> 20% of USDT allocation
We would create two orders, one to sell into USDT and one to buy BTC assuming it has USDT quote. You will find ETH/BTC always have USDT quote pairs on most exchanges. May help to keep a hardcoded reference of an exchanges favorite stablecoin