-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement first pass of data horizon check when creating cluster.
- Loading branch information
Showing
12 changed files
with
187 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,60 @@ | ||
import asyncio | ||
|
||
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient # type: ignore | ||
from dydx_v4_client.network import make_mainnet # type: ignore | ||
from locast.candle.dydx.dydx_resolution import DydxResolution | ||
from locast.candle_fetcher.dydx.candle_fetcher.dydx_candle_fetcher import ( | ||
DydxCandleFetcher, | ||
) | ||
from locast.candle_fetcher.dydx.api_fetcher.dydx_v4_fetcher import DydxV4Fetcher | ||
from locast.candle.candle_utility import CandleUtility as cu | ||
|
||
MAINNET = make_mainnet( # type: ignore | ||
rest_indexer="https://indexer.dydx.trade/", | ||
websocket_indexer="wss://indexer.dydx.trade/v4/ws", | ||
node_url="dydx-ops-rpc.kingnodes.com:443", | ||
) | ||
|
||
|
||
async def main() -> None: | ||
pass | ||
res = DydxResolution.FIFTEEN_MINUTES | ||
market = "DOGE-USD" | ||
dydx_v4_fetcher = DydxV4Fetcher(IndexerClient(MAINNET.rest_indexer)) | ||
fetcher = DydxCandleFetcher(dydx_v4_fetcher) | ||
|
||
horizon = await fetcher.find_horizon(market, res) | ||
print(f"horizon: {horizon}") | ||
|
||
horizon_plus_one = cu.add_one_resolution(horizon, res) | ||
horizon_minus_one = cu.subtract_n_resolutions(horizon, res, 1) | ||
horizon_minus_two = cu.subtract_n_resolutions(horizon, res, 2) | ||
oldest_candle = await fetcher.fetch_candles( | ||
market, | ||
res, | ||
horizon, | ||
horizon_plus_one, | ||
) | ||
|
||
one_older = await fetcher.fetch_candles( | ||
market, | ||
res, | ||
horizon_minus_one, | ||
horizon, | ||
) | ||
|
||
two_older = await fetcher.fetch_candles( | ||
market, | ||
res, | ||
horizon_minus_two, | ||
horizon_minus_one, | ||
) | ||
|
||
print("Oldest:") | ||
print(oldest_candle) | ||
print("One older:") | ||
print(one_older) | ||
print("Two older:") | ||
print(two_older) | ||
|
||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.