get_history request failed

Moderator: Moderator

get_history request failed

Postby donggua1 » Wed Nov 23, 2022 11:53 pm

Hello,
for getting history data, I try to running the following example code but received the error:

Exception: QuotesManager error: HTTP request failed object='/pricearchive/catalog.xml' errorCode=400 code: QuotesServerConnectionError subcode: 400

I'm a bit confuse with that, is there any mistakes I have made in the code?
Code: Select all
def session_status_changed(session: fxcorepy.O2GSession,
                           status: fxcorepy.AO2GSessionStatus.O2GSessionStatus):
    print("Trading session status: " + str(status))


def main():
    with ForexConnect() as fx:
        try:
            fx.login(str_user_id, str_password, "fxcorporate.com/Hosts.jsp",
                     "Demo", session_status_callback=session_status_changed)
            history = fx.get_history("AUD/USD", "m15",
                                     datetime.datetime.strptime("11.22.2022 00:00:00", '%m.%d.%Y %H:%M:%S').replace(
                                         tzinfo=datetime.timezone.utc),
                                     datetime.datetime.strptime("11.23.2022 00:00:00", '%m.%d.%Y %H:%M:%S').replace(
                                         tzinfo=datetime.timezone.utc))
            np.savetxt(data_file, history, delimiter=",")

            print("Date, Bid, Ask")
            for row in history:
                print("{0:s}, {1:,.5f}, {2:,.5f}".format(
                    pd.to_datetime(str(row['Date'])).strftime('%m.%d.%Y %H:%M:%S.%f'), row['Bid'], row['Ask']))
                    # row['BidLow'], row['BidClose'], row['Volume']))

        except Exception as e:
            print("Exception: " + str(e))

        try:
            fx.logout()
        except Exception as e:
            print("Exception: " + str(e))


if __name__ == "__main__":
    main()

Thanks a lot for the patient helping.
donggua1
 
Posts: 2
Joined: Wed Nov 23, 2022 11:11 pm

Re: get_history request failed

Postby joekairouz » Tue Jan 31, 2023 10:14 am

I am new to the fxconnectapi and I am getting the same error. Did you figure out what was wrong?
joekairouz
 
Posts: 2
Joined: Tue Jan 31, 2023 10:12 am

Re: get_history request failed

Postby shaun2344 » Fri Apr 07, 2023 3:15 am

I am also having the same issue, is there a solution?
shaun2344
 
Posts: 1
Joined: Fri Apr 07, 2023 3:13 am


Return to ForexConnect-Python API

Who is online

Users browsing this forum: No registered users and 3 guests