Skip to main content

A package that plots current and historical price graphs for currency pairs as well as converts currency.

Project description

ci-cd codecov Documentation Status

fxtracker

This is a package created as a group project for DSCI_524 Collaborative Software Development of UBC Master of Data Science (MDS) program 2022-2023. Based on the foreign exchange data in Yahoo Finance, this package allows user to perform currency conversion based on the latest available exchange rate, lookup a target exchange rate from historical data as well plotting exchange rate history and profit/loss percentage history by specifying a currency pair (and other input parameters).

The full documentation of this package can also be found on https://fxtracker.readthedocs.io/en/latest/

Function Description

  • fx_conversion
    Convert the input amount of currency 1 to currency 2 based on the latest available exchange rate.
  • fx_rate_lookup
    Lookup for the most recent date on which the input target rate of a currency pair is within the day's high/low.
  • price_trend_viz
    Plot the historical exchange rate of the input currency pair for a specific period of time.
  • pl_trend_viz
    Plot the historical profit/loss percentage of the input currency pair for a specific period of time.

There is a python package (forex-python) relevant to foreign exchange. That package is basically for retrieving exchange rates and bitcoin prices in plain text as well as performing conversion. It does not provide visualizations and lookup function like fxtracker does. fxtracker allows user to visualize the trends and understand if a target price of a currency pair of interest is within a reasonable range.

Installation

$ pip install fxtracker

Usage

If the package is installed successfully, users then need the following nine input parameters:

curr, target_px, start_date, end_date, chart_type, option, curr1, curr2, amt. The output of the functions will be in forms of a datetime string, a float and interactive plots from the "altair" package.

fxtracker can be used to convert a specific amount of money from one currency to another, find the most recent date on which the target price falling between day high and day low of that day, visualize the trend of the exchange rate of a currency pair and the trend of the profit and loss of a currency pair between the selected start date and end date.

The functions can be imported from the package as follows:

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

To convert a specific amount of money from current currency (curr1) to desired currency (curr2):

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

163.68

To look up the most recent date on which the target price falling between day high and day low of that day:

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').show()

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').show()

If an area chart is specified in the input:

pl_trend_viz("EURUSD", "2020-01-01", "2022-01-01", 'area').show()

Dependencies

  • python = "^3.9"
  • pandas = "^1.5.2"
  • altair = "^4.2.0"
  • numpy = "^1.24.1"
  • plotly = "^5.12.0"
  • yfinance = "^0.2.3"
  • ipykernel = "^6.20.2"
  • altair-viewer = "^0.4.0"

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

fxtracker was created by Sarah Abdelazim, Markus Nam, Crystal Geng and Lennon Au-Yeung. It is licensed under the terms of the MIT license.

Credits

fxtracker was created with cookiecutter and the py-pkgs-cookiecutter template.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fxtracker-1.0.3.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

fxtracker-1.0.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file fxtracker-1.0.3.tar.gz.

File metadata

  • Download URL: fxtracker-1.0.3.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for fxtracker-1.0.3.tar.gz
Algorithm Hash digest
SHA256 8dca9b88dafeafccf5a0e40e12d231680fdbadcc6226534dba9b4faa395cf42b
MD5 39e0b27f5d6cce54d200a2c97d54b81c
BLAKE2b-256 670263d2d517ad62ce10a669ec277ddcbdb2cbbb50b53e7a4a110e55eb070ad2

See more details on using hashes here.

File details

Details for the file fxtracker-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: fxtracker-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for fxtracker-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3387570fa22337d8948b2e2e0cdc262f1027901f4d82a498dd7983d6b9f578e1
MD5 da5a57532b5c2c8744b54b6885fb2b38
BLAKE2b-256 3dc5c34d5609dfe0c74ccec923b4fb044ec10f6997470419091b0761d342db52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page