How do I connect python to a trading software? How do I set the position of closing positions?
Thank you so much!
Reply content:
I know what you mean, you just want to find a software or broker interface to upload trading instructions, your previous data capture and analysis may have been written by Python, so poor this trade instruction interface last step. For the stock of retail, the formal way is Warburg, Guo Xin, Societe Generale is willing to give the interface of the broker, but it seems that the account fee is well paid to this right, and only lts,ctp such a C + + interface, no Python version you need your own encapsulation. There are wind such software also has a direct interface, support some brokers, but also expensive, tens of thousands of a year is to, the third is to go wild way, mouse Keyboard simulation method, very complex, is to simulate keyboard and mouse to operate some software, such as the brokerage version of trading software and big wisdom and so on. There is a more wild way, is to find the software of the underlying code of the trading instructions and changes, I Baidu see, do not know if it is really feasible. In this way, there is no money to rely on technology, but I think t+1 rules, the importance of prediction accuracy is higher than the timeliness of trading, take the time to do data analysis is good, the transaction is done manually. If it is futures, you can use the CTP interface, support the domestic futures exchanges, there is open source support for Python pyctp.
Stock, Warburg Securities has a stock CTP, but may not have a ready-made Python interface. / http quantopian.com
Do not know whether the wall is not the probability of the Fry method:
The following method to buy up not to buy a fall, while avoiding quilt cover, shortcomings, high fees, but can completely eat the whole bull market, bear will not quilt.
Use Python to get stock prices, such as Tushare, if the stock day gains on the market (2 points 30 to 2 points 50 judgment), buy hold one day, fall the same day do not buy, you can use the probability method, according to the funds at the same time holding 5, 10 or 20, so not afraid of the impact of the stop disk, Can theoretically run to win the market. Benefits: Avoid the human impulse, the drawback high fee
There is also the operation of ETFs, such as the market 50etf,etf300, SME Board ETF, gem ETF, 2.30 points on the day to judge that ETF rose buy that, buy the biggest gains, do not rise what do not buy, hold one day, the next morning to judge if it fell more than 2% sold. Benefits: Do not tread on landmines, shortcomings: up with the market, I would recommend this method, the peripheral risk is relatively small.
Specific Python program I have, more complex than above, there is a stop loss level, money management, monitoring management, I used in the firm, the automated order has also been resolved.
I think the success of the program is not a day of work, in the long-term stable money, such as running 10 years, too much data analysis is meaningless, because the prediction of the future is always a probability problem, not absolutely sure, if your program can be in a long time to win over the market, your program can tend to the large number theorem.
Otherwise, a momentary drawdown will let you stop the program from executing automatically, rather than tending to the stability probability in the large number theorem.
If a program can be 99 OK, then basically is the analysis of insider trading data, and Xu X, every time a stock, this technique should be the insider, there is no need for any program to trade.
Buffett's trading model is actually a kind of insider trading, because he relies on the external analysis, field inspection, it is estimated that this is the means to find the insider, now bigger, this effect is not spiritual, the income also fell, the U.S. economy has slipped, so Buffett's future is bound to be bleak, because the pool of insider trading is limited, The amount of money is not good operation.
Think if Fitsen in the Soviet Union, India, Japan and other countries, he may be on the street begging, the United States after the Second World War economic environment and the trend of the insider made him, rather than the stock technology has many gods. So Buffett disdained programmatic trading.
Buffett and a lot of American-style Warren are actually caused by the survivor bias, do you think the Soviet Warren is there? Why not one of them? ("Silent Data", "dead Man Can't Speak")
I think the future can really become Warren must be a program, not a person, because a good program strategy can be used for a lifetime, to achieve long-term stable growth, of course, if the social and economic environment is stable, will not appear similar to the Soviet turmoil, there will not be a Japanese-style hyperinflation (M2 a little worried about the currency).
Too many stocks let investors immersed in the stock selection of the game every day, stock selection created the securities market software, in fact, a lot of data is useless,
all the key is to follow the method of operation forever to tend to the stability probability, or today for a new way tomorrow, according to KDJ, tomorrow according to the MACD, the day after, according to Boll, after the day after the next, greatly according to the self-compiled indicators, multi-conditional stock selection, the last money to pay fees or stop loss is not in time. At this point the Brokerage Commission to achieve the purpose of the annual brokerage commission than the stock market dividends higher. No matter how the market, as long as more than a few stock analysts, always have the direction to say, play a probability game so that we frequently trade, the brokerage's income will only increase will not fall. So do not believe stock analysts, play is the probability of the game, as the positive and negative prediction of coins, please 10 stock Analysts division must have a can predict three times the right God stock analysts. You believe this god stock analysts, the back may be three times are not allowed, hehe. So brokers and quotes software always pop up a variety of messages or reviews during the closing or lunch break, saying that this stuff is not worth a penny. May have written up the argument is module A, the saying is template B, ping Shi is the template C, just fill in the day data can be, are stereotyped writing, are hindsight, the same incident morning said to be the reason for the rise, the afternoon is said to be the reason for the fall.
Program strategy after testing the key lies in the stability of implementation, long-term stability, long-term stable and stable execution, the important thing to say three times.
In addition, a certain way to reduce the handling fee can also make your money to live longer, such as the above day model changed to weeks or months. You're asking for connectivity code. Typically Java, c/s + + code. Python is seldom seen. In fact, in terms of efficiency, Python is not the best choice for writing connectivity code. What do you want to do, docking is not the direct broker client, but the broker's automated trading instruction gateway, generally the most common use is fix, At present, the domestic version of the letter seems to be the highest, can support the financing margin.
Futures end with CTP, or Pegasus
Of course the spot first you have to have Level2 market access, this simple.
If you are chasing speed, use C + +, if it's just a simple algorithm and signal recognition, Python or R has a relatively simple library. Stocks generally require brokers to provide an interface, individuals are difficult to get account.
Futures more convenient, direct CTP.