fdreyer / Algotrading

Trading tools for cryptocurrencies
0 stars 0 forks source link

Fix computations #3

Open lrnz-vtl opened 2 years ago

lrnz-vtl commented 2 years ago

https://github.com/fdreyer/Algotrading/blob/7c8a542720b99a84aa6809448e5219b2e622ac0a/algo/universe/assets.py#L99

fdreyer commented 2 years ago

I think perhaps it's easier to keep the price without using the decimals and convert at the very end (i.e calculate everything in the basis they use for quantities, since this is also the basis you use when you perform swaps). As for the price I think it's perhaps inverted? often the pool it is asset2=Algo, anyway one needs to check manually which is which, because client.fetch_pool(0, asset_id) == client.fetch_pool(asset_id, 0), but of course in most use cases we want them to be the inverse of one another when we compute the price etc

fdreyer commented 2 years ago

we can just do the same as here https://github.com/fdreyer/Algotrading/blob/7c8a542720b99a84aa6809448e5219b2e622ac0a/algo/stream/aggregators.py#L63