### Prepare Development Environment
Source: https://github.com/ankhbayar/monxansh/blob/master/README.md
Sets up a Python virtual environment and installs dependencies from requirements.txt.
```console
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
--------------------------------
### Run App with Gunicorn
Source: https://github.com/ankhbayar/monxansh/blob/master/README.md
Starts the application using Gunicorn with auto-reload enabled.
```console
gunicorn main:app --reload
```
--------------------------------
### GET /xansh.html (IFrame)
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Embeds an exchange rate widget via IFrame. Supports customization of currency selection, column titles, and conversion tool.
```APIDOC
## GET /xansh.html (IFrame)
### Description
Embeds an exchange rate widget via IFrame. Supports customization of currency selection, column titles, and conversion tool.
### Method
GET
### Endpoint
//monxansh.appspot.com/xansh.html
### Parameters
#### Query Parameters
- **currency** (string) - Optional - Pipe-separated list of 3-letter currency codes (e.g., USD|EUR|JPY).
- **currency_rate_title** (string) - Optional - Custom title for the rate column.
- **currency_title** (string) - Optional - Custom title for the currency column.
- **source** (string) - Optional - Custom source text.
- **conv_tool** (string) - Optional - If present, enables the currency conversion tool.
### Request Example
```
```
### Response
#### Success Response (200)
Returns an HTML page for embedding.
#### Response Example
```
```
```
--------------------------------
### GET /xansh.json
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Fetches exchange rate data in JSON format. Supports multiple currency codes and custom column titles via query parameters.
```APIDOC
## GET /xansh.json
### Description
Fetches exchange rate data in JSON format. Supports multiple currency codes and custom column titles via query parameters.
### Method
GET
### Endpoint
//monxansh.appspot.com/xansh.json
### Parameters
#### Query Parameters
- **currency** (string) - Optional - Pipe-separated list of 3-letter currency codes (e.g., USD|EUR|JPY).
- **currency_rate_title** (string) - Optional - Custom title for the rate column.
- **currency_title** (string) - Optional - Custom title for the currency column.
- **source** (string) - Optional - Custom source text.
- **conv_tool** (string) - Optional - If present, enables the currency conversion tool.
- **myorder** (string) - Optional - If present, uses the order from the currency parameter.
### Request Example
```
jQuery.ajax({
url : '//monxansh.appspot.com/xansh.json?currency=USD|EUR',
data_type: 'json',
success : function(data) {
jQuery.each(data, function(index, row) {
// Format
// row.code - Код USD, EUR...
// row.name - Нэр
// row.rate - Ханш
// row.rate_float - Ханш
// row.rate_date - Огноо
// row.last_date - Мэдээний татсан огноо
alert(row.code);
});
}
});
```
### Response
#### Success Response (200)
- **code** (string) - Currency code (e.g., USD, EUR).
- **name** (string) - Currency name.
- **rate** (string) - Exchange rate.
- **rate_float** (number) - Exchange rate as float.
- **rate_date** (string) - Date of the rate.
- **last_date** (string) - Date when the data was fetched.
#### Response Example
```
[
{
"code": "USD",
"name": "US Dollar",
"rate": "2400.00",
"rate_float": 2400.0,
"rate_date": "2023-10-01",
"last_date": "2023-10-02"
}
]
```
```
--------------------------------
### Fetch exchange rates with jQuery.ajax from monxansh JSON API
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Fetch exchange rates as JSON using jQuery.ajax. The response contains rows with fields code, name, rate, rate_float, rate_date, and last_date. Use the currency GET parameter to specify which currencies to return, separated by |.
```javascript
jQuery.ajax({
url : '//monxansh.appspot.com/xansh.json?currency=USD|EUR',
data_type: 'json',
success : function(data) {
jQuery.each(data, function(index, row) {
// Format
// row.code - Код USD, EUR...
// row.name - Нэр
// row.rate - Ханш
// row.rate_float - Ханш
// row.rate_date - Огноо
// row.last_date - Мэдээний татсан огноо
alert(row.code);
});
}
});
```
--------------------------------
### Currency exchange rate template with conversion tool
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/hansh.html
Template for displaying currency exchange rates and a conversion tool. The first block shows the loop and conditional structure. The second block renders a table with currency codes and rates, and a footer with the source link. The third block contains jQuery code for converting between MNT and other currencies, triggered by keyup events on input fields and change on the rate select.
```html
for row in hansh\_list %} {% endfor %} {% if use\_conv\_tool %} {% endif %}
```
```html
| **{{currency\_title\|escape}}** | **{{currency\_rate\_title\|escape}}** |
| --- | --- |
| {{row.code}} | {{row.rate}} |
| {{source\|escape}} : | [**» Монгол банк**]({{source_link}}) |
| Төгрөг {% for row in hansh\_list %} {{row.code}} {% endfor %} |
```
```javascript
{% if use\_conv\_tool %} $(function() { $("#mnt").keyup(function() { var rate = parseFloat( $('select#rate option:selected').val() ); var mnt\_val = parseFloat( $(this).val() ); $("#currency").val( parseFloat(mnt\_val / rate ).toFixed(2) ); }); $("#currency").keyup(function() { var rate = parseFloat( $('select#rate option:selected').val() ); var currency\_val = parseFloat( $(this).val() ); $("#mnt").val( parseFloat(rate \* currency\_val).toFixed(2) ); }); $("#rate").change(function() { $("#mnt").keyup(); }); }) {% endif %}
```
--------------------------------
### Embed exchange rate iframe with conversion tool (conv_tool=1)
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Embed an exchange rate widget with a conversion tool. Add the conv_tool=1 parameter to the src URL. Requires a larger iframe size (210px width, 280px height) to accommodate the converter.
```html
```
--------------------------------
### Embed basic exchange rate iframe from monxansh
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Embed a basic exchange rate widget in an iframe. The src URL uses the xansh.html endpoint and the currency parameter to select currencies. The iframe is styled with a fixed width of 180px and height of 210px.
```html
```
--------------------------------
### Embed multilingual exchange rate iframe with custom titles
Source: https://github.com/ankhbayar/monxansh/blob/master/templates/index.html
Embed a multilingual exchange rate widget by customizing the column titles and source text. Use the currency_title, currency_rate_title, and source parameters to override the default Mongolian labels with English or other languages.
```html
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.