Example usage

To use fxtracker in a project:

import fxtracker

print(fxtracker.__version__)
0.1.0

Imports

from fxtracker.fxtracker import fx_conversion
from fxtracker.fxtracker import fx_rate_lookup
from fxtracker.fxtracker import price_trend_viz
from fxtracker.fxtracker import pl_trend_viz

import yfinance as yf
import altair as alt
from yfinance import shared
import datetime
alt.renderers.enable('mimetype')
alt.renderers.enable('html')
RendererRegistry.enable('html')

To convert a specific amount of money from current currency to desired currency:

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

To look up the first date on which the target price falling between day high and day low:

fx_rate_lookup('EURUSD', 1.072)
'2023-01-10'

To visualize the trend of the exchange rate of a currency pair between the selected start date and end date:

price_trend_viz('EURUSD', '2018-12-01', '2022-12-01', 'High')
/Users/Jialing/opt/miniconda3/envs/fxtracker/lib/python3.9/site-packages/altair/utils/core.py:317: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
  for col_name, dtype in df.dtypes.iteritems():

To visualize the trend of the profit and loss of a currency pair between the selected start date and end date:

If a line chart is specified in the input:

pl_trend_viz("EURUSD", "2020-01-01", "2022-01-01", 'line')
[*********************100%***********************]  1 of 1 completed
/Users/Jialing/opt/miniconda3/envs/fxtracker/lib/python3.9/site-packages/altair/utils/core.py:317: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
  for col_name, dtype in df.dtypes.iteritems():

If an area chart is specified in the input:

pl_trend_viz("EURUSD", "2020-01-01", "2022-01-01", 'area')
[*********************100%***********************]  1 of 1 completed
/Users/Jialing/opt/miniconda3/envs/fxtracker/lib/python3.9/site-packages/altair/utils/core.py:317: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
  for col_name, dtype in df.dtypes.iteritems():