Slide 1

Slide 1 text

ALGORITHMIC TRADING FOR FUN AND PROFIT

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

DISCLAIMERS This talk is intended for educational purposes only This talk is not a demonstration of how to trade This talk is not intended as investment advice and must not be relied upon

Slide 4

Slide 4 text

WHAT IS ALGORITHMIC TRADING? “The use of a predefined set of rules written into computer code to automate the process of buying or selling.” - AutomatedTrader.net

Slide 5

Slide 5 text

ALGORITHMIC TRADING PROCESS 1. Formulate objective and hypothesis 2. Develop trading strategy 3. Backtesting with historical data 4. Measure and optimize 5. Deploy to production

Slide 6

Slide 6 text

FEEDER Fetch financial data feed from external sources

Slide 7

Slide 7 text

FEEDER - DATA SOURCES Free Commercial 1. Yahoo/Google Finance 2. Quandl 3. Twitter/StockTwits 1. DTN IQFeed 2. QuantQuote 3. EODData

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

TYPHOEUS + CSV/JSON/NOKOGIRI

Slide 11

Slide 11 text

STRATEGY Take market data as input and generate trading signals as output based on the rules defined

Slide 12

Slide 12 text

STRATEGY - ANALYSIS TECHNIQUES Fundamental Technical News Sentiment

Slide 13

Slide 13 text

Red line - Fast Moving Average (15 days) Green line - Slow Moving Average (50 days) Technical Indicators

Slide 14

Slide 14 text

def moving_average bars, lookback_period if bars.length < lookback_period raise "insufficient number of bars" end sum_of_prices = bars.last(lookback_period) .inject(0.0) { |sum, bar| sum + bar[:adj_close].to_f } sum_of_prices / lookback_period end fast_ma = moving_average bars, 15 slow_ma = moving_average bars, 50

Slide 15

Slide 15 text

Fast MA > Slow MA = Long Signal (Uptrend) Fast MA < Slow MA = Short Signal (Downtrend) Moving Average Crossover

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

PORTFOLIO Make trading decisions based on signals generated by strategy Keep track of cash, market positions and holdings Assess returns and risks

Slide 18

Slide 18 text

BROKER Execute trade by placing order in the market Notify Portfolio when order gets filled

Slide 19

Slide 19 text

THE LOOPS loop do # Feeder gets next bar break if bar.nil? loop do # Dequeue from event queue break if event.nil? case event.type when :market # Strategy analyzes market data # Portfolio updates holdings when :signal # Portfolio places order when :order # Broker executes order when :fill # Portfolio updates holdings end end

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

INTRODUCING HOMMA https://github.com/sushengloong/homma

Slide 22

Slide 22 text

THANK YOU <3