neka-nat / python-forexconnect

Python binding of forexconnect api
39 stars 24 forks source link

Adding more of FXCMs API options. #16

Closed JamesKBowler closed 6 years ago

JamesKBowler commented 6 years ago

Hi Neka,

Please could you add in getLastBarTime () ? Do you have some spare time to do this?

http://fxcodebase.com/bin/forexconnect/1.4.1/help/CPlusPlus/web-content.html#IO2GMarketDataSnapshotResponseReader.getLastBarTime.html

I was looking at this one, but I think your python implementation supports Linux newer API etc.

https://github.com/tomas-rampas/forex-connect-py

Regards

James

JamesKBowler commented 6 years ago

Hi Neka, Thank you for labelling this as an enhancement. Just wondering if you have managed to look into getLastBarTime () ?

Regards

James

neka-nat commented 6 years ago

Hi. I added a function, get_last_bar_time(). Please try to use it.

Regards, nake-nat

JamesKBowler commented 6 years ago

Thanks Neka! But I am not sure what arguments I need to pass through?


In [32]: fxc.get_last_bar_time()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-32-90946dbb2daa> in <module>()
----> 1 fxc.get_last_bar_time()

IndexError: Year is out of valid range: 1400..10000

Can you provide a sample, please.

Regards

James

JamesKBowler commented 6 years ago

Hi Neka - I cant get this feature to work. Please could you assist with an example - Thankyou James

neka-nat commented 6 years ago

I modified getLastBarTime. After the modification, the return value of get_historical_prices contains lastBarTime.

data, last_var_time = client.get_historical_prices(instrument,
                                                   datetime.datetime.now() - datetime.timedelta(days = 7),
                                                   datetime.datetime.now())
JamesKBowler commented 6 years ago

Hi Neka, Thank you for your time on this, although I have misunderstood what getLastBarTime() actually is and lead you down the rabbit hole. My apologies.

I was looking for last finished bar published by FXCM, because I did not want any bars returning that have not be completed.

Thanks again will close this now.

James