fxtracker.fxtracker

Module Contents

Functions

fx_rate_lookup(curr, target_px)

Return the most recent date on which

pl_trend_viz(curr, start_date, end_date, chart_type)

Visualizes trend of the profit and loss of a

price_trend_viz(curr, start_date, end_date, option)

Visualizes trend of the exchange rate of a

fx_conversion(curr1, curr2, amt)

Converts a specific amount of money from current

fxtracker.fxtracker.fx_rate_lookup(curr, target_px)[source]

Return the most recent date on which the target price happend. i.e. the target price was between day high and day low of the day.

Parameters:
  • curr (string) – Ticker of the currency pair such as ‘EURUSD’.

  • target_px (float) – Target price for the lookup.

Returns:

date – The most recent date in YYYY-MM-DD on which the target price happened. i.e. the target price was between day high and day low of that day.

Return type:

string

Examples

>>> fx_rate_lookup('EURUSD', 1.072)
    '2023-01-10'
fxtracker.fxtracker.pl_trend_viz(curr, start_date, end_date, chart_type)[source]

Visualizes trend of the profit and loss of a currency pair between the selected start date and end date.

Parameters:
  • curr (string) – Ticker of the currency pair such as ‘EURUSD’

  • start_date (string) – Start date of the selected period of time

  • end_date (string) – End date of the selected period of time

  • chart_type (string) – Type of visulization

Returns:

  • Line plot that shows the trend of the profit and

  • loss of a currency pair over the selected period of time

Examples

>>> pl_trend_viz('EURUSD', '2018-12-31', '2022-12-31','line')
fxtracker.fxtracker.price_trend_viz(curr, start_date, end_date, option)[source]

Visualizes trend of the exchange rate of a currency pair between the selected start date and end date.

Parameters:
  • curr (string) – Ticker of the currency pair such as ‘EURUSD’

  • start_date (string) – Start date of the selected period of time

  • end_date (string) – End date of the selected period of time

  • option (string) – A choice of option from [‘Open’, ‘High’, ‘Low’, ‘Close’]

Returns:

  • Line plot that shows the trend of the exchange rate of

  • a currency pair over the selected period of time

Examples

>>> price_trend_viz('EURUSD', '2018-12-31', '2022-12-31')
fxtracker.fxtracker.fx_conversion(curr1, curr2, amt)[source]

Converts a specific amount of money from current currency (curr1) to desired currency (curr2)

Parameters:
  • curr1 (string) – Ticker of the current currency such as ‘EUR’

  • curr2 (string) – Ticker of the desired currency to convert to such as ‘USD’

  • amt (int or float) – amount of money to be converted

Return type:

Amount of value converted from currency 1 to currency 2

Examples

>>> fx_conversion('EUR', 'USD', 150.75)