How does a Python wrapper simplify the process of coding an algo?

Python is one of many programming languages used by algo traders to create a trading strategy. A Python wrapper simplifies a function into a much shorter expression that can be used repeatedly. When programming a trading strategy, one may need to use the same function or series of functions repeatedly, for example to authenticate login credentials, to pull live data, or to place a trade.

Fxcmpy can easily be installed using pip. Once installed, the user will need to obtain an API token for authentication.Once obtained, connection to the REST API can be established in a single line of code:

con = fxcmpy.fxcmpy(config_file='fxcm.cfg', sever='demo')

Once connected, one can begin using the fxcmpy Python wrapper to pull historical and live prices, set entry orders, execute trades and more. Historical data can be pulled in the periods 'm1', 'm5', 'm15', 'm30', 'H1', 'H2', 'H3', 'H4', 'H6', 'H8′,'D1', 'W1' or 'M1' using a single line of code. For example, entering the following line of code will output the high, low, open and close price of the EUR/USD for the past 30 one-minute candles.

data = con.get_candles('EUR/USD', period = 'm1', number = 30)

To create a basic market order, you will provide the instrument and the size of the order (in micro lots) as parameters to either the create_market_sell_order() or create_market_buy_order() methods:

con.create_market_buy_order('USD/JPY', 10)

These are just some of the commands available for use.

FXCM Research Team

FXCM Research Team consists of a number of FXCM's Market and Product Specialists.

Articles published by FXCM Research Team generally have numerous contributors and aim to provide general Educational and Informative content on Market News and Products.

${getInstrumentData.name} / ${getInstrumentData.ticker} /

Exchange: ${getInstrumentData.exchange}

${getInstrumentData.bid} ${getInstrumentData.divCcy} ${getInstrumentData.priceChange} (${getInstrumentData.percentChange}%) ${getInstrumentData.priceChange} (${getInstrumentData.percentChange}%)

${getInstrumentData.oneYearLow} 52/wk Range ${getInstrumentData.oneYearHigh}
Disclosure

Any opinions, news, research, analyses, prices, other information, or links to third-party sites contained on this website are provided on an "as-is" basis, as general market commentary and do not constitute investment advice. The market commentary has not been prepared in accordance with legal requirements designed to promote the independence of investment research, and it is therefore not subject to any prohibition on dealing ahead of dissemination. Although this commentary is not produced by an independent source, FXCM takes all sufficient steps to eliminate or prevent any conflicts of interests arising out of the production and dissemination of this communication. The employees of FXCM commit to acting in the clients' best interests and represent their views without misleading, deceiving, or otherwise impairing the clients' ability to make informed investment decisions. For more information about the FXCM's internal organizational and administrative arrangements for the prevention of conflicts, please refer to the Firms' Managing Conflicts Policy. Please ensure that you read and understand our Full Disclaimer and Liability provision concerning the foregoing Information, which can be accessed here.

Past Performance: Past Performance is not an indicator of future results.

Spreads Widget: When static spreads are displayed, the figures reflect a time-stamped snapshot as of when the market closes. Spreads are variable and are subject to delay. Single Share prices are subject to a 15 minute delay. The spread figures are for informational purposes only. FXCM is not liable for errors, omissions or delays, or for actions relying on this information.