python, ForexConnect.get_history, thread leaking

Moderator: Moderator

python, ForexConnect.get_history, thread leaking

Postby aosipov » Thu May 09, 2019 9:55 am

Hi,
I am trying to use python forexconnect package.
I noticed that every time I call get_history method, a new thread is created.
Here is the sample code:
Code: Select all
from forexconnect import fxcorepy, ForexConnect

TIME_FRAME = 'm1'
ALIGNING = fxcorepy.O2GCandleOpenPriceMode.PREVIOUS_CLOSE
FXCM_URL = 'fxcorporate.com/Hosts.jsp'


def session_status_changed(session, status):
    if status == 'DISCONNECTED':
        exit(1)

def run():
    login = <your login>
    password = <your password>
    connection = 'demo'

    with ForexConnect() as fx:
        fx.login(login, password, FXCM_URL, connection, None, None,
                 session_status_changed)
        for i in range(500):
            print(i)
            fx.get_history('EUR/USD', TIME_FRAME, None, None, 3, ALIGNING)

if __name__ == "__main__":
    run()
    input()


When the loop finishes, the python process has more than 500 threads.
Checked it with ps
Code: Select all
ps huH p <PID> | wc -l

Am I doing something wrong? Is it normal?
aosipov
 
Posts: 3
Joined: Thu May 09, 2019 9:38 am

Re: python, ForexConnect.get_history, thread leaking

Postby Konstantin.Toporov » Mon May 13, 2019 7:53 am

We will investigate
Konstantin.Toporov
FXCodeBase: Initiate
 
Posts: 110
Joined: Mon Aug 31, 2015 10:16 am

Re: python, ForexConnect.get_history, thread leaking

Postby aosipov » Thu Jun 13, 2019 4:57 am

Did you have a chance to look into it?
aosipov
 
Posts: 3
Joined: Thu May 09, 2019 9:38 am

Re: python, ForexConnect.get_history, thread leaking

Postby Konstantin.Toporov » Fri Jul 26, 2019 11:27 am

Version with the fixed issue has been released:
viewtopic.php?f=37&t=68716
Konstantin.Toporov
FXCodeBase: Initiate
 
Posts: 110
Joined: Mon Aug 31, 2015 10:16 am


Return to ForexConnect API

Who is online

Users browsing this forum: Bing [Bot] and 1 guest