Skip to content

Commit

Permalink
fxcmpy v1.2.1:
Browse files Browse the repository at this point in the history
subscribing to price updates adds snapshot to price collection. no need to
wait for first update anymore
  • Loading branch information
fxcm-pguz committed Jan 22, 2019
1 parent 98cf8b4 commit 0c61117
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion fxcmpy/fxcmpy/fxcmpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,14 @@ def subscribe_market_data(self, symbol='', add_callbacks=()):
self.add_callbacks[symbol][func.__name__] = func

params = {'pairs': symbol}
self.__handle_request__(method='subscribe', params=params,
data = self.__handle_request__(method='subscribe', params=params,
protocol='post')
if symbol not in self.prices:
data = data['pairs'][0]
date = pd.to_datetime(int(data['Updated']), unit='ms')
self.prices[symbol] = pd.DataFrame([data['Rates'][0:4]],
columns=['Bid', 'Ask', 'High', 'Low'],
index=[date])
self.socket.on(symbol, self.__on_price_update__)

def subscribe_data_model(self, model='', add_callbacks=()):
Expand Down
2 changes: 1 addition & 1 deletion fxcmpy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def readme():
setup(
name = 'fxcmpy',
packages = ['fxcmpy'], # this must be the same as the name above
version = '1.2.0',
version = '1.2.1',
description = 'A Python Wrapper Class for the RESTful API as provided by FXCM Forex Capital Markets Ltd.',
long_description = readme(),
author = 'FXCM API',
Expand Down

0 comments on commit 0c61117

Please sign in to comment.