Skip to content

Commit d534754

Browse files
authored
Merge pull request Skinok#10 from ghmole/main
update ui to pyqt6
2 parents 919b5ac + 863b18a commit d534754

File tree

8 files changed

+5533
-38
lines changed

8 files changed

+5533
-38
lines changed

SkinokBacktraderUI.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,24 @@ def loadData(self, dataPath, datetimeFormat, separator):
107107

108108
# Python contains
109109
if not dataPath in self.dataframes:
110-
self.dataframes[fileName] = pd.read_csv(dataPath,
111-
sep=separator,
112-
parse_dates=[0],
113-
date_parser=lambda x: pd.to_datetime(x, format=datetimeFormat),
114-
skiprows=0,
115-
header=0,
116-
names=["Time", "Open", "High", "Low", "Close", "Volume"],
117-
index_col=0)
110+
if pd.__version__=='1.4.3':
111+
self.dataframes[fileName] = pd.read_csv(dataPath,
112+
sep=separator,
113+
parse_dates=[0],
114+
date_parser=lambda x: pd.to_datetime(x, format=datetimeFormat),
115+
skiprows=0,
116+
header=0,
117+
names=["Time", "Open", "High", "Low", "Close", "Volume"],
118+
index_col=0)
119+
else:
120+
self.dataframes[fileName] = pd.read_csv(dataPath,
121+
sep=separator,
122+
parse_dates=[0],
123+
date_format=datetimeFormat,
124+
skiprows=0,
125+
header=0,
126+
names=["Time", "Open", "High", "Low", "Close", "Volume"],
127+
index_col=0)
118128

119129
except ValueError as err:
120130
return False, "ValueError error:" + str(err)
@@ -177,21 +187,21 @@ def findTimeFrame(self, df):
177187
if len(df.index) > 2:
178188
dtDiff = df.index[1] - df.index[0]
179189

180-
if dtDiff.seconds == 60:
190+
if dtDiff.total_seconds() == 60:
181191
return "M1"
182-
elif dtDiff.seconds == 300:
192+
elif dtDiff.total_seconds() == 300:
183193
return "M5"
184-
elif dtDiff.seconds == 900:
194+
elif dtDiff.total_seconds() == 900:
185195
return "M15"
186-
elif dtDiff.seconds == 1800:
196+
elif dtDiff.total_seconds() == 1800:
187197
return "M30"
188-
elif dtDiff.seconds == 3600:
198+
elif dtDiff.total_seconds() == 3600:
189199
return "H1"
190-
elif dtDiff.seconds == 14400:
200+
elif dtDiff.total_seconds() == 14400:
191201
return "H4"
192-
elif dtDiff.seconds == 86400:
202+
elif dtDiff.total_seconds() == 86400:
193203
return "D"
194-
elif dtDiff.seconds == 604800:
204+
elif dtDiff.total_seconds() == 604800:
195205
return "W"
196206

197207
pass

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy