Skip to main content

Using Python to Analyse Financial Markets

  • Chapter
  • First Online:
Novel Methods in Computational Finance

Part of the book series: Mathematics in Industry ((TECMI,volume 25))

  • 2648 Accesses

Abstract

In this chapter we discuss the benefits of using Python to analyse financial markets. We discuss the parallels between the stages involved in solving a generalised data science problem, and the specific case of developing trading strategies. We outline the general stages of developing a trading strategy. We briefly describe how open source Python libraries finmarketpy, findatapy and chartpy aim to tackle each of these specific stages. In particular, we discuss how abstraction can be used to help generate clean code for developing trading strategies, without the low level details of data collection and data visualisation. Later, we give Python code examples to show how we can download market data, analyse it, and how to present the results using visualisations. We also give an example of how to implement a backtest for a simple trend following trading strategy in Python using finmarketpy.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 139.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 179.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 179.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. arctic: High performance datastore for time series and tick data. http://github.com/manahl/arctic

  2. BLPAPI: Bloomberg market data library. https://www.bloomberglabs.com/api/libraries/

  3. bokeh: Python interactive visualization library. http://bokeh.pydata.org/en/latest/

  4. chartpy: Python data visualisation library. http://www.github.com/cuemacro/chartpy

  5. Cython C: Extensions for python. http://www.cython.org

  6. findatapy: Python finanical data library. http://www.github.com/cuemacro/findatapy

  7. finmarketpy: Python financial trading library. http://www.github.com/cuemacro/finmarketpy

  8. flask: Micro web framework. http://flask.pocoo.org

  9. IPython: Enhanced interactive console. http://www.ipython.org

  10. matplotlib: Python plotting library. http://www.matplotlib.org

  11. NumPy: Package for scientific computing with Python. http://www.numpy.org

  12. pandas: Python data analysis library. http://pandas.pydata.org

  13. ploty: Collaboration platform for modern data science. http://plot.ly

  14. PyMC3: Probabilistic programming in python. http://github.com/pymc-devs/pymc3

  15. Quandl: Market data API. http://www.quandl.com/

  16. scikit-learn: Machine learning in python. http://scikit-learn.org/stable/

  17. SciPy library: Fundamental library for scientific computing. https://www.scipy

  18. Sympy: Symbolic mathematics. http://www.sympy.org/en/index.html

  19. TensorFlow: Open source library for machine intelligence. https://www.tensorflow.org

  20. xlwings: Python for excel. http://www.xlwings.org/

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Saeed Amen .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this chapter

Cite this chapter

Amen, S. (2017). Using Python to Analyse Financial Markets. In: Ehrhardt, M., Günther, M., ter Maten, E. (eds) Novel Methods in Computational Finance. Mathematics in Industry(), vol 25. Springer, Cham. https://doi.org/10.1007/978-3-319-61282-9_29

Download citation

Publish with us

Policies and ethics