Tips On Getting Started In Python

Discussion in 'App Development' started by tommo, Sep 11, 2016.

  1. It sounds like you're talking about two things. First is back-testing tick data and second is placing orders/interacting with your broker via API.

    Before deciding on a language, see what your broker has available. What API/Samples do they have built and what can you get up and running on with minimal time and effort. If you've used Tradestation/CQG you should have no problem placing orders and getting data and should be able to code up a system in relatively short order.

    Back-testing tick data is a more difficult problem imo and isn't so much a language problem as much as how you're going to organize and create your infrastructure to clean and access the data.
     
    #21     Sep 12, 2016
  2. tommo

    tommo

    Thanks Soon2Bgreat.

    That makes sense. The execution isn't really an issue. There's a few options I can setup for that.

    It's backtesting strategies that are my priority.

    I trade on cqg and have tons of data from them and it's clean. But it's just in bar form not tick data. So guess tick data strategies are out of my scope for now. But can construct sub minute bars easily enough.

    I just want an environment that is friendly to an experienced trader but and inexperienced coder but would rather put in a bit of extra work and learn Python as a general life skill rather than stick with cqg or tradestations language which is useless in the real world
     
    #22     Sep 12, 2016
  3. #23     Sep 12, 2016
  4. ^

    What is the meaning behind your user name? Usually quotes are motivational or feel good...this is quite harsh.


    Deuteronomy 24:7New International Version (NIV)

    If someone is caught kidnapping a fellow Israelite and treating or selling them as a slave, the kidnapper must die. You must purge the evil from among you.
     
    #24     Sep 12, 2016
  5. 2rosy

    2rosy

  6. lovethetrade

    lovethetrade Guest

    There's iOS/Android apps that are quite good also. I'm not a programmer by trade but I learned the basics of C++ and Python this way. I think the developer is called Sololearn.
     
    #26     Sep 12, 2016
    tommo likes this.
  7. 1) use a bundled Python like Anaconda, it is easy to install and almost all needed packages are included, especially when you are using Windows.
    2) Use Jupyter Notebook as your development environment instead of Notepad++, because you can execute one line after the other and see the effects, very beneficial for beginners
    3) Remember that you want to solve trading problems and use the language as a tool like (Excel or whatever), therefore just dive in in your backtesting after a very short introduction into python. Don't think too much about the "perfect" program - just put the pieces (libraries) together.
     
    #27     Sep 15, 2016
    Simples and tommo like this.
  8. You are already following the Codeacademy Python course so I will only mention the "Automate the Boring Stuff with Python Programming" course in passing. Note the 50% discount coupon in the URL. It's only $25, has 51 lectures and 9.5 hours of video. There is also a free online book available. You can donate $5 if you use the online book. This weekend you can buy the PDF eBook at 50% off. This is the format I prefer. The checkout code is JUSTBECAUSE. What I like about the book is it shows you how to work with Excel, PDF, and CSV files, emails, web scraping, etc... It is based on Python 3. The author is popular and was interviewed on a podcast. There are 75 other podcasts.

    I believe you can use the Interactive Brokers API with Python. Here is another tutorial. IBPy might be based on Python 2.x. You will need to look into this. Python is slower than other languages. However, I believe you can improve performance by compiling and other methods. Continuum Anaconda Python is good because it manages all the Python packages.

    The problem with using Python or any other programming language is how do you obtain the real-time data (without IB) and how do you obtain the standard charting and trading functions? Just as an example, how would you create a program to buy when the 50 5-minute bar exponential moving average crosses above the 200 emoving ave? Are there available Python functions for this or must you build these from scratch? Must you pay for them? What about a Walk-Forward Optimizer? Many people think it is easy to program. However, a Walk-Forward Optimizer has an In-Sample and Out-Of-Sample.

    IMHO, by the time you build a working system, it could be years from now. I agree, C++ is difficult to program. Have you tried the built-in TradeStation Objects such as Price Series Provider? TS is not an open standard but at least you can create something over a few weeks that functions.
     
    #28     Sep 17, 2016
  9. jj90

    jj90

    While I agree on the need to use the right tool for the job, the above poster ^ is selling his service(tradestation). I coded my system up in 5 months on a part time project basis using only numpy, pandas, google and stackoverflow. I only knew basic OOP then.

    For an IDE: I use Pycharms community edition.
     
    #29     Sep 18, 2016
  10. gaihosa

    gaihosa

    I have written some programs to screen stocks. Nothing that would actually place a trade but rather just to sort data in a manner that any other service could not provide. I have written in Java, Python, Qt.

    Java:
    It's been a years since I have used Java. I found it to be slow and require too many try/catch statements. The pre-made packages are always limited so I decided to move on. Also at the time I looked at bench make times for program languages and Java turned out to be the slowest. Also it seams to change with every release which is pretty much annually and you end up updating your code.

    Python:
    Going back to when I last looked at bench mark times, Python was in the middle of the list. You can build code pretty fast. Again I found it to be to slow. Also the pre-made library Matplotlib, in my opinion makes ugly unlegible charts.

    Qt (c++ pre-made library)
    The best so far and by far. I find it fast, lighten fast in comparison to other languages hence it is c++ based which means you will have to get familiar with pointers and header files and other characteristics of the c++ language. According the the bench mark times it was the fastest and so far for me it is! I did have to do some thinking in some situations but it wasn't the bad. Great charts, lots of GUI objects and listeners are very easy to work with once you get the hang of connecting signal and slots. Qt creator allows you to build your program visually. Qt Creator is a light, fast, simple, ergonomic programming environment. End of the day, Qt is the best I have found as far as stand alone apps go.

    At the end of the day as someone else had posted it all comes down to experience. I have been programming for 16 years now off and on pretty much for my own purposes. As you gain experience you'll learn what works best for which situation. Experience is the key no so much the language.
     
    #30     Oct 1, 2016
    931 likes this.