-
-
Notifications
You must be signed in to change notification settings - Fork 160
Data Feeds
Michael Chu edited this page Oct 6, 2020
·
6 revisions
Optopsy currently supports importing data directly from CSV files.
csv_data(file_path, underlying_symbol=0, underlying_price=1, option_type=2, expiration=3, quote_date=4, strike=5 bid=6, ask=7
This is a convenience function to map your CSV file to the expected internal columns for Optopsy. All integer parameters are 0-indexed, meaning '0' maps to the first column of your CSV file.
Parameters
- file_path (str, required): A string representing the relative filepath to search for the data file
- underlying_symbol (_int, optional): An integer to map the column number of the CSV file to use for the option's underlying stock symbol.
- underlying_price (int, optional): Same as above, for underlying stock price. Column should be of type float/int
- option_type (int, optional): Same as above, for underlying option type. The column must be of string type containing at least the characters 'c' or 'p' for calls/puts.
- expiration (int, optional): Same as above, for option's expiration date. Column should be parsable to datetime64[ns]
- quote_date (int, optional): Same as above, for option's quote date. Column should be parsable to datetime64[ns]
- strike (int, optional): Same as above, for option's strike price. Column should be of type float/int
- bid (int, optional): Same as above, for option's bid price. Column should be of type float/int
- ask (int, optional): Same as above, for options' ask price. Column should be of type float/int
Under the hood it uses pandas read_csv
function to perform the import. If you encounter any issues using this function, it is advised to just use pandas import functions to manually create the formatted DataFrames.
Copyright © 2020, Michael Chu