/autotrading

my glorious attempt at auto trading

Primary LanguagePython

Auto trader

The initial idea was to make a simple automated trader program. I came back from that idea and just decided to make an analyzing program that figure out which shares will be good to buy.

An initial attempt was made at https://docs.google.com/spreadsheets/d/1TeGVvRAvj7H5hvim02c_Bu7TX7oDj0edTmpZjcI5zFA/edit?usp=sharing

However google spreadsheet doesn’t deal with that many requests well. So instead we’ll just cache the results. This way we can make our own shadowing db maybe that eventually will grow bigger than the 5 years restricted by morningstar.

Current functionality

  • Scrape asx for semi realtime stock prices (Google finance is unreliable, alpha-vantage is rate limited at 1 request per second, and doesn’t allow batch requests, see the branches).
  • Get and cache key indicators from the morningstar api.
  • Produce a html table which is ordered by ‘bargains’, shares that are known to produce lots of dividend or profit (minimum of either) divided by price.

    I also played around with the IG api but it’s poorly documented (what is an EPIC for example) so the main program is in the analyze folder. just run make run.

    the html result has links to the reuters page so you can verify it’s indeed a good idea to buy. There is also a link to the anouncements page of asx.

    Note that the morningstar stuff is cached, because it takes ages to run that for the first time. I also had the idea of making an append like thing from the cached but haven’t gotten to do that.

Possible extensions.

Morining star provides a historic dividend that goes much farther back then 5 years. we can use this to calculate a much more precise anuity than just the 5 year one. EG: http://globalquote.morningstar.com/globalcomponent/RealtimeHistoricalStockData.ashx?ticker=XASX:BHP&showVol=true&dtype=his&f=d&curry=USD&range=1980-1-1|2014-10-10&isD=true&isS=true&hasF=true&ProdCode=DIRECT

Back testing to test different analises methodologies upon

thanks to /u/enginerd03 https://www.quantopian.com/

all these things

(thanks to /u/wanmoar)

  • use operating cash flow (or free cash flow) to see the payout rates. net income is an accounting measure and generally not fit for purpose
  • need to factor in price movements, dividend increases and trend in sales/cash flow/earnings. A company which has a longer history of consistent dividend increases is likely a better bargain for the same % dividend than one which has no such record or a sporadic one.
    • This seems rather obvious
  • find a way to remove the effect of debt. A company may have a very high dividend and be able to pay it out but not have enough to pay off the debt it owes. As a result, it’s dividend is high because the market expects it to be cut
    • This is a really good idea, because the opposite is also true, if a company is paying down debt agressively while not paying dividend it still may be a good investment.

you will need a whole other model to judge dividends for financials (banks, insurance etc), royalty companies and REIT’s

Encode a data driven approach??

License

AGPLV3