delvtech / agent0

Analysis & simulation repo for Delv
https://agent0.readthedocs.io/en/latest/
Apache License 2.0
49 stars 21 forks source link

LP trading bot #921

Closed dpaiton closed 11 months ago

dpaiton commented 11 months ago

The LP bot will take some percent of deposits & LP with it; trade with the rest of it.

The LP bot is to:

Configurable params:

Alternative strategies to strictly arbing rates:

Metrics:

Experiments:

TODOs:

dpaiton commented 11 months ago

Blocked by #919

dpaiton commented 11 months ago

LP BOT STRATEGY

for non-LP amount (= total_budget - lp_budget) we follow the "arb bot strategy"

NOTES

Some alternative bots:

fixed_rate = 5% variable_rate = 2%

open_long == I'm going to earn 5% for 6mo

... time passes ...

situation 1:

current fixed_rate = 3% -- doesn't matter bc I am locked in at 5% current_variable_rate = 10%

close my long, because I could be earning more in the underlying vault

if (fixed_rate_at_open (aka opening_spot_price) < current_variable_rate): close_long

situation 2: current_fixed_rate = 10% -- now I'm losing money current_variable_rate < 10%

I should close my long & re-open a new long if (current_fixed_rate > fixed_rate_at_open) AND (current_fixed_rate > varaible_rate): close_long() & open_new_long()

dpaiton commented 11 months ago

goal for this issue:

goal for next issue:

dpaiton commented 11 months ago

example steps calculate trade size such that fixed_rate will match variable_rate: https://github.com/delvtech/elf-simulations/blob/main/lib/elfpy/elfpy/agents/policies/smart_long.py#L91

dpaiton commented 11 months ago

The elfpy smart long bot will be converted to agent0 in this PR: https://github.com/delvtech/elf-simulations/pull/994

dpaiton commented 11 months ago

resolved by #1000