Skip to content

Commit

Permalink
fix calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
traderpedroso committed Sep 19, 2022
1 parent fffa545 commit f91a944
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions ejtraderMT/api/mql.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,19 @@ def __init__(self, host=None, real_volume=None, tz_local=None, dbtype=None,dbhos
def balance(self):
return self.__api.Command(action="BALANCE")

def calender(self,symbol,fromDate,toDate):
df = self.__api.Command(action="CALENDAR", actionType="DATA", symbol=symbol,
fromDate=self.__date_to_timestamp(fromDate), toDate=self.__date_to_timestamp(toDate))
df = pd.DataFrame(df['data'])
df.columns = ['date','currency', 'impact','event','country','actual','forecast','previous']
df['date'] = pd.to_datetime(df['date'], errors='coerce')
df = df.dropna(subset=['date'])
df = df.set_index('date')
df.index = pd.to_datetime(df.index)
def calendar(self,symbol=None, fromDate=None, toDate=None):
try:
df = self.__api.Command(action="CALENDAR", actionType="DATA", symbol=None,
fromDate=self.__date_to_timestamp(fromDate), toDate=self.__date_to_timestamp(toDate))
df = pd.DataFrame(df['data'])
df.columns = ['date','currency', 'impact','event','country','actual','forecast','previous']
df['date'] = pd.to_datetime(df['date'], errors='coerce')
df = df.dropna(subset=['date'])
df = df.set_index('date')
df.index = pd.to_datetime(df.index)
except:
pass

return df


Expand Down

0 comments on commit f91a944

Please sign in to comment.