zelos-alpha / demeter

Better backtest toolkit for Uniswap v3 and Aave.

Home Page:https://medium.com/zelos-research

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Results and logs documentation

liordavid opened this issue · comments

Hi,
I am trying to run this lib and its strategy samples.
is there more doc on the logs that are printed after backtester is done, I would like to understand the performance of a stategy and it's not very clear or explained in code/readme/manual.

Alternatively is the a project/UI tool/open source that uses the lib and you can point me to it?

For example, i get these log prints when running:

(demeter) strategy-example (master) ✗ python3 12_constant_Interval.py

2023-10-18 17:58:15,790 - INFO - data has been prepared
2023-10-18 17:58:15,791 - INFO - init strategy...
2023-10-18 17:58:15,793 - INFO - start main loop...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 15840/15840 [00:06<00:00, 2588.13it/s]
2023-10-18 17:58:21,940 - INFO - main loop finished
2023-10-18 17:58:22,042 - INFO - Broker
Asset amounts
usdc :0 eth :0.0707372737666261654660170258
Markets
uni_market(UniLpMarket)
token0 :usdc token1 :eth fee :0.0500 is 0 base :True
positions
lower_tick upper_tick pending0 pending1 liquidity
0 201318 203819 11.25578570434480907228378585 0.006292688370498359591955467510 387963507047826

2023-10-18 17:58:22,042 - INFO - Account Status
2023-10-18 17:58:22,042 - INFO - net_value usdc eth uni_market_net_value uni_market_base_uncollected uni_market_quote_uncollected uni_market_base_in_position uni_market_quote_in_position uni_market_position_count
2022-08-05 00:00:00 1999.502335313296790636961503 0 0.0707372737666261654660170258 1885.735520583365642398358784 0.002317256849493052428779442252 1.122703402876110291885239120E-8 999.4999999999993698541062311 0.551036957449638596322551911 1
2022-08-05 00:01:00 1999.503159161726183291339706 0 0.0707372737666261654660170258 1885.736344431795035052736987 0.002376082206750144045744816348 4.868986665685556989979950670E-7 999.4999999999993698541062311 0.551036957449638596322551911 1
2022-08-05 00:02:00 1999.505414272171702021080411 0 0.0707372737666261654660170258 1885.738599542240553782477692 0.002376082206750144045744816348 0.000001889068230138732202928621405 999.4999999999993698541062311 0.551036957449638596322551911 1
2022-08-05 00:03:00 2000.010042428917993894827471 0 0.0707372737666261654660170258 1886.186332913802682057146282 0.007769810024119111652365549753 0.000001954612027542642486319156519 1003.389977568857216796791728 0.5486188742034648538134621155 1
2022-08-05 00:04:00 2000.011791998832975502438095 0 0.0707372737666261654660170258 1886.188082483717663664756906 0.008514742480334209166075439656 0.000002578957475953257275966616112 1003.389977568857216796791728 0.5486188742034648538134621155 1
... ... ... ... ... ... ... ... ... ...
2022-08-15 23:55:00 2097.331940403029013849406112 0 0.0707372737666261654660170258 1962.511694511516152630184097 11.25578570434480907228378585 0.006292688370498359591955467510 1939.262489379837990181000271 0 1
2022-08-15 23:56:00 2097.331940403029013849406112 0 0.0707372737666261654660170258 1962.511694511516152630184097 11.25578570434480907228378585 0.006292688370498359591955467510 1939.262489379837990181000271 0 1
2022-08-15 23:57:00 2097.185207452937580868677203 0 0.0707372737666261654660170258 1962.499707685831809325579027 11.25578570434480907228378585 0.006292688370498359591955467510 1939.262489379837990181000271 0 1
2022-08-15 23:58:00 2096.950739708552203283392838 0 0.0707372737666261654660170258 1962.480553678645302295496506 11.25578570434480907228378585 0.006292688370498359591955467510 1939.262489379837990181000271 0 1
2022-08-15 23:59:00 2096.950739708552203283392838 0 0.0707372737666261654660170258 1962.480553678645302295496506 11.25578570434480907228378585 0.006292688370498359591955467510 1939.262489379837990181000271 0 1

[15840 rows x 9 columns]
2023-10-18 17:58:22,049 - INFO - Backtesting finished, execute time 6.25815224647522s

Thanks.

Well, sorry for the lack of document, some design has updated but the document is not updated coordinatily. But we are planning to improve it. In version 0.3.0 release, documents and comments will be refined.

for the example you provided. It has the following sections.

  • Broker: asset balance of broker. that's the "cash" you own
  • Markets: We consider an pool as a market, you can set several market like usdc/eth pool, dai/usdc pool
  • uni_market is one of those pool, from the sample strategy code, you will find it's a usdc/eth pool,
  • positions shows the position you hold in the end.
  • Account Status: Changes in funding during the backtesting period, includes:
    • net_value: total net value
    • usdc: token amount you are holding
    • eth: token amount you are holding
    • uni_market_net_value: net value in this pool
    • uni_market_base_uncollected, uni_market_quote_uncollected: uncollected fee in position
    • uni_market_base_in_position uni_market_quote_in_position: base and quote token amount in this pool (calculated through liquidity)

hope those will help.