Skip to content

Commit

Permalink
Update influx.py (#137)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
GoldenNaim authored Nov 14, 2020
1 parent a2c4d63 commit 2d82162
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cryptostore/data/influx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d82162

Please sign in to comment.