HIST Average Spread¶
To be done …
To run this part of the code is necessary to have the results from the module HIST Physical Basic Data.
Modules¶
- The code is divided in four parts:
Tools¶
HIST data tools module.
The functions in the module do small repetitive tasks, that are used along the whole implementation. These tools improve the way the tasks are standardized in the modules that use them.
- This script requires the following modules:
- typing
- The module contains the following functions:
- hist_function_header_print_data - prints info about the function running.
- hist_initial_message - prints the initial message with basic information.
- hist_weeks - generates a tuple with the number of weeks in a year.
- main - the main function of the script.
-
hist_data_tools_avg_spread.
hist_function_header_print_data
(function_name: str, fx_pair: str, year: str, week: str) → None[source]¶ Prints a header of a function that generates data when it is running.
Parameters: - function_name – name of the function that generates the data.
- year – string of the year to be analyzed (i.e ‘2016’).
Returns: None – The function prints a message and does not return a value.
-
hist_data_tools_avg_spread.
hist_initial_message
() → None[source]¶ Prints the initial message with basic information.
Returns: None – The function prints a message and does not return a value.
Analysis¶
HIST data analysis module.
The functions in the module analyze the statistics from the NASDAQ stock market and compute the average spread of the stocks.
- This script requires the following modules:
- itertools.product
- multiprocessing
- numpy
- pandas
- pickle
- hist_data_tools_avg_spread
- The module contains the following functions:
- hist_quotes_trades_day_avg_spread_data - statistics of quotes and trades for a day.
- hist_quotes_trades_year_avg_spread_data - statistics of quotes and trades for a year.
- main - the main function of the script.
-
hist_data_analysis_avg_spread.
hist_quotes_trades_day_avg_spread_data
(fx_pair: str, year: str, week: str) → Tuple[Any, Any][source]¶ Obtain the quotes and trades statistics for a week.
Using the quotes files, obtain the statistics of the average spread, number of quotes and number of trades for a day.
Parameters: - fx_pair – string of the abbreviation of the forex pair to be analyzed (i.e. ‘eur_usd’).
- year – string of the year to be analyzed (i.e ‘2016’).
- week – string of the week to be analyzed (i.e. ‘16’).
Returns: tuple – The function returns a tuple with float values.
-
hist_data_analysis_avg_spread.
hist_quotes_trades_year_avg_spread_data
(fx_pairs: List[str], year: str) → None[source]¶ Obtain the quotes and trades statistics for a year.
Using the hist_quotes_trades_day_avg_spread_data function computes the statistics of the average spread, number of quotes and number of trades for a year.
Parameters: - fx_pairs – list of the string abbreviation of the fx pairs to be analyzed (i.e. [‘eur_usd’, ‘gbp_usd’]).
- year – String of the years to be analyzed (i.e ‘2016’).
Returns: None – The function saves the data in a file and does not return a value.
Main¶
HIST data main module.
The functions in the module run the complete analysis of the HIST data.
- This script requires the following modules:
- typing
- hist_data_analysis_avg_spread
- hist_data_tools_avg_spread
- The module contains the following functions:
- hist_data_generator - generates all the analysis of the HIST data.
- main - the main function of the script.
-
hist_data_main_avg_spread.
hist_data_generator
(fx_pairs: List[str], years: List[str])[source]¶ Generates all the analysis of the HIST data.
Parameters: - fx_pairs – list of the string abbreviation of the forex pairs to be analyzed (i.e. [‘eur_usd’, ‘gbp_usd’]).
- years – list of the string of the years to be analyzed (i.e [‘2016’, ‘2019’]).
Returns: None – The function saves the data in a file and does not return a value.