共计 1397 个字符,预计需要花费 4 分钟才能阅读完成。
Quantitative trading strategies – Trading Assignment 4 – distributed 11/2/21,
due 11/23/21
You will design an execution algorithm that uses order book data to beat a TWAP
algorithm, i.e. an algorithm that sells 100 shares every 50 quotes.
Collect the data – 2pts
• Install ib insync package via pip or pip3 (e.g.”pip install ib insync”)
• Download and install latest TWS application (not stable) from the interactive brokers
website
• Open TWS, log in with your IB account, open File – Global Configuration – API
- Settings, make sure the”Enable ActiveX and Socket Clients”option is activated
and the Socket port is 7496 by default. This step can be found here,”Enable API
connections”part.
• Open the ib insynch-template.ibynb notebook. When TWS is open, run the first cell
in notebook to set up connection, then run other cells.
• Run the notebook for at least 2 hours to create a file with quotes for SDS and SH
• You should upload a data file named netID.csv
Write the algorithm – 6pts
• Calculate the average price obtained from a TWAP algorithm that sell 100 share of
SDS at the bid at the end of every 50 quotes.
• Write a”smart algo”that has the option to sell earlier in each 50 quotes interval,
based on the value of the imbalance and spread. Express the over/under performance
of your algorithm
• Do the same for a TWAP algorithm that buys 100 shares of SDS at the ask, vs your
”smart algo”that can buy earlier in each 50 quotes interval.
• Write a function called smartalgo, that takes in a file name and outputs the average
buy minus the average sell price
Performance – 2pts
We will run your algorithm on all submitted data files and determine which algorithm
minimizes the output.
正文完