yugedata / Options_Data_Science
- понедельник, 15 февраля 2021 г. в 00:26:42
Python
Collecting, analyzing, visualizing & paper trading options market data
Options_Data_Science
Disclosure:
Description:
Directions:
a) create a developer account on this link. https://developer.tdameritrade.com/apis.
b) pip install td-ameritrade-python-api
c) run token_refresh.py to produce the td_state.json credentials file. YouTube video to help: skip to minute 22!! https://www.youtube.com/watch?v=8N1IxYXs4e8&t=1138s&ab_channel=SigmaCoding
d) In your working directory make a 'Data' folder * You can create SQLite files 2 ways: 1) If you want to mine data each trading day this year Run make_files.py in your working directory * Add or remove different columns in the columns_wanted array in create_files.py * Other options are in mine.py unwanted_columns array 2) If you don't want to spawn all those files first, mine.py will create its own SQLite file for that day but... The tables created in mine.py will have the columns specified in the columns_wanted array. * If you want to remove a column, cut it out of columns_wanted and paste it in columns_unwanted. * If you want to add a column, cut it out of columns_unwated and paste it in columns_wanted. * All possible columns must be accounted for in both arrays.
In the stocks array, edit this list to collect options for any stock you want
Inside the get_chain() method, 'toDate' value is a date. Change the date to pull all weekly option chains leading up to that day. Make sure the date is a Friday.
e) Run mine.py right before market opens. ~09:25 EST
After getting familiar with the mine script, refer to test_trade how where to insert your own trading logic
Future addons: