Repo for Rice 2021 Datathon QuantLab Challenge

Our strategy is divided into two parts, the first is prediction, and the second is business logic, which is implemented by trades and arbitrage. The latest strategy file can be found in the ./businessLogic/Strategy 3.0.ipynb. Although our results for the three periods are not yet complete, shown by the current data we have, our strategy is fairly accurate and gains a margin of profit. Unfortunately, due to the limited time, we did not have enough time to run all nine months of data before submission. We have processed a few days of data, and we are proud to say that every additional bitcoin we obtained are authentic profits.

1. Prediction
Our program predicts the trade value of next tick using AROMA as our time series prediction model. In the tick-and-trade loop, we first reference to previous market trade data, including usd-btc, eth-btc from the previous 24 hours; and then we feed the data into VAROMA to get the predicted mean and confidence intervals.
Based on the predicted data, our program calculates the probability of profiting from the next tick and choose the most feasible investment plan.
Arbitrage:
Based on the current tick data, our program exchanges our holding from one currency to another multiple times if the exchange ratio between multiple currencies can bring us profits. The difference in exchange rates between currencies can be an opportunity for us to leverage. We involved two other cryptocurrencies and Euro in the arbitrage. By computing the ratio between the current prices, we determine if the expected revenue would exceed the costs such as the taker fee.

PERIOD 1:

[{'date': '20201201', 'timestamp': 1606791240, 'side': 'sell', 'size': 1.0, 'price': 19697.53, 'product': 'BTC-USD', 'holdings': {'BTC': 0.0, 'USD': 19662.074446}}, {'date': '20201201', 'timestamp': 1606793160, 'side': 'buy', 'size': 32.46495351198732, 'price': 605.64, 'product': 'ETH-USD', 'holdings': {'BTC': 0.0, 'USD': 1.0000003385357559e-06, 'ETH': 32.406516595665735}}, {'date': '20201201', 'timestamp': 1606799400, 'side': 'sell', 'size': 32.406516, 'price': 603.77, 'product': 'ETH-USD', 'holdings': {'BTC': 0.0, 'USD': 19530.863218422426, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606799400, 'side': 'buy', 'size': 1.0117091595777634, 'price': 19304.82, 'product': 'BTC-USD', 'holdings': {'BTC': 1.0098880830905235, 'USD': 4.2242754716426134e-07, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606817160, 'side': 'sell', 'size': 1.009888, 'price': 19696.17, 'product': 'BTC-USD', 'holdings': {'BTC': 8.309052357269309e-08, 'USD': 19855.122063070296, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606817160, 'side': 'sell', 'size': 0.0, 'price': 620.6, 'product': 'ETH-USD', 'holdings': {'BTC': 8.309052357269309e-08, 'USD': 19855.122063070296, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606821900, 'side': 'sell', 'size': 0.0, 'price': 600.3, 'product': 'ETH-USD', 'holdings': {'BTC': 8.309052357269309e-08, 'USD': 19855.122063070296, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606821900, 'side': 'buy', 'size': 1.0434917137649662, 'price': 19027.58, 'product': 'BTC-USD', 'holdings': {'BTC': 1.041613511770713, 'USD': 7.029666448943317e-08, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606825320, 'side': 'sell', 'size': 1.041613, 'price': 19239.22, 'product': 'BTC-USD', 'holdings': {'BTC': 5.117707131407911e-07, 'USD': 20003.749982938945, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606825320, 'side': 'sell', 'size': 0.0, 'price': 602.6, 'product': 'ETH-USD', 'holdings': {'BTC': 5.117707131407911e-07, 'USD': 20003.749982938945, 'ETH': 5.956657318506586e-07}}, {'date': '20201201', 'timestamp': 1606825320, 'side': 'buy', 'size': 234.5105507854631, 'price': 85.3, 'product': 'LTC-USD', 'holdings': {'BTC': 5.117707131407911e-07, 'USD': 9.389441402163357e-07, 'ETH': 5.956657318506586e-07, 'LTC': 234.08843179404926}}, {'date': '20201201', 'timestamp': 1606825560, 'side': 'buy', 'size': 5.015727244745383e-11, 'price': 18720.0, 'product': 'BTC-USD', 'holdings': {'BTC': 5.118207801301482e-07, 'USD': 0.0, 'ETH': 5.956657318506586e-07, 'LTC': 234.08843179404926}}, {'date': '20201201', 'timestamp': 1606825560, 'side': 'sell', 'size': 5.118207801301482e-07, 'price': 15707.73, 'product': 'BTC-EUR', 'holdings': {'BTC': 0.0, 'USD': 0.0, 'ETH': 5.956657318506586e-07, 'LTC': 234.08843179404926, 'EUR': 0.00802507144595292}}, {'date': '20201201', 'timestamp': 1606825560, 'side': 'buy', 'size': 0.00011986663847577177, 'price': 66.95, 'product': 'LTC-EUR', 'holdings': {'BTC': 0.0, 'USD': 0.0, 'ETH': 5.956657318506586e-07, 'LTC': 234.0885514449278, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606825560, 'side': 'sell', 'size': 234.0885514449278, 'price': 81.1, 'product': 'LTC-USD', 'holdings': {'BTC': 0.0, 'USD': 18950.40927544371, 'ETH': 5.956657318506586e-07, 'LTC': 0.0, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606825560, 'side': 'buy', 'size': 1.0123081877907965, 'price': 18720.0, 'product': 'BTC-USD', 'holdings': {'BTC': 1.0104860330527732, 'USD': 0.0, 'ETH': 5.956657318506586e-07, 'LTC': 0.0, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606825620, 'side': 'sell', 'size': 1.010486, 'price': 18880.14, 'product': 'BTC-USD', 'holdings': {'BTC': 3.305277318510491e-08, 'USD': 19043.776537173526, 'ETH': 5.956657318506586e-07, 'LTC': 0.0, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606825620, 'side': 'sell', 'size': 0.0, 'price': 571.99, 'product': 'ETH-USD', 'holdings': {'BTC': 3.305277318510491e-08, 'USD': 19043.776537173526, 'ETH': 5.956657318506586e-07, 'LTC': 0.0, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606825620, 'side': 'buy', 'size': 233.29384462820045, 'price': 81.63, 'product': 'LTC-USD', 'holdings': {'BTC': 3.305277318510491e-08, 'USD': 1.7352431314066052e-07, 'ETH': 5.956657318506586e-07, 'LTC': 232.87391570786968, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606829820, 'side': 'sell', 'size': 232.873915, 'price': 84.22, 'product': 'LTC-USD', 'holdings': {'BTC': 3.305277318510491e-08, 'USD': 19577.338367455188, 'ETH': 5.956657318506586e-07, 'LTC': 7.078696739881707e-07, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606829820, 'side': 'sell', 'size': 0.0, 'price': 586.0, 'product': 'ETH-USD', 'holdings': {'BTC': 3.305277318510491e-08, 'USD': 19577.338367455188, 'ETH': 5.956657318506586e-07, 'LTC': 7.078696739881707e-07, 'EUR': 0.0}}, {'date': '20201201', 'timestamp': 1606829820, 'side': 'buy', 'size': 1.046222738237746, 'price': 18712.4, 'product': 'BTC-USD', 'holdings': {'BTC': 1.0443395703616911, 'USD': 4.551875463221222e-07, 'ETH': 5.956657318506586e-07, 'LTC': 7.078696739881707e-07, 'EUR': 0.0}}]

SHARPE RATIO :
RISK FREE DAILY RETURN :
0.00016438356164383562 ACTUAL DAILY RETURN :
0.0014303093137245325
EXCESS STD :
0.0079636258660115
0.15896348891572462

Final Output: Bitcoin number : 1.0443395922157417

PERIOD 2:
OUTPUT TRADES FILE : Pending SHARPE RATIO : Pending

PERIOD 3: OUTPUT TRADES FILE : [{"date": "20201201", "timestamp": 1606791240, "side": "sell", "size": 1.0, "price": 19697.53, "product": "BTC-USD", "holdings": {"BTC": 0.0, "USD": 19662.074446}}, {"date": "20201201", "timestamp": 1606793160, "side": "buy", "size": 32.428543417667235, "price": 605.64, "product": "ETH-USD", "holdings": {"BTC": 0.0, "USD": 1.0000003385357559e-06, "ETH": 32.406516595665735}}]
SHARPE RATIO :
RISK FREE DAILY RETURN : 0.00016438356164383562 ACTUAL DAILY RETURN : -0.024611100877701204 EXCESS STD : 0.04860114856278776 -0.5097715830179944

{'BTC': 0.0, 'USD': 1.0000003385357559e-06, 'ETH': 32.406516595665735}