Open wakamex opened 2 months ago
Using the earlier version of agent0 is tricky; you have to backdate your hyperdrivetypes
, pypechain
, and possibly web3
installs as well. That's where the FallbackNotFound
error is coming from. Your best bet for this is to look at earlier release that have the frozen dependency versions attached, like v0.21.8 and install the dependencies from that file.
Regarding the initial error, my guess is your target rate is too close to the actual rate, and the trade required to hit it is too low. Early on in the targeted rate calculation we do this:
// Estimate the long that achieves a target rate.
let (target_pool_share_reserves, target_pool_bond_reserves) =
self.reserves_given_rate_ignoring_exposure(target_rate)?;
let (mut target_user_base_delta, target_user_bond_delta) = self
.long_trade_needed_given_reserves(
target_pool_share_reserves,
target_pool_bond_reserves,
)?;
// Determine what rate was achieved.
let resulting_rate = self
.calculate_spot_rate_after_long(target_user_base_delta, Some(target_user_bond_delta))?;
That calculate_spot_rate_after_long
function eventually calls calculate_open_long
, which has this check at the beginning:
if base_amount < self.minimum_transaction_amount() {
return Err(eyre!("MinimumTransactionAmount: Input amount too low",));
}
That's the error you're seeing. It is possible that there is a bug -- for example maybe long_trade_needed_given_reserves
is producing an invalid base amount when there should be a valid base amount. But I think the more likely answer is your rates are too close together.
You could test this manually by opening a long for the minimum trade amount on this market and seeing how much it moves the fixed rate. If it's more than 0.67863%
then you know that is your problem
this script was working, so this is a recent change. I tried previous versions, but they result in a different error.
reproduced in this script on a branch: https://github.com/delvtech/agent0/blob/af73b4dcb2380dd39e3de2a864258fbef8fa43ce/fail_calc_targeted_long.py
steps are:
output:
using agent0 v0.21.7: