PyAlgoTrade - An excellent open source python library

TracerBullet

Well-Known Member
#31
Before I forget, I want to add another scenario with PyAlgoTrade.

1) Consider I am looking at Daily time frame to develop a bias. So I have a bunch of stocks (say 50 from nifty), that I will * scan as as the market opens. Our Algo will always be in ** trade either Sell or Buy and we will be having a SL for each of the 50 stocks. So we have 50 stocks with a SL price.

2) Then algo monitors the 50 scripts on which one is getting close to the SL. Once one of the 50 stocks have reached SL, then we have 2 decisions to make either Buy or Sell. If for example buy SL is hit then we have a very low risk Buy trade on hand. Or we have a new confirmed down trend started.

3) If you consider such strategy its very tiring to do manually. All we need here is a stock with a higher probability of success for intraday play. Once we are in then its upto us to come out green.

How is the idea?

* Scan means not manually one by one like mentioned in the beginning of the thread. But in a one long program loop that checks continuously without needing our manual intervention for each instrument.
** Trade means tester trade not real. Like the one displayed in the beginning of this thread.
There is no strategy in above, from what i understood once price reaches some place you want to decide between Buy and Sell. I guess that will be done manually from shortlisted stocks. Doing it in python is cool, same can be done in AB as well ( see exploration ). So its good, you have some criteria to search for stocks and then focus on them
 

lemondew

Well-Known Member
#32
Downloaded free trial version of interactive brokers. Too many options difficult to understand.

Combination orders and many types of orders/algos not available for nse in IB. Their initial support doesnt seem to be good. Their sales rep hasnt been able to explain much.

In short it isnt very easy to find way in IB as well.

Yes TB,

I am considering ib. In talk with them. Writing an application is one part. The system/connection availability plus speed will also be a factor. To deal with powercuts/internet connection failure and so on investing in backup plus high speed internet. Checking with IB see what can be done and how they fare ratewise.
 

TracerBullet

Well-Known Member
#33
Downloaded free trial version of interactive brokers. Too many options difficult to understand.

Combination orders and many types of orders/algos not available for nse in IB. Their initial support doesnt seem to be good. Their sales rep hasnt been able to explain much.

In short it isnt very easy to find way in IB as well.
As long as ordering api is available, we can do them on our own. It should be much simpler and better than ahk stuff .. Anyway no point in using IB during learning phase
 

lemondew

Well-Known Member
#34
Ok called their support phone no and got releavant info. The previous sales rep wasnt too helpful. Seems like he himself need to know a thing or two about what IB offers

Heres the info
: They provide the APi free to all users( yes free)
https://www.interactivebrokers.com/en/software/api/api.htm


India Commissions:

NSE Stocks : 0.05% of the trade value
NSE Futures : 0.01% of the trade value
NSE Index Options : INR 15 per board lot per side
NSE Stock Options : INR 25 per board lot per side

Considering API is free the commissions are not much if you dont do a lot of trades per month (for swing traders)

Minimum balance is 2000 USD.....

As long as ordering api is available, we can do them on our own. It should be much simpler and better than ahk stuff .. Anyway no point in using IB during learning phase
 
Last edited:
#35
HI,
As kind of novice in coding etc, can I ask...
does this API provided by a broker fetch/extract data, fire orders to exchange from an application run by us. And the application may be set up to generate rule/system based signals.
Would this be kind of Algo-trading and need some exchange permissions.
What would be the granularity of data.

Thanks
 

lemondew

Well-Known Member
#36
You connect to exchange thru IB gateway or TWS Check this

https://www.interactivebrokers.com/en/software/api/api.htm

For the second part you check with them.

If you want to quickly get started. Download the API. The APi has sample for ordering in excel, Cpp,csharp,java,vb.

HI,
As kind of novice in coding etc, can I ask...
does this API provided by a broker fetch/extract data, fire orders to exchange from an application run by us. And the application may be set up to generate rule/system based signals.
Would this be kind of Algo-trading and need some exchange permissions.
What would be the granularity of data.

Thanks
 
#37
mutualguru,

Amibroker/AFL works on chart-based trading model and is suited for those who can understand things better when price is visualized as graph.

Those who like to see data in series of numbers in excel like sheet may prefer other methods....

Do not fall for bullshit (and do not spread either) that AFL is used for naive and non-programmers whereas python is used by quant. Both are interpreted and underlying library for both of them is written in C and C++. Both will continue to evolve until it becomes too big to manage by one person.

Being Open Source is not always a positive thing. It is often a liability that no one really absorbs.

They both are two different approaches to analysis ... just because one small subset of people prefers python over other approaches does not make python better.

Both of them have serious learning curve and neither one is easy. In city like Bengaluru, you can find AFL training course in 25000 to 50000 (or even less) but quant training will be in upwards of 1.5 lakh.

One can write rotten buggy code in python just as easily as one can write in AFL or C++ or C#

Calling one programming language easy relative to other is a pure marketting gimmick .... Same as Pepsi/Goldspot ad that says drinking Pepsi or Goldspot attracts beautiful (physically) women towards you.
Dear mastermind007,

I myself am not a big fan of amibroker because its expensive( more than 25000 rs) and their are very good alternative available. I personally believe that with this steep price amibroker is looting a ordinary trader. I myself has a small capital and considers 25k as a very good amount.

Ami is built for trading and its made for non programmers in mind wheres as python is a general purpose programming language. For algo trading python is a better solution than ami because ami is slow ( its a vectorised programming languge). Amibroker also lacks many strong libraries for example machine learning.

One thing I have to agree with you is the chance of creating a buggy code (because of the programmers fault) is more likely in python than in ami. But as a free program with more control over your code and availability of numerous libraries I would definitely recommend python.

Please dont consider this as a rude or rash comment because I just want to inform other new traders who are interested in algo trading that their are other good,free alternative programs available for algotrading than ami.

If you want to find out more about using python in trading watch youtube videos especially sentdex https://www.youtube.com/watch?v=2BrpKpWwT2A and also have a look at quantopian.
 
Last edited:

mastermind007

Well-Known Member
#38
Those people who use AFL are either naive or a non porgrammer. If you are a professional quant/algo trader then they would prefer python instead of AFL.

  1. Its free
  2. Its open source
  3. Community of developers
  4. its DAMN fast

Comparing to python; AFL is nothing especially for algo trading. Most of the quant/algo traders uses python.

That said I have tried a long time ago PyAlgoTrade but I find it very complex and lack of tutorials make it much more difficult. It would be helpful if you can continue with some small sample codes.

A REQUEST: I hate classes in python can you rewrite the codes with only functions.
Dear mastermind007,

I myself am not a big fan of amibroker because its expensive( more than 25000 rs) and their are very good alternative available. I personally believe that with this steep price amibroker is looting a ordinary trader. I myself has a small capital and considers 25k as a very good amount.

Ami is built for trading and its made for non programmers in mind wheres as python is a general purpose programming language. For algo trading python is a better solution than ami because ami is slow ( its a vectorised programming languge). Amibroker also lacks many strong libraries for example machine learning.

One thing I have to agree with you is the chance of creating a buggy code (because of the programmers fault) is more likely in python than in ami. But as a free program with more control over your code and availability of numerous libraries I would definitely recommend python.

Please dont consider this as a rude or rash comment because I just want to inform other new traders who are interested in algo trading that their are other good,free alternative programs available for algotrading than ami.

If you want to find out more about using python in trading watch youtube videos especially sentdex https://www.youtube.com/watch?v=2BrpKpWwT2A and also have a look at quantopian.
mutualguru

OMG!! Your ability to argue is unbelievable!!! Between two posts, you've swung from one extreme to another and just come across as a person who wants to promote/recommend python by hook or by crook even though you seem to incompetent (by your own admission) to evaluate either one of them.

Your concern and desire to "inform other new traders" comes across like a politician championing cause of poor people during election days.

In first post, you criticised amibroker as inferior relying on fact that professional quant traders use python. Professional quants are expected to mange big funds and do spend good money on infrastructure and software. In next post, you self-identify as small trader and complain that cost of software is prohibitive.

All programming languages require some skill. Neither software is built with non-programmer in mind. It is just a marketting statement to assuage the fears. Non-programmer cannot program any language and if he learns at least one language, he is no longer a non-programmer.

Just FYI, python and amibroker support vector arithmetic. Python is a general purpose scripting language for too wide scope whereas Ami is designed for trading as serious activity.

No language can be learnt by criticising some other language. If you relish your "non-programmer" tag (for whatever reason), then at least hire someone competent who can do the work rather than blow off your trading capital.

Software programming is the only field in which every Tom, Dick and Mahadick decide to dabble and master the art (in days) which a computer engineer has spent few years to learn. Naturally, when T/D/M fails, it is fault of the platform. Aptech, NIIT and neighbourhood coaching classes actually create a very wrong impression about programming.

Amibroker does not use classes but python does. No one is going to rewrite the code to weed out classes just because you happen to hate it.

I am a computer programmer with 20 years of experience of day-to-day programming. I have worked on at least a dozen languages and handful of scrpting languages too. I've done this kind of work for my entire professional life so neither of languages faze me and it does not take lot of time for me to pick either one. In last 5 years for Algo trading, I've written fair amount of code in Ninjatrader, R and Amibroker (100+ systems overall) and also dabbled in Metastock and FCharts. I had written some text processing application in python but its been a while. I have also written one AFL that implements machine learning. So, please stop bluffing around. .

P.S. Since you carry name of mutualguru, I only hope you are not some mutual fund investment manager with history of tanked asset funds because he tried to save 25000 and programming cost and lost few crores of other people's money.
 
Last edited:
#39
mutualguru

OMG!! Your ability to argue is unbelievable!!! Between two posts, you've swung from one extreme to another and just come across as a person who wants to promote/recommend python by hook or by crook even though you seem to incompetent (by your own admission) to evaluate either one of them.

Your concern and desire to "inform other new traders" comes across like a politician championing cause of poor people during election days.

In first post, you criticised amibroker as inferior relying on fact that professional quant traders use python. Professional quants are expected to mange big funds and do spend good money on infrastructure and software. In next post, you self-identify as small trader and complain that cost of software is prohibitive.

All programming languages require some skill. Neither software is built with non-programmer in mind. It is just a marketting statement to assuage the fears. Non-programmer cannot program any language and if he learns at least one language, he is no longer a non-programmer.

Just FYI, python and amibroker support vector arithmetic. Python is a general purpose scripting language for too wide scope whereas Ami is designed for trading as serious activity.

No language can be learnt by criticising some other language. If you relish your "non-programmer" tag (for whatever reason), then at least hire someone competent who can do the work rather than blow off your trading capital.

Software programming is the only field in which every Tom, Dick and Mahadick decide to dabble and master the art (in days) which a computer engineer has spent few years to learn. Naturally, when T/D/M fails, it is fault of the platform. Aptech, NIIT and neighbourhood coaching classes actually create a very wrong impression about programming.

Amibroker does not use classes but python does. No one is going to rewrite the code to weed out classes just because you happen to hate it.

I am a computer programmer with 20 years of experience of day-to-day programming. I have worked on at least a dozen languages and handful of scrpting languages too. I've done this kind of work for my entire professional life so neither of languages faze me and it does not take lot of time for me to pick either one. In last 5 years for Algo trading, I've written fair amount of code in Ninjatrader, R and Amibroker (100+ systems overall) and also dabbled in Metastock and FCharts. I had written some text processing application in python but its been a while. I have also written one AFL that implements machine learning. So, please stop bluffing around. .

P.S. Since you carry name of mutualguru, I only hope you are not some mutual fund investment manager with history of tanked asset funds because he tried to save 25000 and programming cost and lost few crores of other people's money.
Thank you for the input. I am not a programmer but happens to love programming and myself learned and wrote programs in many languages. I love python because its free ,easy and fast and I dont gain anything from popularizing it. There are millions of other python programmers in the world who can vouch for pythons advantages. The traders can make their own independent choices for their algo trading platform. I just want to show them the advantage and disadvantages( mostly of amibroker's). This was a little heated but nice discussion and I would believe after seeing our discussion some one would have gone to internet to research more about this topic.

Once more I reiterate that python is the best platform for algo trading than amibroker.

Disclaimer: I have no hate against other programming languages except amibroker. I would even suggest java, c and c++ are much more stronger than python itself. I dislike greatly amibroker because we have to pay a very large amount to buy it and then pay more for every year upgradation, addon and what ever not; when their are other good and free alternatives available. This is my opinion alone and you are free to consult with some other people for more information.
 
Last edited:

mastermind007

Well-Known Member
#40
Thank you for the input. I am not a programmer but happens to love programming and myself learned and wrote programs in many languages. I love python because its free ,easy and fast and I dont gain anything from popularizing it. There are millions of other python programmers in the world who can vouch for pythons advantages. The traders can make their own independent choices for their algo trading platform. I just want to show them the advantage and disadvantages( mostly of amibroker's). This was a little heated but nice discussion and I would believe after seeing our discussion some one would have gone to internet to research more about this topic.

Once more I reiterate that python is the best platform for algo trading than amibroker.

Disclaimer: I have no hate against other programming languages except amibroker. I would even suggest java, c and c++ are much more stronger than python itself. I dislike greatly amibroker because we have to pay a very large amount to buy it and then pay more for every year upgradation, addon and what ever not; when their are other good and free alternatives available. This is my opinion alone and you are free to consult with some other people for more information.
Don't get married to a Stock.
Don't get married to any programming language. All higher level language are for humans and Free (or cheap) does not make anything better.
 

Similar threads