From 2d82162469fead92a8350beefcc1c2cb0fc16deb Mon Sep 17 00:00:00 2001 From: GoldenNaim <74271280+GoldenNaim@users.noreply.github.com> Date: Sat, 14 Nov 2020 17:21:39 +0100 Subject: [PATCH] Update influx.py (#137) Little change because in Influx, the fieldType for the fieldKey "price" was : string , after this update, the fieldType is : float. Example before : name: liquidations-BITMEX fieldKey fieldType -------- --------- leaves_qty float order_id string price string receipt_timestamp float side string timestamp float After : name: liquidations-BITMEX fieldKey fieldType -------- --------- leaves_qty float order_id string price float receipt_timestamp float side string timestamp float --- cryptostore/data/influx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptostore/data/influx.py b/cryptostore/data/influx.py index ee1f0a8..5375b3f 100644 --- a/cryptostore/data/influx.py +++ b/cryptostore/data/influx.py @@ -95,7 +95,7 @@ def write(self, exchange, data_type, pair, timestamp): elif data_type == LIQUIDATIONS: for entry in self.data: ts = int(Decimal(entry["timestamp"]) * 1000000000) - agg.append(f'{data_type}-{exchange},pair={pair},exchange={exchange} side="{entry["side"]}",leaves_qty={entry["leaves_qty"]},order_id="{entry["order_id"]}",price="{entry["price"]}",timestamp={entry["timestamp"]},receipt_timestamp={entry["receipt_timestamp"]} {ts}') + agg.append(f'{data_type}-{exchange},pair={pair},exchange={exchange} side="{entry["side"]}",leaves_qty={entry["leaves_qty"]},order_id="{entry["order_id"]}",price={entry["price"]},timestamp={entry["timestamp"]},receipt_timestamp={entry["receipt_timestamp"]} {ts}') # https://v2.docs.influxdata.com/v2.0/write-data/best-practices/optimize-writes/ # Tuning docs indicate 5k is the ideal chunk size for batch writes