<jupyter_start><jupyter_text>WQU Capstone project - Short-term trading strategy on G10 currencies Supplement - Bid-Ask Spreads Analysis* <NAME> - <EMAIL>* <NAME> -  <EMAIL>* <NAME> - <EMAIL> Jun-Aug-2020 In this workbook we analyze bid/ask spreads by currency to understand possible losses coming from it.<jupyter_code>import sys
import os
#insert you own path or use relative path
path_to_project = os.path.realpath('..') # r'C:\WQU\Capstone\Working_files'
sys.path.append(path_to_project)
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('ignore')
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
plt.style.use('seaborn-talk')
plt.style.use('bmh')
tickers = ['AUD/USD','AUD/CAD','AUD/JPY','EUR/USD','GBP/USD','NZD/USD','USD/CAD', 'USD/JPY']
ticker = 'AUD/USD'
input_path = os.path.join(path_to_project, 'input_data', ''.join(ticker.split('/')) + '.csv')
pair = pd.read_csv(input_path)
bidask_losses = {}
for ticker in tickers:
    input_path = os.path.join(path_to_project, 'input_data', ''.join(ticker.split('/')) + '.csv')
    pair = pd.read_csv(input_path)
    bidask_losses[ticker] = np.mean((pair['askclose'] - pair['bidclose'])/pair['bidclose'])*100
print('\n'.join(f'{k}:{v:.02f}%' for k,v in  bidask_losses.items()))<jupyter_output>AUD/USD:0.02%
AUD/CAD:0.04%
AUD/JPY:0.03%
EUR/USD:0.02%
GBP/USD:0.02%
NZD/USD:0.04%
USD/CAD:0.02%
USD/JPY:0.02%
{'fraction_non_alphanumeric': 0.17458100558659218, 'fraction_numerical': 0.024441340782122904, 'mean_word_length': 5.426008968609866, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '664434', 'license': 'MIT', 'n_tokens_mistral': 610, 'n_tokens_neox': 561, 'n_words': 117, 'path': 'notebooks/WQU Capstone - Supplement - Bid-Ask Spreads Analysis.ipynb', 'repo_name': 'anirbansaha96/capstone', 'size': '1503'}