#18 implementation would require more iterations on the python side, well at least for my way : )
I use __getinitargs__() which from testing is much faster than __getstate__() then convert into a numpy array instead of using pandas
def _get_data(
self, fx_session, instrument, fm_date,
to_date, time_frame, dt
):
"""
Calls FXCM for a given offer and time frame,
collects data then returns a structured Numpy array.
"""
values = fx_session.get_historical_prices(
instrument, fm_date,
to_date, time_frame)
return np.array(
[v.__getinitargs__() for v in values], dtype=dt)
Hi @neka-nat Thank-you for coming back to me.
I ran some tests on the API calling for data and I can see no real difference in performance on both implementations.
#17
#18
#18 implementation would require more iterations on the python side, well at least for my way : ) I use
__getinitargs__()
which from testing is much faster than__getstate__()
then convert into a numpy array instead of using pandasThis will return a numpy array like so.
Then the data can be manipulated about 17-20 times faster than pandas.
Best Regards
James