Coding basics:
Flow charts

Why flow charts?

  • thinking ahead:
    • develop the logic of your code
    • catch logic flaws early

Components of flow charts

Start

Stop

Comment

Process

no

yes

input/output

Example: VWAP coding

  • Our task: trade 50,000 shares according to a volume distribution
    • Step 1: Determine Volume distribution
    • Step 2: Decide what to trade when
    • Step 3: Write a code that submits trades for you

Example: VWAP coding

  • Submit an order
    • of a specific size
    • during a specific time interval

Fundamentally, what does the code have to do?

Example 1: VWAP coding FlowChart

Start

Loop through 39 trades; counter \(i\)

Submit the trade for interval \(i\) 

Loop through the day

  • 300 seconds represent 6.5 hours
  • \(\Rightarrow\) 7.7 seconds \(=\) 10 minutes
  • \(\Rightarrow\) submit a trade every 7.7 seconds
  • \(\Rightarrow\) use an internal time of sorts

Wait for 7.7 seconds

Stop

Example 2: VWAP coding FlowChart

Start

Stop

Set starting interval

no

yes

is
0<time<300?

is
time \(\in\)
interval?

Submit order for that interval

yes

Increase interval

no

MGT435: Flow charts

By Andreas Park

MGT435: Flow charts

A very brief intro to flow charts and how they can help you organize your code

  • 692