-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from silvavn/master
Improved organization and removed redundancy
- Loading branch information
Showing
7 changed files
with
663 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
*.pyc | ||
*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class ArgChecker: | ||
""" | ||
Argument checker | ||
""" | ||
|
||
def __init__(self, args): | ||
print("Checking arguments...") | ||
self.check_arguments(args) | ||
|
||
def check_arguments(self, args): | ||
granularity_constraints_list = [1, 5, 10, 15, 30, 60, 3600] | ||
granularity_constraints_list_string = ''.join( | ||
str(value) + "," for value in granularity_constraints_list).strip(",") | ||
|
||
assert not(args.data_granularity_minutes not in granularity_constraints_list), "You can only choose the following values for 'data_granularity_minutes' argument -> %s\nExiting now..." % granularity_constraints_list_string | ||
|
||
assert not(args.is_test == 1 and args.future_bars < | ||
2), "You want to test but the future bars are less than 2. That does not give us enough data to test the model properly. Please use a value larger than 2.\nExiting now..." | ||
|
||
assert not(args.history_to_use != "all" and int(args.history_to_use_int) < | ||
args.future_bars), "It is a good idea to use more history and less future bars. Please change these two values and try again.\nExiting now..." | ||
|
||
args.market_index = str(args.market_index).upper() | ||
if args.history_to_use != "all": | ||
args.history_to_use = int(args.history_to_use) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[{ | ||
"comm": "--history_to_use", | ||
"type": "str", | ||
"default": "all", | ||
"help": "How many bars of 1 hour do you want to use for the anomaly detection model. Either an integer or all" | ||
}, | ||
{ | ||
"comm": "--is_load_from_dictionary", | ||
"type": "int", | ||
"default": "0", | ||
"help": "Whether to load data from dictionary or get it from yahoo finance." | ||
}, | ||
{ | ||
"comm": "--data_dictionary_path", | ||
"type": "str", | ||
"default": "dictionaries/data_dictionary.npy", | ||
"help": "Data dictionary path." | ||
}, | ||
{ | ||
"comm": "--is_save_dictionary", | ||
"type": "int", | ||
"default": "1", | ||
"help": "Whether to save data in a dictionary." | ||
}, | ||
{ | ||
"comm": "--data_granularity_minutes", | ||
"type": "int", | ||
"default": "15", | ||
"help": "Minute level data granularity that you want to use. Default is 60 minute bars." | ||
}, | ||
{ | ||
"comm": "--is_test", | ||
"type": "int", | ||
"default": "1", | ||
"help": "Whether to test the tool or just predict for future. When testing you should set the future_bars to larger than 1." | ||
}, | ||
{ | ||
"comm": "--future_bars", | ||
"type": "int", | ||
"default": "30", | ||
"help": "How many bars to keep for testing purposes." | ||
}, | ||
{ | ||
"comm": "--apply_noise_filtering", | ||
"type": "int", | ||
"default": "1", | ||
"help": "Whether to apply the random matrix theory to filter out the eigen values." | ||
}, | ||
{ | ||
"comm": "--only_long", | ||
"type": "int", | ||
"default": "1", | ||
"help": "Whether to only long the stocks or do both long and short." | ||
}, | ||
{ | ||
"comm": "--market_index", | ||
"type": "str", | ||
"default": "SPY", | ||
"help": "Which index to use for comparisons." | ||
}, | ||
{ | ||
"comm": "--eigen_portfolio_number", | ||
"type": "int", | ||
"default": "2", | ||
"help": "Which eigen portfolio to choose. By default the 2nd one is choosen as it gives the most risk and reward." | ||
}, | ||
{ | ||
"comm": "--stocks_file_path", | ||
"type": "str", | ||
"default": "stocks/stocks.txt", | ||
"help": "Stocks file that contains the list of stocks you want to build your portfolio with." | ||
}, | ||
{ | ||
"comm": "--save_plot", | ||
"type": "bool", | ||
"default": "False", | ||
"help": "Save plot instead of rendering it immediately." | ||
} | ||
] |
Oops, something went wrong.