> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tangoanalytics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Currency conversion file

# Tango Currency Conversion — File

> Generated from `Tango Currency Conversion Integration Design Specification V0.5.docx` in SharePoint folder `01 Common Integrations`.
> OAS spec: [`currency-conversion-file.yaml`](./currency-conversion-file.yaml)

## Overview

SFTP file-based inbound. Client drops a pipe-delimited file with forex rate entries; Tango inserts new rates into its forex table. **Insert-only** — does not update existing rates.

**Owner:** Tango Analytics
**Spec version:** 0.5
**Status:** Draft (auto-generated — needs review)

## Transport

| Attribute | Value | |
| - | - | - |
| Direction | Inbound (Client → Tango) | |
| Mechanism | SFTP file drop | |
| File format | Pipe-delimited (\` | `) text, `.txt\` |
| File naming | `{ClientName}_currency_conversion_MMDDYYYYHHMM.txt` | |
| Production host | `sftp.tangoanalytics.com` | |
| Test host | `sftpdev.tangoanalytics.com` | |
| Path | `<TBD>` | |
| Auth | SFTP user/password (`<TBD>`) | |
| Frequency | `<TBD>` (mutually agreed) | |

## Integration logic

* Insert-only — never updates existing rate entries.
* Duplicate currency combinations for the same `exchg_rate_date` are NOT allowed (e.g., `MEX→USD` cannot appear twice for the same date).
* Pipe characters inside data must be removed/replaced before delimiting.
* Leading/trailing whitespace, embedded CR/LF, and non-ASCII bytes must be stripped from cell values.

## Data fields (required ✅)

| Field | Type | Req | Sample | Notes |
| - | - | - | - | - |
| `client_id` | NUMBER | ✅ | `217` | Tango client identifier |
| `source_currency_code` | VARCHAR | ✅ | `USD` | ISO 3-char |
| `to_currency_code` | VARCHAR | ✅ | `INR` | ISO 3-char |
| `exchange_rate` | NUMBER | ✅ | `72.71000` | Spot rate |
| `Avg_rate` ⚠ | NUMBER | – | `72.71000` | PascalCase in source — preserved |
| `exchg_rate_date` | DATE | ✅ | `MM/DD/YYYY` | |
| `Effective_From` ⚠ | DATE | ✅ | `MM/DD/YYYY` | PascalCase in source — preserved |
| `Effective_To` ⚠ | DATE | ✅ | `MM/DD/YYYY` | PascalCase in source — preserved |

## Validations

| Condition | Error message |
| - | - |
| `client_id` missing | `Fatal Error: Client ID is not available` |
| `source_currency_code` invalid | `Fatal Error: Source Currency is not valid` |
| `to_currency_code` invalid | `Fatal Error: Converted Currency is not valid` |
| `exchange_rate` missing | `Fatal Error: Exchange Rate is not available` |
| `exchg_rate_date` missing | `Fatal Error: Exchange Rate Date is not available` |

## Open Questions / Assumptions

* [ ] **Field name casing inconsistency**: source mapping mixes `source_currency_code` (snake\_case) with `Effective_From` / `Effective_To` / `Avg_rate` (PascalCase). Preserved verbatim — confirm which the actual file headers use.
* [ ] **Field names differ from the API version**: this file spec uses `source_currency_code` / `to_currency_code` / `exchange_rate` / `Avg_rate` / `exchg_rate_date`; the API uses `source_currency` / `converted_currency` / `spot_exchange_rate` / `avg_exchange_rate` / `exchange_rate_date`. The two integrations are functionally equivalent but won't share parsers.
* [ ] **SFTP path** is `<TBD>` — placeholder `inbound/currency-conversion` used.
* [ ] **SFTP credentials** are `<TBD>`.
* [ ] **Date format** ambiguity in test scenario #3 mentions either `MM/DD/YYYY` or `MM-DD-YYYY` — the mapping table only documents `MM/DD/YYYY`.

## Changelog

| Ver | Date | Description | Author |
| - | - | - | - |
| 0.1–0.4 | 2020-2022 | (see source doc) | Various |
| 0.5 | 08/08/2023 | Reformatted; updated Validations, Appendix | Jasmin Thasleem |
