Tuesday, June 29, 2010

Broker's High Frequency Trading (HFT) Algorithm

OK, this one is largely from my own imagination. However it was triggered by a real-life situation when I was programming against a broker's API, I was given program samples where the trading strategy works on a *very* fast timeframe (hell lots of commissions for them), a few seconds bars! Enjoy!


Link: Python Code Style (PEP 8)

If you want to try the algo at home:
class BrokerHFTAlgo:
def on_tick(self, tick):
try:
order = buy(100000)
order.wait_until_filled()
order.close()
except MarginCall:
send_mail("insert coin.")
view raw gistfile1.pyw hosted with ❤ by GitHub


Forex Trading
Value Investing

Tuesday, June 15, 2010

CLI Trading Platform

This one is for command-line die hard fans. Ever imagined a command-line trading platform? I did, and this is what it looked like to me. Discover how hedging, TP miss, SL hunt and margin calls are handled.