Resolve UTC issue in candles

This commit is contained in:
Gavin.Chan
2018-01-23 23:25:10 +00:00
parent 7c16b34a8d
commit 2131c6bf93
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -64,3 +64,4 @@ target/
# Others
.editorconfig
.github/
.idea/
+3 -3
View File
@@ -19,8 +19,8 @@ def candles(source, symbol, start_time, end_time, frequency):
data = source.public_get_returnchartdata(params={
"currencyPair": symbol,
"start": start_time.timestamp(),
"end": end_time.timestamp(),
"start": round(start_time.timestamp()),
"end": round(end_time.timestamp()),
"period": frequency
})
@@ -31,7 +31,7 @@ def candles(source, symbol, start_time, end_time, frequency):
})
data.loc[:, 'start_time'] = data['start_time'].apply(
pd.Timestamp.fromtimestamp)
lambda x : pd.Timestamp.fromtimestamp(x).tz_localize('UTC'))
data['end_time'] = data['start_time'] + pd.DateOffset(
seconds=frequency)