Skip to content

Commit

Permalink
add H4
Browse files Browse the repository at this point in the history
  • Loading branch information
InsonusK committed Jan 2, 2023
1 parent 32ce737 commit 3b4ee09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from pathlib import Path

VERSION = "1.3.1"
VERSION = "1.4.0"

file_path = os.path.join(Path('.'), "requirements.txt")
with open(file_path) as requirements_txt:
Expand Down
22 changes: 16 additions & 6 deletions src/time_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ class TimeFrame(Enum):
MINUTE15 = 5
MINUTE30 = 6
HOUR = 7
DAY = 8
WEEK = 9
MONTH = 10
HOUR4 = 8
DAY = 9
WEEK = 10
MONTH = 11

m1 = 2
m5 = 3
m10 = 4
m15 = 5
m30 = 6
H = 7
D = 8
W = 9
M = 10
H4 = 8
D = 9
W = 10
M = 11
"""
-1 self > a
0 self = a
Expand All @@ -42,6 +44,8 @@ def to_seconds(self) -> int:
return 60*30
elif self == TimeFrame.HOUR:
return 60*60
elif self == TimeFrame.HOUR4:
return 60*60*4
elif self == TimeFrame.DAY:
return 60*60*24
elif self == TimeFrame.WEEK:
Expand Down Expand Up @@ -69,6 +73,8 @@ def short_name(self) -> str:
return "m30"
elif self == TimeFrame.HOUR or self == TimeFrame.H:
return "H"
elif self == TimeFrame.HOUR4 or self == TimeFrame.H4:
return "H4"
elif self == TimeFrame.DAY or self == TimeFrame.D:
return "D"
elif self == TimeFrame.WEEK or self == TimeFrame.W:
Expand All @@ -90,6 +96,8 @@ def full_name(self) -> str:
return "Minute30"
elif self == TimeFrame.HOUR or self == TimeFrame.H:
return "Hour"
elif self == TimeFrame.HOUR4 or self == TimeFrame.H4:
return "Hour4"
elif self == TimeFrame.DAY or self == TimeFrame.D:
return "Day"
elif self == TimeFrame.WEEK or self == TimeFrame.W:
Expand Down Expand Up @@ -121,6 +129,8 @@ def parse(label: str):
return TimeFrame.MINUTE30
elif label in ('HOUR', 'H'):
return TimeFrame.HOUR
elif label in ('HOUR4', 'H4'):
return TimeFrame.HOUR4
elif label in ('DAY', 'D'):
return TimeFrame.DAY
elif label in ('WEEK', 'W'):
Expand Down

0 comments on commit 3b4ee09

Please sign in to comment.