Skip to content

Commit

Permalink
Fix data-provider initialization on token timestamp conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
conache committed Jun 26, 2024
1 parent be1e54f commit 58e7925
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def init_price_token(token_name, token_from, token_to):
for data_point in historical_data:
timestamp = int(data_point[0] / 1000) # Convert milliseconds to seconds
price = data_point[1]
cursor.execute("INSERT INTO prices (timestamp, token, price) VALUES (?, ?, ?)", (timestamp, token_name.lower(), price))
cursor.execute("INSERT OR REPLACE INTO prices (timestamp, token, price) VALUES (?, ?, ?)", (timestamp, token_name.lower(), price))
print(f"inserting data point {timestamp} : {price}" )
conn.commit()
conn.close()
Expand Down

0 comments on commit 58e7925

Please sign in to comment.