Streaming Chart

Hi all out there!

I am trying to write an code to stream the market data (ex: EUR/USD) from FXCM in a chart using Python (Jupyter Notebook or PyCharm).

thx all!

best regards,
Matthias

Hi Matthias,

If you are using Python you can stream live data using our python wrapper, fxcmpy. The full guide for fxcmpy can be found here, but here’s a basic function for pulling live data for EURUSD into a pandas dataframe:

con.subscribe_market_data(‘EUR/USD’)
con.get_prices(‘EUR/USD’)

To create an iterable object, use the following commands:
def print_data(data, dataframe):
print(’%3d | %s | %s, %s, %s, %s, %s’
% (len(dataframe), data[‘Symbol’],
pd.to_datetime(int(data[‘Updated’]), unit=‘ms’),
data[‘Rates’][0], data[‘Rates’][1], data[‘Rates’][2],
data[‘Rates’][3]))
con.subscribe_market_data(‘EUR/USD’, (print_data,))

For creating candlestick charts, I’ve seen a few people post about Bokeh, but haven’t had a chance to try it myself yet. Here’s an example from their documentation using MSFT stock data: https://bokeh.pydata.org/en/latest/docs/gallery/candlestick.html

1 Like