diff --git a/.gitignore b/.gitignore index 0270e7d..776c1a8 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ venv.bak/ .Trashes ehthumbs.db Thumbs.db + + +scripts/datasets \ No newline at end of file diff --git a/components/black_scholes_options_pricing.py b/components/black_scholes_options_pricing.py index a3c1fe1..e5d4ab8 100644 --- a/components/black_scholes_options_pricing.py +++ b/components/black_scholes_options_pricing.py @@ -6,12 +6,12 @@ class BlackScholesOptionPricing(object): def __init__( - self, - current_asset_price=None, - strike_price=None, - option_expiration=1, - risk_free_rate=0.1, - sigma=0.3, + self, + current_asset_price=None, + strike_price=None, + option_expiration=1, + risk_free_rate=0.1, + sigma=0.3, ): self.current_asset_price = current_asset_price self.strike_price = strike_price @@ -21,14 +21,23 @@ def __init__( def get_put_option_price(self): d1 = ( - np.log(self.current_asset_price / self.strike_price) - + (self.risk_free_rate + self.sigma**2 / 2) * self.option_expiration - ) / (self.sigma * np.sqrt(self.option_expiration)) + np.log(self.current_asset_price / self.strike_price) + + (self.risk_free_rate + self.sigma ** 2 / 2) * self.option_expiration + ) / (self.sigma * np.sqrt(self.option_expiration)) d2 = d1 - self.sigma * np.sqrt(self.option_expiration) return self.strike_price * np.exp( -self.risk_free_rate * self.option_expiration ) * CDF(-d2) - self.current_asset_price * CDF(-d1) + def get_call_option_price(self): + d1 = ( + np.log(self.current_asset_price / self.strike_price) + + (self.risk_free_rate + self.sigma ** 2 / 2) * self.option_expiration + ) / (self.sigma * np.sqrt(self.option_expiration)) + d2 = d1 - self.sigma * np.sqrt(self.option_expiration) + + return (self.current_asset_price * CDF(d1)) - (self.strike_price * np.exp((-self.risk_free_rate) * self.option_expiration) * CDF(d2)) + if __name__ == "__main__": current_asset_price = 2938.53 diff --git a/requirements.txt b/requirements.txt index 0b91bc7..f5771a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ +aiofiles==0.8.0 aiohttp==3.8.1 aiosignal==1.2.0 +asgiref==3.5.2 async-timeout==4.0.2 atomicwrites==1.4.1 attrs==22.1.0 @@ -12,6 +14,8 @@ click==8.1.3 cytoolz==0.11.2 dateparser==1.0.0 distlib==0.3.6 +Django==4.1.2 +djangorestframework==3.14.0 dydx-v3-python==1.7.0 ecdsa==0.16.0 eth-abi==2.2.0 @@ -36,7 +40,9 @@ multiaddr==0.0.9 multidict==6.0.2 mypy-extensions==0.4.3 netaddr==0.8.0 +numpy==1.24.1 packaging==21.3 +pandas==1.5.2 parsimonious==0.8.1 pathspec==0.10.1 platformdirs==2.5.2 @@ -56,7 +62,11 @@ requests==2.28.1 requests-mock==1.6.0 rlp==2.0.1 six==1.16.0 +sortedcontainers==2.4.0 +sqlparse==0.4.3 sympy==1.6 +tardis-client==1.3.3 +tardis-dev==2.0.0a13 toml==0.10.2 tomli==2.0.1 toolz==0.12.0 diff --git a/scripts/BTC_Derbit_asks.csv b/scripts/BTC_Derbit_asks.csv new file mode 100644 index 0000000..4e81476 --- /dev/null +++ b/scripts/BTC_Derbit_asks.csv @@ -0,0 +1,339 @@ +0,0.1195,2.0 +1,0.1205,4.0 +2,0.1215,4.0 +0,0.061,2.0 +1,0.0615,2.0 +2,0.062,2.0 +3,0.0625,2.0 +4,0.063,2.0 +0,0.0015,40.9 +1,0.002,265.4 +0,0.0005,482.8 +0,0.0005,451.8 +0,0.0005,422.1 +0,0.107,1300.0 +0,0.0485,300.0 +1,0.049,200.0 +2,0.0495,300.0 +3,0.0505,100.0 +0,0.034,280.2 +1,0.0345,280.2 +2,0.035,194.4 +3,0.036,97.2 +0,0.02,283.2 +1,0.0205,94.4 +2,0.021,377.6 +3,0.022,94.4 +4,0.054,6.0 +5,0.0545,6.1 +6,0.055,12.1 +0,0.0085,0.1 +1,0.009,2.2 +2,0.0095,47.4 +3,0.01,38.2 +0,0.003,9.6 +1,0.0035,188.2 +2,0.057,1.0 +0,0.0015,220.4 +0,0.001,699.4 +0,0.0005,57.9 +0,0.0005,435.5 +0,0.0005,697.7 +0,0.407,84.9 +1,0.4075,178.1 +2,0.408,38.2 +0,0.1705,21.1 +1,0.171,68.7 +2,0.1715,202.1 +3,0.1725,6.0 +4,0.173,34.3 +0,0.113,105.5 +1,0.1135,56.3 +2,0.114,88.8 +3,0.1145,59.8 +4,0.115,6.0 +5,0.1155,33.5 +0,0.0555,47.8 +1,0.056,46.2 +2,0.0575,58.0 +3,0.058,117.9 +4,0.0585,28.0 +0,0.03,83.7 +1,0.0305,41.1 +2,0.031,19.8 +3,0.0315,47.8 +0,0.014,48.9 +1,0.0145,61.9 +2,0.0165,0.1 +3,0.017,0.1 +0,0.006,6.6 +1,0.0065,119.3 +0,0.003,257.5 +1,0.0035,436.6 +2,0.0045,6.1 +0,0.0015,15.6 +1,0.002,554.7 +0,0.0015,864.0 +0,0.001,700.3 +1,0.1,0.2 +2,0.24,1.4 +0,0.0005,252.8 +1,0.09,0.1 +2,0.28,5.7 +3,0.29,10.0 +0,0.0005,824.1 +1,0.0905,0.9 +0,0.0005,759.1 +0,0.0005,750.0 +0,0.0005,746.1 +1,0.05,1.6 +0,0.0005,852.6 +0,0.0005,696.7 +0,0.0005,630.4 +0,0.0005,629.1 +0,0.0005,626.5 +0,0.0005,883.9 +0,0.0005,622.6 +0,0.0005,674.6 +0,0.0005,622.6 +0,0.0005,622.6 +0,0.0005,622.6 +0,0.1,2.0 +0,0.1265,4.0 +1,0.127,2.0 +2,0.1275,6.0 +3,0.129,2.0 +4,0.1295,4.0 +0,0.063,15.0 +1,0.0635,110.8 +2,0.064,16.6 +0,0.026,70.3 +1,0.0265,26.1 +2,0.027,59.7 +0,0.0085,95.8 +1,0.009,79.7 +0,0.0035,212.9 +1,0.004,68.6 +2,0.0045,84.3 +0,0.002,243.3 +0,0.0715,64.8 +1,0.072,50.9 +0,0.035,8.0 +1,0.0355,34.3 +0,0.0155,195.1 +1,0.016,217.2 +0,0.004,164.4 +1,0.0045,532.2 +2,0.005,90.1 +0,0.42,4.0 +1,0.4205,10.0 +2,0.421,6.0 +3,0.4215,4.0 +0,0.3045,6.0 +1,0.305,6.0 +2,0.306,6.0 +3,0.3065,2.0 +4,0.307,4.0 +0,0.248,2.0 +1,0.2485,6.0 +2,0.249,6.0 +3,0.2495,4.0 +4,0.25,6.0 +5,0.2505,2.0 +0,0.1845,10.0 +1,0.185,42.0 +2,0.1855,61.0 +3,0.186,1.0 +4,0.285,1.0 +0,0.131,33.8 +1,0.1315,84.7 +2,0.132,72.4 +3,0.133,28.1 +0,0.087,58.4 +1,0.0875,107.9 +2,0.088,16.4 +0,0.053,132.2 +1,0.0535,66.6 +2,0.054,106.2 +0,0.03,30.5 +1,0.0305,248.1 +2,0.031,96.5 +0,0.017,0.3 +1,0.0175,196.8 +2,0.018,85.0 +0,0.01,67.5 +1,0.0105,65.9 +2,0.011,148.1 +0,0.0065,197.1 +0,0.005,117.9 +1,0.0055,389.8 +0,0.004,395.8 +1,0.0045,439.8 +0,0.003,195.9 +0,0.0025,64.2 +0,0.002,1.3 +1,0.2215,1.0 +0,0.0015,75.0 +1,0.002,724.9 +0,0.0015,1024.8 +0,0.001,888.1 +0,0.0005,60.2 +1,0.001,784.4 +0,0.4265,4.0 +1,0.427,4.0 +2,0.4275,4.0 +3,0.428,4.0 +4,0.4285,8.0 +0,0.3155,4.0 +1,0.316,4.0 +2,0.3165,6.0 +3,0.317,4.0 +4,0.3175,6.0 +0,0.263,8.0 +1,0.2635,4.0 +2,0.264,4.0 +3,0.2645,4.0 +4,0.265,4.0 +0,0.2115,30.0 +1,0.212,27.0 +2,0.2125,28.0 +3,0.213,12.0 +0,0.1555,99.4 +1,0.156,18.4 +2,0.1565,23.4 +3,0.158,30.6 +4,0.1585,25.6 +5,0.1605,37.0 +0,0.1155,38.8 +1,0.116,67.6 +2,0.1165,51.2 +0,0.083,72.9 +1,0.0835,135.3 +2,0.084,36.3 +0,0.058,24.6 +1,0.0585,89.5 +2,0.059,143.6 +0,0.04,18.9 +1,0.0405,179.6 +2,0.041,33.4 +0,0.028,80.8 +1,0.0285,53.8 +0,0.02,38.0 +1,0.0205,91.7 +0,0.015,130.3 +0,0.0095,154.2 +1,0.01,157.5 +0,0.004,11.7 +1,0.0045,5.2 +0,0.003,643.2 +1,0.0035,767.9 +0,0.426,20.6 +1,0.4265,49.5 +2,0.427,98.3 +3,0.4275,9.0 +4,0.428,51.5 +5,0.4285,9.0 +6,0.429,28.7 +7,0.928,2.1 +0,0.2245,20.9 +1,0.225,42.4 +2,0.2255,46.2 +3,0.226,97.2 +4,0.2265,44.2 +5,0.227,31.0 +6,0.2295,17.0 +0,0.1825,10.0 +1,0.183,18.2 +2,0.1835,82.6 +3,0.184,45.8 +4,0.1845,69.6 +5,0.185,41.6 +0,0.146,102.3 +1,0.1465,15.4 +2,0.147,72.7 +3,0.1585,0.1 +0,0.089,41.1 +1,0.0895,141.0 +2,0.09,97.7 +0,0.0535,99.4 +1,0.054,43.0 +0,0.033,11.6 +1,0.0335,143.6 +2,0.034,12.4 +0,0.022,5.7 +1,0.0225,98.2 +0,0.019,96.7 +0,0.0165,141.2 +0,0.0125,11.0 +1,0.013,353.8 +0,0.0105,54.8 +1,0.011,505.8 +0,0.0075,1204.4 +0,0.005,212.8 +1,0.0055,178.2 +0,0.004,338.7 +1,0.0045,401.2 +0,0.003,146.3 +0,0.0025,232.8 +0,0.002,229.8 +0,0.001,704.4 +1,0.0015,67.2 +2,0.15,20.7 +0,0.0005,180.0 +1,0.001,43.4 +0,0.0005,180.0 +1,0.001,45.2 +0,0.4475,82.1 +1,0.448,28.2 +2,0.4485,14.2 +3,0.449,15.8 +4,0.4495,10.0 +5,0.45,19.3 +0,0.2715,26.5 +1,0.272,122.6 +2,0.2725,40.0 +3,0.273,20.7 +4,0.2735,22.8 +0,0.2355,18.5 +1,0.236,124.5 +2,0.2365,19.2 +3,0.237,20.5 +4,0.2375,21.8 +5,0.238,28.9 +0,0.202,5.0 +1,0.2035,55.0 +2,0.204,83.5 +3,0.2045,19.8 +4,0.205,19.0 +5,0.222,0.1 +0,0.1495,18.9 +1,0.15,16.8 +2,0.1505,122.3 +0,0.11,8.0 +1,0.1105,49.6 +2,0.111,97.6 +3,0.51,10.0 +0,0.082,29.7 +1,0.0825,40.0 +0,0.0625,29.9 +1,0.063,70.2 +2,0.0635,53.0 +0,0.055,29.0 +1,0.0555,25.8 +2,0.056,96.1 +0,0.049,27.8 +1,0.0495,105.8 +0,0.0395,31.4 +1,0.04,79.8 +0,0.033,79.0 +1,0.0335,19.0 +0,0.0225,43.2 +1,0.023,87.8 +0,0.017,8.0 +1,0.0175,116.1 +2,0.018,81.9 +0,0.0115,90.5 +0,0.0085,137.3 +1,0.009,260.2 +0,0.004,406.4 +1,0.0045,151.0 diff --git a/scripts/BTC_Derbit_bids.csv b/scripts/BTC_Derbit_bids.csv new file mode 100644 index 0000000..9965880 --- /dev/null +++ b/scripts/BTC_Derbit_bids.csv @@ -0,0 +1,279 @@ +0,0.1065,10.7 +0,0.047,10.7 +0,0.001,47.9 +1,0.0005,394.0 +0,0.166,1.3 +0,0.1065,2400.0 +0,0.0765,1.3 +0,0.0465,1.3 +0,0.032,35.5 +0,0.017,115.8 +0,0.008,130.8 +1,0.0075,79.3 +0,0.0025,32.7 +1,0.002,218.1 +0,0.0005,296.0 +0,0.0005,40.8 +0,0.4035,218.1 +0,0.165,312.2 +0,0.1055,312.7 +1,0.053,4.0 +0,0.0525,13.3 +1,0.052,33.9 +2,0.0505,13.6 +3,0.05,15.6 +4,0.0495,46.7 +5,0.049,39.0 +6,0.047,0.1 +7,0.0005,1.1 +0,0.0295,31.1 +1,0.029,76.2 +2,0.0285,41.4 +3,0.028,66.4 +0,0.0135,24.2 +1,0.013,96.8 +2,0.0125,72.5 +3,0.012,89.2 +0,0.0055,60.5 +1,0.005,30.0 +2,0.0045,73.2 +0,0.0025,47.9 +1,0.002,345.5 +2,0.0005,3.3 +0,0.001,75.2 +1,0.0005,960.0 +0,0.0005,368.4 +0,0.0005,877.8 +0,0.1045,24.0 +0,0.0615,9.1 +1,0.061,29.4 +2,0.0605,21.2 +3,0.06,42.3 +4,0.0595,16.7 +0,0.0255,20.2 +1,0.025,23.2 +2,0.0245,6.5 +3,0.024,119.2 +0,0.008,31.1 +1,0.0075,552.2 +2,0.007,124.8 +0,0.0025,644.7 +1,0.002,256.8 +2,0.0005,5.0 +0,0.001,346.0 +1,0.0005,259.8 +0,0.0695,9.1 +1,0.069,31.4 +2,0.0685,47.8 +3,0.068,34.4 +0,0.0345,81.8 +1,0.034,147.2 +2,0.0335,83.2 +0,0.015,54.0 +1,0.0145,100.1 +2,0.014,105.4 +3,0.0135,113.0 +0,0.0035,85.8 +1,0.003,205.5 +2,0.0025,104.7 +0,0.401,24.0 +0,0.281,25.0 +0,0.221,26.0 +0,0.166,6.0 +1,0.1655,4.0 +2,0.165,4.0 +3,0.1645,8.0 +4,0.164,4.0 +5,0.1285,1.0 +0,0.116,19.0 +1,0.1155,15.0 +2,0.115,8.0 +3,0.1145,14.0 +4,0.114,7.0 +5,0.1135,16.0 +6,0.1095,8.1 +7,0.107,0.1 +0,0.086,25.2 +1,0.0855,65.3 +2,0.085,27.3 +3,0.0845,21.1 +0,0.0525,0.8 +1,0.052,67.8 +2,0.0515,121.2 +3,0.051,206.1 +4,0.0505,0.1 +5,0.048,1.0 +6,0.0415,1.0 +7,0.017,1.0 +0,0.0295,30.2 +1,0.029,100.0 +2,0.0285,13.2 +0,0.0165,7.7 +1,0.016,287.5 +2,0.0155,105.7 +0,0.0095,10.9 +1,0.009,556.3 +2,0.0085,240.6 +0,0.0055,851.5 +0,0.0045,295.9 +1,0.004,264.5 +0,0.0025,862.4 +0,0.002,663.7 +0,0.0015,774.4 +0,0.001,908.1 +0,0.0005,903.5 +0,0.0005,1422.9 +0,0.0005,100.0 +0,0.401,24.0 +0,0.2875,6.0 +1,0.287,2.0 +2,0.2865,8.0 +3,0.286,2.0 +4,0.2855,4.0 +5,0.285,2.0 +6,0.281,1.0 +0,0.2345,6.0 +1,0.234,4.0 +2,0.2335,6.0 +3,0.233,4.0 +4,0.2325,4.0 +5,0.221,1.0 +0,0.1885,9.0 +1,0.188,18.0 +2,0.187,8.0 +3,0.1865,20.0 +4,0.1855,20.0 +5,0.184,31.0 +6,0.1835,9.0 +0,0.152,25.2 +1,0.1515,80.0 +2,0.151,60.8 +3,0.1505,81.8 +0,0.1145,35.0 +1,0.114,120.3 +2,0.1135,124.0 +0,0.082,145.3 +1,0.0815,101.7 +2,0.081,171.1 +0,0.057,98.3 +1,0.0565,115.9 +0,0.0395,1.2 +1,0.039,57.2 +2,0.0385,137.1 +0,0.0275,9.0 +1,0.027,27.6 +2,0.0265,222.2 +3,0.026,76.9 +0,0.019,334.7 +1,0.0185,380.8 +0,0.014,185.0 +1,0.0135,460.7 +0,0.0085,524.3 +1,0.008,329.0 +0,0.0035,481.3 +1,0.003,160.2 +0,0.0025,213.5 +1,0.002,341.6 +0,0.4205,44.1 +1,0.42,15.6 +2,0.4195,93.9 +3,0.419,27.5 +4,0.0005,1.0 +0,0.221,20.2 +1,0.2205,32.7 +2,0.22,132.5 +3,0.2195,56.3 +0,0.18,18.2 +1,0.179,83.9 +2,0.1785,95.5 +3,0.178,46.1 +4,0.1775,22.8 +5,0.0005,1.0 +0,0.1445,15.7 +1,0.144,23.4 +2,0.1435,102.9 +3,0.143,98.0 +4,0.131,0.1 +5,0.0005,1.0 +0,0.0885,2.3 +1,0.088,20.4 +2,0.0875,32.6 +0,0.052,93.1 +1,0.0515,33.0 +2,0.01,2.0 +0,0.0325,2.1 +1,0.032,164.7 +0,0.0215,123.9 +1,0.021,310.9 +2,0.0205,33.5 +0,0.018,290.0 +1,0.0175,72.7 +2,0.0125,10.0 +3,0.0025,10.0 +0,0.015,310.5 +0,0.0115,190.8 +0,0.0095,84.8 +0,0.0065,1271.2 +1,0.006,2033.4 +0,0.0045,59.2 +1,0.004,108.0 +0,0.0025,351.5 +0,0.002,107.2 +1,0.0015,435.1 +0,0.002,3.9 +1,0.0015,46.2 +2,0.001,213.7 +0,0.001,86.6 +0,0.441,14.0 +1,0.4405,14.0 +2,0.44,34.9 +3,0.4395,69.1 +4,0.439,65.6 +5,0.4385,17.7 +0,0.2655,22.2 +1,0.265,64.3 +2,0.2645,69.5 +3,0.264,68.3 +4,0.2635,53.1 +5,0.263,28.7 +0,0.2305,19.5 +1,0.23,20.9 +2,0.2295,43.9 +3,0.229,111.8 +4,0.2285,41.9 +5,0.2275,26.4 +6,0.227,18.0 +0,0.1995,24.6 +1,0.199,125.5 +2,0.182,0.1 +0,0.147,30.0 +1,0.1465,110.0 +2,0.146,131.7 +3,0.1,24.2 +0,0.1075,0.1 +1,0.107,127.4 +2,0.1065,33.7 +0,0.079,230.1 +1,0.0785,26.7 +0,0.0605,8.0 +1,0.06,212.1 +2,0.0595,96.2 +0,0.053,54.0 +1,0.0525,256.5 +2,0.0005,0.3 +0,0.047,52.0 +1,0.0465,266.4 +0,0.038,48.0 +1,0.0375,272.4 +0,0.031,154.5 +1,0.0305,109.5 +0,0.0215,76.2 +1,0.0205,396.4 +0,0.016,57.0 +1,0.0155,162.5 +0,0.0095,246.7 +0,0.0065,179.2 +1,0.0005,2.1 +0,0.0025,9.4 +1,0.002,321.3 +2,0.001,2.0 diff --git a/scripts/ETH_Derbit_asks.csv b/scripts/ETH_Derbit_asks.csv new file mode 100644 index 0000000..49e0aac --- /dev/null +++ b/scripts/ETH_Derbit_asks.csv @@ -0,0 +1,27 @@ +0,0.0005,100.0 +0,0.005,10.0 +0,0.05,1.0 +0,0.005,10.0 +0,0.05,1.0 +0,0.05,1.0 +0,0.05,1.0 +0,0.4835,5.0 +0,0.5,23.0 +0,0.0235,10.0 +0,0.0095,10.0 +0,0.1,1.0 +0,0.0005,9.0 +0,0.337,1.0 +0,0.37,4.0 +0,0.79,1.0 +0,0.7735,1.0 +0,0.744,1.0 +0,0.648,1.0 +0,0.2455,5.0 +0,0.8255,1.0 +0,0.601,1.0 +0,0.591,1.0 +0,0.577,1.0 +0,0.519,1.0 +0,0.3655,1.0 +0,0.141,8.0 diff --git a/scripts/ETH_Derbit_bids.csv b/scripts/ETH_Derbit_bids.csv new file mode 100644 index 0000000..dbf563f --- /dev/null +++ b/scripts/ETH_Derbit_bids.csv @@ -0,0 +1,13 @@ +0,0.0005,1.0 +0,0.0005,10.0 +0,0.004,1.0 +0,0.0005,1.0 +0,0.0005,1.0 +0,0.0005,91.0 +0,0.0005,1.0 +0,0.039,2.0 +0,0.0505,1.0 +1,0.05,5.0 +0,0.001,1.0 +0,0.0005,2.0 +0,0.0005,1.0 diff --git a/scripts/Uniswap ETH-USDC Pool Swaps.csv b/scripts/Uniswap ETH-USDC Pool Swaps.csv new file mode 100644 index 0000000..99a5bff --- /dev/null +++ b/scripts/Uniswap ETH-USDC Pool Swaps.csv @@ -0,0 +1,101 @@ +,id,amountIn,amountInUSD,amountOut,amountOutUSD,timestamp,tokenIn,tokenOut +0,0x00001ac287e0a1b0a82d8b8445ad6493aa45a5a0f37fc06e5078cbb54c9a7910-68,165164902440265255,219.8915313872214287834768998602455,220000000,220,1673417903,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +1,0x000029977dec2ee069746f37b406b0033478fc74c1e8c4c32e005369ff72cd8e-67,1453460000000000000,2373.210496844090595231272385689297,2377337793,2377.337793,1674397679,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +2,0x0000306bc3246038da552285fa7dc7c910eb286c2bbe5cb5e2fc7b5548678e7d-247,76043182366132083,95.08155837256730590695657996275899,95000000,95,1672817147,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +3,0x000034b19989093db01dab53cfdd68095df98894d1adea77e448dfb552095ef1-5,1478046135,1478.046135,1297103585614120489,1476.578315091771810754929749923415,1668987359,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +4,0x00005407efab368c1ecf0df1ca44f78fcf65e8f85a6aac114a88380b6b20fd52-206,220057903336809077,360.3669886199093650360228486070972,360996431,360.996431,1675397111,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +5,0x0000c035c58a1d3f3c4fd0f583833c2bb80e6f10a006f536d27933682c022620-6,46558220046,46558.220046,29250375374715193786,46570.2665801853793349376870973774,1674891731,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +6,0x0000cde32d93c27e0b8909faa3deff77b39c196552d3556fe72c52ac7aacbc15-252,41168561785,41168.561785,32082468149638960158,41221.66511439034313405098452639043,1673221199,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +7,0x0000d9a6306f946191d8e780be0defe6507cf36460dd62394aacbb0b8a378142-164,78854012872,78854.012872,52911760284495763560,78617.22438030167725480248225868876,1676300387,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +8,0x0000de911f7145a68d7f723af42f43bad2eab3d260aa364c24a764f6fa5a687b-2,658335797628,658335.797628,433403423715345122191,656088.2351651385428695225230769098,1676249243,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +9,0x000109542b1fb2ef41094b1dcae49295bf6b67a359e3b7ba610555716c6d037a-2,124393481348542253740,147320.4138447047494083206833736018,147317476747,147317.476747,1669249007,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +10,0x00013508b3b56cf1613dc373b3ccf6fcafcd3f3c7b0860ae0574a9242d3c1504-88,389696273086551948,495.2751709179147683802682530179515,494151202,494.151202,1670086019,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +11,0x0001413726ac7ed8bd835c7b163fb52460ad00c56c33e31bbe93c33d43790031-34,23897635823703337387,31800.64562004974990896384092151001,31781533974,31781.533974,1673371691,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +12,0x00017573880e3f74be038583b37c2859adc093f2624e7c1514fef3107e0e4196-415,13275691,13.275691,11197569439537872,13.29150344287183389087434958984589,1672262831,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +13,0x00017afe68c99a258817f952c24b43930b88e72c9cbe3928a55e8a95214debf4-57,10954742856831383,18.27254395664930463656905648544463,18294668,18.294668,1675587791,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +14,0x000180fd16f1709774988a7ce673be07e04045ec30b44c65fa195c6510be7bdb-95,6000452133744186616,10197.10740014680736445244853829156,10184884903,10184.884903,1676654915,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +15,0x00018d5885ee9c8b5cb1f82177add3f52038b4fa84be9a684ec7a09b14cfda80-159,300000000,300,179581315560361048,299.6322196597881884548633601256496,1676858579,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +16,0x000191fbd21e8da2b6cb51bd625dd9ab462eb6e74e142375ef76b1abd9d67b2d-337,1282788143576881559,1718.200420854212407413636972593922,1717630879,1717.630879,1673377739,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +17,0x00019b1104ef65fb423f2026525fa70e8d5798e78760fb415de22bd1e1f7b2b3-258,83988289661,83988.289661,50749033534626685680,83731.2025569066564831940163361986,1677197603,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +18,0x0001c5172aa2665e4d5517b13e985b6cc41cb7fad938c2dec0acca26015ee91b-298,414000000000000000,482.7061953698765066962876352994952,483015472,483.015472,1671494051,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +19,0x0001c7bb01be6c7c957d909db1b3704c351f18be7a4af8e53947d6c4b23e0fbb-345,300000000,300,189579828305880956,300.0643651785422170445163237931002,1677979631,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +20,0x0001cbe8769d9a9c9ec11bd1c531c2e9f94e545a4724eadd000ea516cc1817cf-179,1559216971256209875,2497.758512250542161582893402842844,2502989418,2502.989418,1677280343,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +21,0x0001e1c3f4201f15646fe923267f903d3cd680487857d2d50a08ca97cfe301c0-358,500000000,500,305780961300264129,498.603544583147138539471203277568,1674511943,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +22,0x0001f0cf46ab4f319b65d1ac82eb041fe13cbda4aac65f0e41b09fde5dc1b96c-151,826042261308203401,987.790359723301792522336330096657,986819337,986.819337,1671218975,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +23,0x0002088b2f326f0114b41b8a89d7f15f12d293328a6a2d3c761eef1c34175695-13,4266117177,4266.117177,3560090738149703786,4263.76654287425030107557538050146,1672447895,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +24,0x00020c21ddd0def995e370ba49c18145cde69d5aed39b6ede6457a79ad00e030-17,302345723632499994783,400728.5135016687542263586647806889,400027691117,400027.691117,1673453135,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +25,0x000220fa0f2a0e30c993148127f013d1387a17fa5d428f22f26e81e80b651207-122,704204432016447112,1184.298508455932297991278175498373,1184486129,1184.486129,1676975147,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +26,0x0002334de6147cb80bd341efd3458dd7fc3044aba46665122382b93b42986e7d-179,139988967458866108,231.247111610865897697279692115659,231464603,231.464603,1674313943,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +27,0x0002413d43d3df164c298af1e8f37807c471b00428a1cff0dfc78ff31cf3bf9d-8,45026455951645244514,73472.10681696937993626979876857663,73465887941,73465.887941,1675928915,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +28,0x00024c60710fc0384d19877412a2c32d0e9bbf91bf1aa460ce71c3c8cb677fce-35,1790341195202309670,2245.472695963413720236948665845606,2250217200,2250.2172,1668417695,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +29,0x000295323120fc3e18f834bac8f2273ea078a1ed5cb3d319686add753553ae51-201,1137229071610171485,1501.625283348017482460174393642247,1500000000,1500,1670992451,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +30,0x0002ac81a0eb41067c88c3263da5cd194d1bb536e3802386c824ad9cfbe145d4-254,146597500,146.5975,123041165753576800,146.9148758876479106053597613793723,1671505991,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +31,0x0002b4156acce5f421f60a20522849d1259ca66e869050f6bf7d31dbd348e2f9-97,8545738327461185507,14307.99857248156101915096385363379,14293487402,14293.487402,1675316291,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +32,0x0002c9b82966567b8f14e1be7c12da305ec26a94247fd1086a6d86eefef25433-7,380699615609,380699.615609,232216253075649844206,379526.6622254281781688392307858671,1677154703,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +33,0x0002cb0a08fd9b9a069b2b8e136a542c52f2a43e0b6026ddbf6f796cde2ed127-255,730000000,730,470539141711631270,729.4582417291888962280629039060472,1675991879,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +34,0x0002ce92fa7e99591690605cf298db46203385f1cd251064378edcf5f260a5f8-186,227987500000000000,364.6381802085514440274379580598034,365352292,365.352292,1674770531,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +35,0x0002ea03a9f19ad95a9e9a89e77670a510962bbd9a42c3f45f34f673fae7693a-291,159580832454,159580.832454,131375328460179736637,159342.7739399207275661227702880451,1672004819,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +36,0x000300720c33807a7b3ee711aa973a7474e7f54996f9f921d0a21ff36ece4248-32,1157496010487669351,1885.30709735455757546380871321046,1883774218,1883.774218,1674517775,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +37,0x0003091d8a4d0f6f045542e413922c889039aa834885b9e22fd2bb327162b2d4-104,37111517622300000256,62682.0518868005100616316183171547,62630647482,62630.647482,1676867291,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +38,0x00030cdb7432ccdafafc334ba7374d82bc90c248cd43d887d381bcdd5954327f-17,2463469618,2463.469618,2044605831764151188,2457.241880647332943225326798336604,1671995411,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +39,0x0003126decf8b23dd624a5887fdf38ab955870bbdf7e8b31a7819a73e3d56cb4-135,1011075000000000000,1227.064967051691519853785195301846,1227497302,1227.497302,1668604391,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +40,0x0003174be116602d08a9369f666da73317edcdee6c8fcba40c69f31fd676ef3c-348,1117283795202131135,1857.485734651577899154796223969609,1856064056,1856.064056,1676998931,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +41,0x00034570969b2d3139c60f1f0e9c278881e19c86b12940a2fab8f353f4171ebf-203,91948671224,91948.671224,59089499156165231960,91849.56685955868653799392335586442,1674158867,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +42,0x00037cbcf8a1d38a7277f8e4dab3ed5e9ca29959bb13534d14581df2b3615a7b-215,5000000000,5000,4568903685867950012,4935.113661628706988594489622024252,1669121279,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +43,0x000385236b773e6ef3b9d4fc4cff7e8e904c67d99c672354b6da523fa7e61bfe-254,200000000000000000,314.881706889972581875426507916693,315441773,315.441773,1675202975,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +44,0x000388e7c7e5a5483fc1cc0b06a1f47f4696162becc4e31c7e4f1f7bd44eda6d-32,54821367652710738152,70561.78919821249295587817540921597,70692889520,70692.88952,1669864859,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +45,0x00038b2e69d8990f728c32262d9a9df86498659f501d3ec8ceee9d33a2b421f7-76,295000000,295,180779303637153529,294.9868181521293845772488862693362,1675929275,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +46,0x0003e7b5cf753abd51b2500e46d67231b992db582ffe4189ccff154662565b7d-6,25677625618,25677.625618,16569766083477603453,25642.91978753200847105781265117018,1673864891,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +47,0x0003f0273e17afcc6e302db829fc3458e64037ac8b93f18e056ccc2fdb7b66b0-26,666986917569356920950,1055316.254887044495771516971112594,1056301653513,1056301.653513,1674687647,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +48,0x0003f1332793db82d0e9340e285f7497fec2d9e2bf2202d6d5985fa21920f335-198,100000000,100,63496397646308500,99.79036338311041940575328087158152,1675244471,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +49,0x0003f2288193ef1c41c3403f421778aaa201650722362478557675885803560a-10,52070312500,52070.3125,40377417689533516823,51929.33485283363781639921950732185,1671103931,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +50,0x0003f3019796f9f263c611457850e0f36fc16a91574342adae70747170f655b7-26,2437937998,2437.937998,2000000000000000000,2435.547840819167387824376037989934,1671704747,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +51,0x0003f86092a7496dafcf859edcd4013898d83106496bde3cbff58b690ecd4fe6-60,1970599275149658514,2318.376399461934350900527385242463,2317696024,2317.696024,1669655975,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +52,0x000403853ea11ae0a7c27964fa22089a38af82a635a433a48a76e2a8aba7f18d-262,7500000000,7500,6354058392112957125,7483.803003711648851661898311538769,1671254063,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +53,0x00041460eed1095758df4eb73cca77d25ecf0fa8036bb1ad58c26b59bbe7a4a5-215,4734014928,4734.014928,3357657118317251876,4740.712156529922927639390309718152,1673611847,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +54,0x0004167242a562b2863db4ebd1f2785b9cddfbedfd6d81fb32bc8d0f07d5004a-214,6401495,6.401495,5393759277803882,6.389058294254219581811281717498997,1669373243,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +55,0x0004220c39f28a4bac8676cf54b1ca4b11a9baaff2ac90554167fcd095b5b370-53,817285625000000000,991.6592322535656731615887690330034,991224433,991.224433,1669582331,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +56,0x00042e65952f228739ffd873368e36ceb88e26900ba9c696d99e4d7d0dc47ffe-180,4019500000000000000,6759.586102899764376918375007018465,6770720827,6770.720827,1676972723,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +57,0x0004762e470db297b3f03b8f381fb1a2b1e2402781dbf6f05a5e18e8b0f3637d-172,100000000,100,78642597524776254,99.70859894718863499435120395202008,1670729795,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +58,0x00047d119b0fe5c194a152651284159dcbaf95164311d551f7f8bf4b067c9b55-119,145054547335,145054.547335,119821830852204860421,145231.3480732831214505859797147423,1668625247,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +59,0x00049f42f21bf62be30883117947ae5ebcc88af474a73193bde118a6f4b913e5-12,3959655927321705924,6087.071071822915533733227938028623,6070028066,6070.028066,1676167439,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +60,0x0004a842fc4692495edec665a019d1c4a08f83ab3a3d42eda18ca5eb0c883c63-314,902494922,902.494922,587926328861019821,901.9743574990142161575806215133252,1673731751,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +61,0x0004b67609a1de803c73051f8523ddfab153b2a2dab73b297394736b9a1d31d0-16,1200044468588,1200044.468588,933502979724866713603,1205110.722604868102689678235682618,1671069059,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +62,0x0004d4d6bdf572366136bbae48729ec2597d0a119d6af97dc94213ec509b5fa4-384,1700000000,1700,1040514037011376308,1697.384053167469410528406395013065,1677441611,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +63,0x0004e192535cec3a60af282022675ff0c2d3468622bf104909456e9c29ac034e-151,500000000,500,394545357882383759,498.5264199317388328343087378078006,1670635631,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +64,0x0004e8d45d9ece8614111ab33d43fa07ef2c46c83c047f399a466fcee8005bb7-22,1000000000000000000,1192.7887840739622182228804846387,1192593067,1192.593067,1672550615,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +65,0x0004f746ba615d9a3df22196318142df5fa491ee9a90ed3098755b6e1a17f701-90,2000000000000000,2.463534886048492764939430353695576,2464984,2.464984,1670428643,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +66,0x0004f984aa96eb9b513fb2699f2d0b97612bef2b08c79dfb92019b577fc07534-2,98178094703599992832,155424.3942613838908461369455208275,154959384856,154959.384856,1673968499,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +67,0x0004ff8bcca6eec289d136694cd6089230381027ce71216b6d7516ca3a6c5753-11,23495431691234003859,28447.42084712940182748879375117486,28428266422,28428.266422,1671649607,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +68,0x00053f5a85161a1e3fee534d7265325fed4c1750faecfd645063a393fe0a591b-256,16000000000000000000,20419.07421738995397147633191181165,20372870066,20372.870066,1671111887,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +69,0x00055009c1c3faf347fc62e7c0e9d12de89b4ad50d0103ec7986179005bda375-83,500000000,500,324658168083445099,500.2393255244421779306507107235814,1676234339,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +70,0x00055394402062bdddbacdf75c584ea250577ee2809bd6d227573319a5d34049-44,60000000000000000,72.61846128265588192931354725982646,72502400,72.5024,1671664019,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +71,0x00055740134249d4cb1c6f8c6166fb98a505056647b71f65804023705d84e342-2,362363336880220443540,569369.855421667822546913291763643,567479936514,567479.936514,1674939347,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +72,0x0005a3048cef80e13273e5c4a34da0a6bdf086f6a58c7f4af80088f5099be33b-124,1626933957,1626.933957,1049023316318160546,1628.319997165791650873281750135143,1676427455,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +73,0x0005b39cac653482836629c7eee2f6b86af98398ef60e7bd5991c9148124b870-244,273000000000000000,445.1509033450805905015192242518989,445524623,445.524623,1674509555,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +74,0x0005b49f728da5c96717db6486d42c8b5351a16da719ed33319e3df3984749b5-2,67486844518,67486.844518,53444624962446430990,67622.18629755595054419742444168192,1670266823,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +75,0x0005cf567355979722d13b4a478fce9e0e4c1a8e1bf7cc4f62dc2e26ecd6f408-42,77838087386,77838.087386,63930141526521634778,77878.06567515199294818956125639041,1668922871,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +76,0x0005d800acf20c11921e167929bf89cffa93d4eefc9aaea71141280e49347534-22,2000000000,2000,1493146436193730042,1998.714377895442770217706746197551,1670939375,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +77,0x0005e611811e9a0460476ab96e70582cc18fbff6b2e8bac8d2b6e186fd0a0be3-108,3000000000,3000,2361988642172534605,3001.379178785878219610871998859185,1670711375,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +78,0x0005e89f8582ebdbe38b0cbe7a9a773277d9e7bb776fb33682c28c4005412c1e-208,545196208451149490,665.0821309604905535173923776816105,664000000,664,1671816239,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +79,0x0005eac78c3f4949f4b4e2c6163feb0079030be6882c276968a4e133192213ea-273,297519991439111194,361.4157159486135392279500710580066,361964351,361.964351,1672150559,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +80,0x0005fd68182f913707d94001eb70dd5669b3c40df38e757204e5caa1e98f5d63-243,3908110259,3908.110259,2568750873481335119,3900.130036749986864414249570398325,1676051015,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +81,0x000607cc9b1170897fa53e2180f3869bafb01ddd918bf53cbe7d48eaaab1b7a7-72,7440097925086047395,8136.737268637143302917327647046512,8185666632,8185.666632,1669068167,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +82,0x0006181b51e4375d4904a8f6b864771b3d6f86f56218f8c590bf019fbcf2b071-187,388096393419025026,500.9144025080792978033335991935964,500000000,500,1670204507,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +83,0x00062b2936e47f98113caf24254ebc703e445b2c5ccff6bce11381a5abb6e7c3-311,130000000000000000,157.3360312315733264087951731445154,157140915,157.140915,1671654263,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +84,0x00064665b6709a136a1a3eca9355153da033f50d77b2ec8f2e6ed4b971f674f4-351,990000000,990,783594442820526316,987.324576873590902845704747990882,1670261435,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +85,0x0006648102d8975dc859e1b718eac52e385bdad3c47aeef3adeeca3af7f5a326-153,1458420793,1458.420793,1090122987502864495,1461.644581664182116999178632022246,1673462339,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +86,0x000690c8b385c9043eb36b8c338e32ec33ce03c10510de9579560e67193484c0-224,2544182551,2544.182551,2000000000000000000,2539.063668419619177449659903962748,1670073563,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +87,0x00069b571b12903748a1f6fe55e6931d1f7c9008120239275409b2a7b3673520-45,65021385201,65021.385201,46317834422665068857,64960.38548132655420848900837246148,1673498771,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +88,0x0006b2174ad035f358be4a2a4bbb8dba6adaa75935f6b75ea91c28483a79f113-267,191239343497550752,299.6080957179967421235218179737225,300000000,300,1675150019,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +89,0x0006b9ae0e41e2bb2006e39a2aa1b1bf9d256271f7b547aea72f4bcebb852ceb-32,100000000000000000,142.7439434466932503086567311056539,142755881,142.755881,1673559947,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +90,0x0006d45ed36fc2168eb1b551445dec6dc2bedaa345aa66499aaca7776982cdfc-118,3130459795,3130.459795,2000714115646953947,3133.539833393292569689809304434482,1673938319,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +91,0x0006e29138b92d459dca5cad882e581ae75ed28187fffb356cfdb33df9344e83-208,500000000,500,354496208140829605,500.5212898279139487440732761439298,1673611175,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +92,0x0006e2f24ace317a46adc869d72e79ff3ed853b21096af2950003d215ca438bd-453,1951000000,1951,1186515899435651899,1949.739956472058409397388758350414,1675766975,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +93,0x0006f5e3ee6c47d318230178aa71427b9859295cb39e95a58fd595e7c9847e32-102,1128484458043936737,1777.597217155326103934385024411283,1777163186,1777.163186,1674679523,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +94,0x00070ee89a307945fa7729baa77bd84e9be8d9b18e46fe024ae3b83753548f4f-214,45300000000,45300,35511651508703748185,45178.27338399168430155128191996259,1669917419,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +95,0x00071671c9a89f538fa3b15d40bbcc29bb07ae1d601364141e547ac6af6b499b-2,289476898087,289476.898087,183487364915596510774,289546.4211466199105665218362133516,1674035303,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" +96,0x00071755c1829f6009766383c27d531c654db6540ad91273e29fceac9c3bf81e-104,702515498477883100,852.5765966949496092385262389774738,854021771,854.021771,1669589579,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +97,0x000733aaa47fe79cd1250e7d3342937f151ef402f26baac6ec5815d11ec30920-252,999506095727113942,1659.105343745557268787958634689001,1656000000,1656,1676610491,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +98,0x00074e7856cec06964ed7e9e49ff0cee6749f98155e7776250d7da08207b2269-154,139000000000000000,177.7472365005762227623917226610236,177671873,177.671873,1670183963,"{'name': 'Wrapped Ether', 'symbol': 'WETH'}","{'name': 'USD Coin', 'symbol': 'USDC'}" +99,0x0007557d2f77a2088ae842e3052430d2712bb6ad4e0cc6e281d5dd4f97517c42-64,1950853839,1950.853839,1160752137942572619,1947.843469780194405829595960947194,1675526351,"{'name': 'USD Coin', 'symbol': 'USDC'}","{'name': 'Wrapped Ether', 'symbol': 'WETH'}" diff --git a/scripts/Uniswap: ETH-USDC Pool Data.csv b/scripts/Uniswap: ETH-USDC Pool Data.csv new file mode 100644 index 0000000..95fc3d2 --- /dev/null +++ b/scripts/Uniswap: ETH-USDC Pool Data.csv @@ -0,0 +1,2 @@ +,timestamp,cumulativeProtocolSideRevenueUSD,cumulativeSupplySideRevenueUSD,cumulativeTotalRevenueUSD,cumulativeVolumeUSD,fees,name +0,,0,171286183.4745586325076944095296054,171286183.4745586325076944095296054,342572366949.1172650153888190589444,"[{'id': 'lp-fee-0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', 'feeType': 'FIXED_LP_FEE', 'feePercentage': '0.05'}, {'id': 'protocol-fee-0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', 'feeType': 'FIXED_PROTOCOL_FEE', 'feePercentage': '0'}, {'id': 'trading-fee-0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', 'feeType': 'FIXED_TRADING_FEE', 'feePercentage': '0.05'}]",Uniswap V3 USD Coin/Wrapped Ether 0.05% diff --git a/scripts/deribit_order_book.py b/scripts/deribit_order_book.py new file mode 100644 index 0000000..5ce97dd --- /dev/null +++ b/scripts/deribit_order_book.py @@ -0,0 +1,199 @@ +import pandas as pd +import requests +import asyncio +import datetime +from tardis_client import TardisClient, Channel +from tardis_dev import datasets, get_exchange_details +from pprint import pprint + + +class Deribit(object): + url = "https://test.deribit.com/api/v2/public/" + + def get_instruments(self): + url = self.url + "get_instruments" + resp = requests.get(url, params={'kind': 'option', 'currency': 'BTC'}) + result = resp.json()['result'] + instrument_names = [] + for data in result: + instrument_name = data['instrument_name'] + if 'P' not in instrument_name: + instrument_names.append(instrument_name) + + print(instrument_names) + return instrument_names + + def get_order_book(self, instrument_names): + url = self.url + "get_order_book" + order_books = [] + for i, instrument_name in enumerate(instrument_names): + order_books.append(requests.get(url, params={'instrument_name': instrument_name}).json()['result']) + # if i == 5: + # break + pprint(order_books) + return order_books + + def create_csv(self, order_books): + for order_book in order_books: + df_bids = pd.DataFrame( + data=order_book['bids'], + columns=['price', + 'amount'] + ) + + df_asks = pd.DataFrame( + data=order_book['asks'], + columns=['price', + 'amount'] + ) + + df_bids.to_csv('/Users/akhileshgoswami/Desktop/HedgingScripts/BTC_Derbit_bids.csv', mode='a', header=False) + df_asks.to_csv('/Users/akhileshgoswami/Desktop/HedgingScripts/BTC_Derbit_asks.csv', mode='a', header=False) + + def deribit_hist(self): + # # pip install tardis-client + # import asyncio + # from tardis_client import TardisClient, Channel + # tardis_client = TardisClient(api_key="YOUR_API_KEY") + # + # async def replay(): + # # replay method returns Async Generator + # messages = tardis_client.replay( + # exchange="deribit", + # from_date="2019-07-01", + # to_date="2019-07-02", + # filters=[Channel(name="book", symbols=["OPTIONS"])] + # ) + # + # # messages as provided by Deribit real-time stream + # async for local_timestamp, message in messages: + # print(message) + # + # asyncio.run(replay()) + + # pip install tardis-client + # import asyncio + # from tardis_client import TardisClient, Channel + # tardis_client = TardisClient(api_key="YOUR_API_KEY") + # + # async def replay(): + # # replay method returns Async Generator + # messages = tardis_client.replay( + # exchange="okex-options", + # from_date="2020-02-01", + # to_date="2020-02-02", + # filters=[Channel(name="option/trade", symbols=[])] + # ) + # + # # messages as provided by OKEx real-time stream + # async for local_timestamp, message in messages: + # print(message) + # + # asyncio.run(replay()) + + # requires Python >=3.6 + # pip install tardis-dev + + import logging + + # optionally enable debug logs + # logging.basicConfig(level=logging.DEBUG) + + exchange = 'deribit' + exchange_details = get_exchange_details(exchange) + + # iterate over and download all data for every symbol + for symbol in exchange_details["datasets"]["symbols"]: + # alternatively specify datatypes explicitly ['trades', 'incremental_book_L2', 'quotes'] etc + # see available options https://docs.tardis.dev/downloadable-csv-files#data-types + data_types = symbol["dataTypes"] + data_types = ['incremental_book_L2', 'book_snapshot_5', 'options_chain'] + + symbol_id = symbol["id"] + from_date = symbol["availableSince"] + to_date = symbol["availableTo"] + symbol_type = symbol['type'] + print(symbol) + + if 'option' not in symbol_type: + continue + + if symbol_id in ['PERPETUALS', 'SPOT', 'FUTURES']: + continue + + if '2022' not in from_date: + continue + + if from_date < '2022-08-26T00:00:00.000Z': + continue + + print(f"Downloading {exchange} {data_types} for {symbol_id} from {from_date} to {to_date}") + # print('symbol:: ', symbol_id, from_date, to_date) + + # each CSV dataset format is documented at https://docs.tardis.dev/downloadable-csv-files#data-types + # see https://docs.tardis.dev/downloadable-csv-files#download-via-client-libraries for full options docs + datasets.download( + exchange=exchange, + data_types=data_types, + from_date=from_date, + to_date=to_date, + symbols=[symbol_id], + # TODO set your API key here + api_key="TD.qu8XwTgCD2yrT2hC.G9za4OJj4UNPCUp.oU6MX-8YFSKsaLY.i5tiLA6IR9iUTZJ.PThJU5B4TUyCuvk.47-x", + # path where CSV data will be downloaded into + download_dir="./datasets", + ) + + def format_data(self): + order_book = pd.read_csv('datasets/deribit_incremental_book_L2_2022-08-28_OPTIONS.csv') + + strike_prices = [] + expiry_date = [] + order_type = [] + open_at = [] + symbol_dict = {} + for index, row in order_book.iterrows(): + if not row['symbol'] in symbol_dict: + symbol_dict[row['symbol']] = [] + symbol_dict[row['symbol']].append(row) + + df = pd.DataFrame() + + data = [] + for key, value in symbol_dict.items(): + data.append(pd.DataFrame(value)) + + df = pd.concat(data) + for index, row in df.iterrows(): + symbol = row['symbol'].split('-') + + expiry_date.append(symbol[1]) + strike_prices.append(symbol[2]) + order_type.append(symbol[3]) + timestamp = int(row['timestamp']) / 1000 + + format_date = datetime.datetime.utcfromtimestamp(timestamp / 1000).strftime('%c') + date_time = format_date.split(' ') + option_open_date = date_time[2] + option_open_date += date_time[1] + option_open_date += date_time[4][2] + date_time[4][3] + open_at.append(option_open_date.upper()) + + if 'Unnamed: 0' in df.columns: + df.drop('Unnamed: 0', inplace=True, axis=1) + df['strike'] = strike_prices + df['written'] = open_at + df['expiry'] = expiry_date + df['type'] = order_type + df.to_csv('datasets/deribit_incremental_book_L2_2022-08-28_OPTIONS.csv') + + +if __name__ == '__main__': + d = Deribit() + # instruments = d.get_instruments() + # order_books = d.get_order_book(instruments) + # d.create_csv(order_books) + + d.deribit_hist() + # d.format_data() + # d.drop_column() diff --git a/scripts/options.py b/scripts/options.py index b822ab9..df825c9 100644 --- a/scripts/options.py +++ b/scripts/options.py @@ -6,6 +6,66 @@ from components import BlackScholesOptionPricing +class IronFlyOptions(object): + spot = 1000 + + def compute_option_prices(self, puts=1, calls=1, put_strikes=[], call_strikes=[]): + + put_prices = [] + for i in range(0, puts): + black_scholes_put = BlackScholesOptionPricing( + current_asset_price=self.spot, + strike_price=put_strikes[i], + risk_free_rate=0.1, + option_expiration=7, + sigma=0.3, + ) + black_scholes_put_option_price = black_scholes_put.get_put_option_price() + put_prices.append(black_scholes_put_option_price) + + call_prices = [] + for i in range(0, calls): + black_scholes_call = BlackScholesOptionPricing( + current_asset_price=self.spot, + strike_price=call_strikes[i], + risk_free_rate=0.1, + option_expiration=7, + sigma=0.3, + ) + black_scholes_call_option_price = black_scholes_call.get_call_option_price() + call_prices.append(black_scholes_call_option_price) + + return put_prices, call_prices + + def payoffs(self, call_prices, put_prices, sell_calls=0, sell_puts=0, buy_calls=0, buy_puts=0): + profit = 0 + + if sell_calls > 0: + for i in range(0, sell_calls): + profit += call_prices[i] + if buy_calls > 0: + for i in range(0, buy_calls): + profit -= call_prices[i] + + if sell_puts > 0: + for i in range(0, sell_puts): + profit += put_prices[i] + if buy_puts > 0: + for i in range(0, buy_puts): + profit -= put_prices[i] + + print('Profit: ', profit) + + + +if __name__ == '__main__': + iron_fly = IronFlyOptions() + put_prices, call_prices = iron_fly.compute_option_prices(puts=2, calls=3, put_strikes=[850, 900], + call_strikes=[1250, 1350, 1450]) + print(put_prices, call_prices) + iron_fly.payoffs(call_prices=call_prices, put_prices=put_prices, sell_calls=1, sell_puts=1, buy_calls=2, buy_puts=1) + + class Options(object): TOKENS = ["ETH", "BTC"] PRICE_DIFF_TO_OPTION_PRICE_RATIO = { @@ -19,16 +79,16 @@ class Options(object): } def __init__( - self, - token, - current_asset_price, - asset_vol, - price_floor, - underlying_asset_price=None, - option_market_price=None, - strike_price=None, - current_reserve=60000, - optimal_utilization_ratio=0.7, + self, + token, + current_asset_price, + asset_vol, + price_floor, + underlying_asset_price=None, + option_market_price=None, + strike_price=None, + current_reserve=60000, + optimal_utilization_ratio=0.7, ): self.optimal_utilization_ratio = optimal_utilization_ratio self.current_reserve = current_reserve @@ -66,11 +126,11 @@ def plot_graph(self): plt.show() def get_total_funding_fee( - self, - option_market_price, - period, - strike_price=None, - underlying_asset_price=None, + self, + option_market_price, + period, + strike_price=None, + underlying_asset_price=None, ): """ @params: @@ -113,7 +173,7 @@ def get_total_funding_fee( return funding_fee_object def get_total_funding_fee_with_dynamic_strike_price( - self, period, max_asset_price=None, min_asset_price=None + self, period, max_asset_price=None, min_asset_price=None ): """ To compute a total funding fee based on the volatility of an asset, this function immitates a rise of 10% and @@ -171,11 +231,11 @@ def _get_payoff(self, strike_price, current_asset_price): return payoff def update_funding_fee( - self, - current_funding_fee, - all_open_options_price, - current_reserve, - total_reserve_drop_ratio, + self, + current_funding_fee, + all_open_options_price, + current_reserve, + total_reserve_drop_ratio, ): """ Updating the funding fee of a user for their hedged asset by @@ -223,19 +283,19 @@ def update_funding_fee( ) # R Slope 2 - Interest rate applied on funding fee when total_reserve is above optimal utilization if ( - utilization_ratio < self.optimal_utilization_ratio + utilization_ratio < self.optimal_utilization_ratio ): # Read more about this on cruize docs section: funding-rate updated_funding_fee += ( - utilization_ratio / self.optimal_utilization_ratio - ) * interest_rate_below_optimal + utilization_ratio / self.optimal_utilization_ratio + ) * interest_rate_below_optimal else: updated_funding_fee += interest_rate_below_optimal + ( ( - ( - (utilization_ratio - self.optimal_utilization_ratio) - / (1 - self.optimal_utilization_ratio) - ) - * interest_rate_above_optimal + ( + (utilization_ratio - self.optimal_utilization_ratio) + / (1 - self.optimal_utilization_ratio) + ) + * interest_rate_above_optimal ) ) @@ -256,30 +316,29 @@ def _get_utilization_ratio(self, all_open_options_price, total_reserve): def _get_total_reserve(self, all_open_options_price, current_reserve): return all_open_options_price + current_reserve - -if __name__ == "__main__": - from pprint import pprint - - op = Options( - token="ETH", - current_asset_price=2938.53, - underlying_asset_price=10000, - asset_vol=1, - option_market_price=1, - strike_price=None, - price_floor=0.85, - optimal_utilization_ratio=0.7, - ) - funding_fees_object = op.get_total_funding_fee_with_dynamic_strike_price(period=7) - print("current_funding_fee:") - pprint(funding_fees_object) - current_reserve = 80000 - total_reserve = current_reserve + funding_fees_object["all_open_options_price"] - updated_funding_fee = op.update_funding_fee( - current_funding_fee=funding_fees_object["funding_fee"], - all_open_options_price=funding_fees_object["all_open_options_price"], - current_reserve=current_reserve, - total_reserve_drop_ratio=0.1, - ) - print("updated_funding_fee: ", updated_funding_fee) - op.plot_graph() +# if __name__ == "__main__": +# from pprint import pprint +# +# op = Options( +# token="ETH", +# current_asset_price=2938.53, +# underlying_asset_price=10000, +# asset_vol=1, +# option_market_price=1, +# strike_price=None, +# price_floor=0.85, +# optimal_utilization_ratio=0.7, +# ) +# funding_fees_object = op.get_total_funding_fee_with_dynamic_strike_price(period=7) +# print("current_funding_fee:") +# pprint(funding_fees_object) +# current_reserve = 80000 +# total_reserve = current_reserve + funding_fees_object["all_open_options_price"] +# updated_funding_fee = op.update_funding_fee( +# current_funding_fee=funding_fees_object["funding_fee"], +# all_open_options_price=funding_fees_object["all_open_options_price"], +# current_reserve=current_reserve, +# total_reserve_drop_ratio=0.1, +# ) +# print("updated_funding_fee: ", updated_funding_fee) +# op.plot_graph() diff --git a/scripts/signups_graph.py b/scripts/signups_graph.py new file mode 100644 index 0000000..ab9c250 --- /dev/null +++ b/scripts/signups_graph.py @@ -0,0 +1,31 @@ +import pandas as pd +import matplotlib.pyplot as plt +import numpy as np + +df = pd.read_csv('/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/scripts/v4.csv') +print(df) + +signup_dates = df["Signup date"].values.tolist() +# signup_dates +wallets = df["Crypo wallet address"].values.tolist() +# wallets + +xpoints = np.array(signup_dates) +ypoints = np.array(wallets) + +plt.ylim(0, 200) +plt.xlim(0, 100) + +plt.ylabel("Wallets") +plt.xlabel("Signup Dates") + +plt.plot(xpoints, ypoints) +# plt.vlines( +# x=70, +# ymin=0, +# ymax=200, +# colors="red", +# label='Signups and Wallets', +# ) +# plt.legend() +plt.show() \ No newline at end of file diff --git a/scripts/test.csv b/scripts/test.csv new file mode 100644 index 0000000..470daad --- /dev/null +++ b/scripts/test.csv @@ -0,0 +1,22 @@ +,exchange,symbol,timestamp,local_timestamp,is_snapshot,side,price,strike,written,expiry,type +0,deribit,ETH-30DEC22-2200-P,1661644800127000,1661644800135806,False,ask,0.835,2200,28AUG22,30DEC22,P +1,deribit,ETH-30DEC22-2200-P,1661644800127000,1661644800135806,False,ask,0.8355,2200,28AUG22,30DEC22,P +2,deribit,ETH-9SEP22-3400-C,1661644797212000,1661644800276176,True,ask,0.001,3400,27AUG22,9SEP22,C +3,deribit,SOL-9SEP22-50-C,1661644797669000,1661644800276181,True,ask,0.007,50,27AUG22,9SEP22,C +4,deribit,ETH-9SEP22-3000-C,1661644797216000,1661644800276199,True,ask,0.0005,3000,27AUG22,9SEP22,C +5,deribit,ETH-9SEP22-3000-C,1661644797216000,1661644800276199,True,ask,0.001,3000,27AUG22,9SEP22,C +6,deribit,ETH-9SEP22-3000-C,1661644797216000,1661644800276199,True,ask,0.003,3000,27AUG22,9SEP22,C +7,deribit,ETH-9SEP22-3000-C,1661644797216000,1661644800276199,True,ask,0.0035,3000,27AUG22,9SEP22,C +8,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.0015,2600,27AUG22,9SEP22,C +9,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.002,2600,27AUG22,9SEP22,C +10,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.0025,2600,27AUG22,9SEP22,C +11,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.003,2600,27AUG22,9SEP22,C +12,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.007,2600,27AUG22,9SEP22,C +13,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,ask,0.0075,2600,27AUG22,9SEP22,C +14,deribit,ETH-9SEP22-2600-C,1661644797214000,1661644800276214,True,bid,0.0005,2600,27AUG22,9SEP22,C +15,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,ask,0.002,2300,27AUG22,9SEP22,C +16,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,ask,0.0025,2300,27AUG22,9SEP22,C +17,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,ask,0.0045,2300,27AUG22,9SEP22,C +18,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,ask,0.006,2300,27AUG22,9SEP22,C +19,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,bid,0.001,2300,27AUG22,9SEP22,C +20,deribit,ETH-9SEP22-2300-C,1661644797212000,1661644800276226,True,bid,0.0005,2300,27AUG22,9SEP22,C diff --git a/scripts/uniswap_historical_data.py b/scripts/uniswap_historical_data.py new file mode 100644 index 0000000..7eaa44a --- /dev/null +++ b/scripts/uniswap_historical_data.py @@ -0,0 +1,101 @@ +from gql import gql, Client +from gql.transport.requests import RequestsHTTPTransport +from pprint import pprint +import pandas as pd + +class UniswapHistoricalData(object): + def __init__(self): + self.aave_sub_graph_url = ( + "https://gateway.thegraph.com/api/884fed2091150d4d643b1415d340cfba/subgraphs/id/ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH6123cr7" + ) + + def fetch_sub_graph_query(self, liquidity_pool_id): + sub_graph_query = """ + { + liquidityPools(where: {id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"}) { + name + fees { + id + feeType + feePercentage + } + symbol + totalValueLockedUSD + cumulativeVolumeUSD + cumulativeTotalRevenueUSD + cumulativeSupplySideRevenueUSD + cumulativeProtocolSideRevenueUSD + swaps(where: {timestamp_gt: "1668408932"}) { + id + amountIn + amountInUSD + amountOut + amountOutUSD + tokenIn { + name + symbol + } + tokenOut { + name + symbol + } + timestamp + } + } + } + """ + return sub_graph_query + + def fetch_data(self, pool_id): + graph = self.fetch_sub_graph_query(pool_id) + query = gql(graph) + transport = RequestsHTTPTransport( + url=self.aave_sub_graph_url, + verify=True, + retries=3, + ) + client = Client(transport=transport) + + response_dict = client.execute(query) + return response_dict + + def create_csv(self, data): + pprint(data) + # Uncomment this to get pool data without swaps of that pool. + historical_data = pd.DataFrame( + data['liquidityPools'], + columns=[ + "timestamp", + "cumulativeProtocolSideRevenueUSD", + "cumulativeSupplySideRevenueUSD", + "cumulativeTotalRevenueUSD", + "cumulativeVolumeUSD", + "fees", + "name", + ], + ) + historical_data.to_csv('/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/scripts/Uniswap: {} Pool Data.csv'.format('ETH-USDC')) + + # Uncomment this to get swaps data of a certain Pool + historical_swaps_data = pd.DataFrame( + data['liquidityPools'][0]['swaps'], + columns=[ + "id", + "amountIn", + "amountInUSD", + "amountOut", + "amountOutUSD", + "timestamp", + "tokenIn", + "tokenOut", + ], + ) + historical_swaps_data.to_csv( + '/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/scripts/Uniswap {} Pool Swaps.csv'.format( + 'ETH-USDC')) + + +if __name__ == "__main__": + a = UniswapHistoricalData() + data = a.fetch_data(["0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"]) + a.create_csv(data) diff --git a/services/binance_client.py b/services/binance_client.py index ffa7447..365cccb 100644 --- a/services/binance_client.py +++ b/services/binance_client.py @@ -1,6 +1,108 @@ -import math -import multiprocessing +# import math +# import multiprocessing +# +# import pandas as pd +# import os.path +# from datetime import timedelta, datetime +# from dateutil import parser +# from binance.client import Client as Client_binance +# +# +# class BinanceClient(object): +# def __init__(self, +# config): +# self.binance_api_key = config['binance_api_key'] +# self.binance_api_secret = config['binance_api_secret'] +# self.client = Client_binance(api_key=self.binance_api_key, api_secret=self.binance_api_secret) +# # self.initial_date = config['initial_date'] +# # self.symbol = config['symbol'] +# # self.freq = config['freq'] +# +# ### FUNCTIONS +# def minutes_of_new_data(self, symbol, kline_size, +# initial_date, data, source, end_date=0): +# if len(data) > 0: +# old = parser.parse(data["timestamp"].iloc[-1]) +# elif source == "binance": +# old = datetime.strptime(initial_date, '%d %b %Y') +# if source == "binance": +# data = self.client.get_klines(symbol=symbol, interval=kline_size) +# print('size: ', len(data)) +# new = pd.to_datetime(data[end_date][0], unit='ms') +# return old, new +# +# def get_all_binance(self, symbol, freq, +# initial_date, save=False, end_date=0): +# binsizes = {"1m": 1, "5m": 5, "10m": 10, "15m": 15, "1h": 60, "6h": 360, "12h": 720, "1d": 1440} +# filename = '/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/files/%s-%s-%s-data.csv' % ( +# symbol, freq, initial_date) +# data_df = pd.DataFrame() +# oldest_point, newest_point = self.minutes_of_new_data(symbol, freq, +# initial_date, data_df, source="binance", end_date=end_date) +# delta_min = (newest_point - oldest_point).total_seconds() / 60 +# available_data = math.ceil(delta_min / binsizes[freq]) +# if oldest_point == datetime.strptime(initial_date, '%d %b %Y'): +# print('Downloading all available %s data for %s. Be patient..!' % (freq, symbol)) +# else: +# print('Downloading %d minutes of new data available for %s, i.e. %d instances of %s data.' +# % (delta_min, symbol, available_data, freq)) +# klines = self.client.get_historical_klines(symbol, freq, +# oldest_point.strftime("%d %b %Y %H:%M:%S"), +# newest_point.strftime("%d %b %Y %H:%M:%S")) +# data = pd.DataFrame(klines, +# columns=['timestamp', 'open', 'high', 'low', 'close', 'volume', 'close_time', +# 'quote_av', +# 'trades', 'tb_base_av', 'tb_quote_av', 'ignore']) +# data['timestamp'] = pd.to_datetime(data['timestamp'], unit='ms') +# # data.index = pd.to_datetime(data['timestamp'], unit='ms') +# if len(data_df) > 0: +# temp_df = pd.DataFrame(data) +# data_df = data_df.append(temp_df) +# else: +# data_df = data +# data_df.set_index('timestamp', inplace=True) +# if save: +# data_df.to_csv(filename) +# print('All caught up..!') +# print(initial_date) +# return data_df +# +# +# if __name__ == '__main__': +# +# import json +# from joblib import Parallel, delayed +# +# with open('/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/StgyApp_config.json') as json_file: +# config = json.load(json_file) +# _binance_client_ = BinanceClient(config['binance_client']) +# +# symbol = 'ETHUSDC' +# freq = '1m' +# initial_dates = ["1 Jan 2022", "1 Jan 2021", "1 Jan 2020", "1 Jan 2019", "1 Jan 2018", "1 Jan 2017", "1 Jan 2016", +# "1 Jan 2015", "1 Jan 2014"] +# end_dates = [-1, 232, 963, 1328, 1693, 2058, 2424, 2789, 3154] +# +# # eth_historical_prices_year_wise = [] +# parallel_pool = Parallel(n_jobs=9) +# delayed_function = [delayed(_binance_client_.get_all_binance)(symbol=symbol, freq=freq, +# initial_date=initial_date, save=True, +# end_date=end_date) for initial_date, end_date in +# zip(initial_dates, end_dates)] +# +# eth_historical_prices_year_wise = parallel_pool(delayed_function) +# print('eth_historical_prices_year_wise', eth_historical_prices_year_wise) +# +# # eth_prices_float = [] +# # for i, eth_prices in enumerate(eth_historical_prices_year_wise): +# # eth_prices_float.append([]) +# # for eth_price in eth_prices: +# # eth_prices_float[i].append(float(eth_price)) +# # +# # historical_data = eth_prices_float +# # print(historical_data) +import math import pandas as pd import os.path from datetime import timedelta, datetime @@ -9,36 +111,35 @@ class BinanceClient(object): + def __init__(self, config): self.binance_api_key = config['binance_api_key'] self.binance_api_secret = config['binance_api_secret'] + self.client = Client_binance(api_key=self.binance_api_key, api_secret=self.binance_api_secret) - # self.initial_date = config['initial_date'] - # self.symbol = config['symbol'] - # self.freq = config['freq'] ### FUNCTIONS - def minutes_of_new_data(self, symbol, kline_size, - initial_date, data, source, end_date=0): + def minutes_of_new_data(self, symbol, initial_date, + kline_size, data, source): if len(data) > 0: old = parser.parse(data["timestamp"].iloc[-1]) elif source == "binance": old = datetime.strptime(initial_date, '%d %b %Y') if source == "binance": - data = self.client.get_klines(symbol=symbol, interval=kline_size) - print('size: ', len(data)) - new = pd.to_datetime(data[end_date][0], unit='ms') + new = pd.to_datetime(self.client.get_klines(symbol=symbol, interval=kline_size)[-1][0], unit='ms') return old, new - def get_all_binance(self, symbol, freq, - initial_date, save=False, end_date=0): + def get_all_binance(self, symbol, initial_date, freq, save=False): binsizes = {"1m": 1, "5m": 5, "10m": 10, "15m": 15, "1h": 60, "6h": 360, "12h": 720, "1d": 1440} - filename = '/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/files/%s-%s-%s-data.csv' % ( - symbol, freq, initial_date) - data_df = pd.DataFrame() - oldest_point, newest_point = self.minutes_of_new_data(symbol, freq, - initial_date, data_df, source="binance", end_date=end_date) + filename = '/home/agustin/Git-Repos/algo-trading-crypto/il-hedger/il_hedger/files/%s-%s-data.csv' % ( + symbol, freq) + if os.path.isfile(filename): + data_df = pd.read_csv(filename) + else: + data_df = pd.DataFrame() + oldest_point, newest_point = self.minutes_of_new_data(symbol, initial_date, + freq, data_df, source="binance") delta_min = (newest_point - oldest_point).total_seconds() / 60 available_data = math.ceil(delta_min / binsizes[freq]) if oldest_point == datetime.strptime(initial_date, '%d %b %Y'): @@ -50,11 +151,9 @@ def get_all_binance(self, symbol, freq, oldest_point.strftime("%d %b %Y %H:%M:%S"), newest_point.strftime("%d %b %Y %H:%M:%S")) data = pd.DataFrame(klines, - columns=['timestamp', 'open', 'high', 'low', 'close', 'volume', 'close_time', - 'quote_av', + columns=['timestamp', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_av', 'trades', 'tb_base_av', 'tb_quote_av', 'ignore']) data['timestamp'] = pd.to_datetime(data['timestamp'], unit='ms') - # data.index = pd.to_datetime(data['timestamp'], unit='ms') if len(data_df) > 0: temp_df = pd.DataFrame(data) data_df = data_df.append(temp_df) @@ -64,40 +163,32 @@ def get_all_binance(self, symbol, freq, if save: data_df.to_csv(filename) print('All caught up..!') - print(initial_date) return data_df if __name__ == '__main__': import json - from joblib import Parallel, delayed with open('/Users/prithvirajmurthy/Desktop/blockchain/cruize/scripts/StgyApp_config.json') as json_file: config = json.load(json_file) _binance_client_ = BinanceClient(config['binance_client']) - symbol = 'ETHUSDC' - freq = '1m' - initial_dates = ["1 Jan 2022", "1 Jan 2021", "1 Jan 2020", "1 Jan 2019", "1 Jan 2018", "1 Jan 2017", "1 Jan 2016", - "1 Jan 2015", "1 Jan 2014"] - end_dates = [-1, 232, 963, 1328, 1693, 2058, 2424, 2789, 3154] - - # eth_historical_prices_year_wise = [] - parallel_pool = Parallel(n_jobs=9) - delayed_function = [delayed(_binance_client_.get_all_binance)(symbol=symbol, freq=freq, - initial_date=initial_date, save=True, - end_date=end_date) for initial_date, end_date in - zip(initial_dates, end_dates)] - - eth_historical_prices_year_wise = parallel_pool(delayed_function) - print('eth_historical_prices_year_wise', eth_historical_prices_year_wise) - - # eth_prices_float = [] - # for i, eth_prices in enumerate(eth_historical_prices_year_wise): - # eth_prices_float.append([]) - # for eth_price in eth_prices: - # eth_prices_float[i].append(float(eth_price)) - # - # historical_data = eth_prices_float - # print(historical_data) + # Track historical data + symbol_eth = 'ETHBUSD' + symbol_btc = 'BTCBUSD' + freq = '1d' + initial_date = "1 Jan 2021" + _binance_client_ = BinanceClient(config['binance_client']) + eth_historical = _binance_client_.get_all_binance(symbol=symbol_eth, freq=freq, + initial_date=initial_date, save=False) + btc_historical = _binance_client_.get_all_binance(symbol=symbol_btc, freq=freq, + initial_date=initial_date, save=False) + eth_prices = eth_historical['close'] + for i in range(len(eth_prices)): + print(eth_prices[i]) + eth_prices[i] = float(eth_prices[i]) + btc_prices = btc_historical['close'] + for i in range(len(btc_prices)): + print() + btc_prices[i] = float(btc_prices[i]) diff --git a/utilities/datetime_utilities.py b/utilities/datetime_utilities.py index af7497b..ca7c415 100644 --- a/utilities/datetime_utilities.py +++ b/utilities/datetime_utilities.py @@ -5,7 +5,7 @@ TIMEZONE = pytz.timezone("Asia/Kolkata") -def convert_epoch_to_utcdatetime(epoch, parser="%Y-%m-%dT%H:%M:%S"): +def convert_epoch_to_utcdatetime(epoch, parser="%Y-%m-%d"): return ( (datetime.utcfromtimestamp(epoch)) .replace(tzinfo=pytz.utc)