Skip to content

Analyze price quotes and trades. Output paired trades file

Notifications You must be signed in to change notification settings

letaoZ/pair-trading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pair Trading

  Analyze stock prices (quotes and trades), and find the best paired trades

Files

  1. t.txt: trades file.

    ordered by TIME

    Each row = at TIME a SYMBOL (SPY) has quote update (BID/ASK) till another price update

  2. q.txt: quotes file.

    ordered by TIME

    Each row = a ticker (say SPY) was B(ought) or S(old) at a PRICE for QUANTITY many shares. (by someone we don't know)

What we do

Search for the best opportunity to trade. i.e. buy low sell high, search for liquidity.

  setup:
  1. For buy execution: liquidity is Passive if price <= bid; is Aggressive if price >= ask
  2. For sell execution: liquidity is Passive if price >=ask; is Aggressive if price <= bid
  3. Passive = P, Aggressive = A
  trading pairs:
  1. Given any symbol, assume our starting inventory is 0. 
  2. Sell will result in decreasing inventory -- close trade
  3. When sell more than our inventory, we are in short position
  4. In our pairs trading result, we also compute the profile and loss. caused by paired trading 

About

Analyze price quotes and trades. Output paired trades file

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages