HIST Download Data

The objective of this part of the code is to download the data to analyze. The data is obtained from HistData.com. The code use tick data in generic ASCII format. For the price response function analysis are used the majors foreign exchange pairs and for the spread impact analysis are used a combination of majors, crosses and exotic pairs (46 in total).

Modules

The code is divided in two parts:
  • Tools: some functions for repetitive actions.
  • Main: code to run the implementation.

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:
  • os
  • typing
The module contains the following functions:
  • hist_function_header_print_data - prints info about the function running.
  • hist_start_folders - creates folders to save data and plots.
  • hist_initial_message - prints the initial message with basic information.
  • main - the main function of the script.
hist_data_tools_download.hist_function_header_print_data(function_name: str, fx_pair: str, year: str, month: 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.
  • 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’).
  • month – string of the month to be analyzed (i.e ‘07’).
  • day – string of the day to be analyzed (i.e ‘07’).
Returns:

None – The function prints a message and does not return a value.

hist_data_tools_download.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.
hist_data_tools_download.hist_start_folders(fx_pairs: List[str], years: List[str]) → None[source]

Creates the initial folders to save the data and plots.

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 strings of the year to be analyzed (i.e [‘2016’, ‘2017’]).
Returns:

None – The function creates folders and does not return a value.

hist_data_tools_download.main() → None[source]

The main function of the script.

The main function is used to test the functions in the script.

Returns:None.

Main

HIST data main module.

The functions in the module extract and plot the Historic Rate data from HIST Capital in a year.

This script requires the following modules:
  • itertools
  • multiprocessing
  • os
  • typing
  • histdata
  • hist_data_tools_download
The module contains the following functions:
  • hist_download_data - downloads the HIST data.
  • hist_download_all_data - downloads all the HIST data.
  • main - the main function of the script.
hist_data_main_download.hist_download_all_data(fx_pairs: List[str], years: List[str]) → None[source]

Downloads all 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 strings of the years to be analyzed (i.e. [‘2016’, ‘2017]).
Returns:

None – The function saves the data in a file and does not return a value.

hist_data_main_download.hist_download_data(fx_pair: str, year: str) → None[source]

Downloads the HIST data.

Parameters:
  • fx_pair – string abbreviation of the forex pair to be analyzed (i.e. ‘eur_usd’).
  • year – string of the year to be analyzed (i.e. ‘2016’).
Returns:

None – The function saves the data in a file and does not return a value.

hist_data_main_download.main() → None[source]

The main function of the script.

The main function extract, analyze and plot the data.

Returns:None.