参考までにこのくらいのコード量で自動売買はできるみたいよ。

http://blog.clock-up.jp/entry/2016/12/20/bitflyer-auto-trade