fdreyer / Algotrading

Trading tools for cryptocurrencies
0 stars 0 forks source link

Algotrading

Algorand trading on tinyman

Installation

To run this code requires:

These packages could be installed separately as

pip install git+https://github.com/tinymanorg/tinyman-py-sdk.git
pip install git+ssh://git@github.com/lrnz-vtl/ts_tools_algo.git
pip install py-algorand-sdk

For the complete installation, the python version is 3.10.0. The easiest is to install miniconda, create am environment and install the packages:

conda create --name Algotrading python=3.10.0
conda activate Algotrading
pip install -r requirements.txt

Conceptual framework

Suppose we have 3 coins c0, c1, c2, and we have a separate forecast for each of the tree pools i.e. what the relative price of c0 with respect to c1 will be in the future. c0 is our reference coin (which we can easily redeem for dollars).

We denote the 3 forecasts as f01, f12, f20, which e.g. represent in percentage how much the relative prices will change compared to the relative prices now. Suppose also that in this example we have f01 = f20 = 0, while f12 > 0 , which means that c1 will increase in value w.r.t. c2 in the future, while all other relative prices will remain unchanged. How do we use this information?

In that situation, in the future, there will be a "triangle imbalance" that a high frequency arbitrageur might exploit. How do we use the fact that we know this information in advance? Because we can load on c1 now, and later we can offload it via the transaction c1 -> c2 -> c0 , therefore performing only two legs of the transaction in a short time. This has the advantage that we save on transaction cost and avoids some of the latency risk. (It would be nice if we could short coin 2 in advance instead, to avoid most of the latency risk, but we can't do that).

So the components we need for the framework to work are the following: