Skip to content

Commit

Permalink
Add support for QuestDB
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoscon committed Mar 1, 2022
1 parent e972bdd commit 7c29eba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion cryptostore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from cryptofeed.backends.postgres import BookPostgres, TradePostgres, TickerPostgres, FundingPostgres, CandlesPostgres, OpenInterestPostgres, LiquidationsPostgres
from cryptofeed.backends.socket import BookSocket, TradeSocket, TickerSocket, FundingSocket, CandlesSocket, OpenInterestSocket, LiquidationsSocket
from cryptofeed.backends.influxdb import BookInflux, TradeInflux, TickerInflux, FundingInflux, CandlesInflux, OpenInterestInflux, LiquidationsInflux
from cryptofeed.backends.quest import BookQuest, TradeQuest, TickerQuest, FundingQuest, CandlesQuest, OpenInterestQuest, LiquidationsQuest


async def tty(obj, receipt_ts):
# For debugging purposes
Expand Down Expand Up @@ -105,7 +107,7 @@ def load_config() -> Feed:
OPEN_INTEREST: OpenInterestSocket(host, **kwargs),
LIQUIDATIONS: LiquidationsSocket(host, **kwargs)
}
elif backend in ('INFLUX'):
elif backend == 'INFLUX':
args = (host, org, bucket, token)
cbs = {
L2_BOOK: BookInflux(*args, snapshot_interval=snap_interval, snapshots_only=snap_only),
Expand All @@ -116,6 +118,17 @@ def load_config() -> Feed:
OPEN_INTEREST: OpenInterestInflux(*args),
LIQUIDATIONS: LiquidationsInflux(*args)
}
elif backend == 'QUEST':
kwargs = {'host': host, 'port': port if port else 9009}
cbs = {
L2_BOOK: BookQuest(**kwargs),
TRADES: TradeQuest(**kwargs),
TICKER: TickerQuest(**kwargs),
FUNDING: FundingQuest(**kwargs),
CANDLES: CandlesQuest(**kwargs),
OPEN_INTEREST: OpenInterestQuest(**kwargs),
LIQUIDATIONS: LiquidationsQuest(**kwargs)
}
elif backend == 'TTY':
cbs = {
L2_BOOK: tty,
Expand Down
3 changes: 2 additions & 1 deletion docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Cryptostore utilizes the supported backends of cryptofeed to store data from exc
* UDP - `UDP`
* UDS - `UDS`
* InfluxDB - `INFLUX`
* QuestDB - `QUEST`

Cryptostore runs in a docker container, and expects configuration to be provided to it via environment variables. The env vars it utilizes (not all are required for all configurations) are:

Expand All @@ -21,7 +22,7 @@ Cryptostore runs in a docker container, and expects configuration to be provided
* BACKEND - Backend to be used, see list of supported backends above.
* SNAPSHOT_ONLY - Valid for orderbook channel only, specifies that only complete books should be stored. Default is False.
* SNAPSHOT_INTERVAL - Specifies how often snapshot is stored in terms of number of delta updates between snapshots. Default is 1000.
* HOST - Host for backend. Defaults to localhost. TCP, UDP and UDS require the protocol to be prepended to the host/url. E.g. `tcp://127.0.0.1`, `uds://udsfile.tmp`, etc.
* HOST - Host for backend. Defaults to localhost. TCP, UDP and UDS require the protocol to be prepended to the host/url. E.g. `tcp://127.0.0.1`, `uds://udsfile.tmp`, etc.
* PORT - Port for service. Defaults to backend default.
* CANDLE_INTERVAL - Used for candles. Default is 1m.
* DATABASE - Specify the database for MongoDB or Postgres
Expand Down

0 comments on commit 7c29eba

Please sign in to comment.