Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions NBP API responses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Wygląd zapytań:

## Tabele

### Typ `A`

```json
[
{
"table": "A",
"no": "039/A/NBP/2022",
"effectiveDate": "2022-02-25",
"rates": [
{ "currency": "bat (Tajlandia)", "code": "THB", "mid": 0.1283 }
]
}
]
```

### Typ `B`

```json
[
{
"table": "B",
"no": "008/B/NBP/2022",
"effectiveDate": "2022-02-23",
"rates": [
{ "currency": "balboa (Panama)", "code": "PAB", "mid": 3.9937 }
]
}
]
```

### Typ `C`

```json
[
{
"table": "C",
"no": "039/C/NBP/2022",
"tradingDate": "2022-02-24",
"effectiveDate": "2022-02-25",
"rates": [
{ "currency": "euro", "code": "EUR", "bid": 4.648, "ask": 4.7418 }
]
}
]
```

## Waluty

### Typ `A`

```json
{
"table": "A",
"currency": "euro",
"code": "EUR",
"rates": [
{ "no": "039/A/NBP/2022", "effectiveDate": "2022-02-25", "mid": 4.6608 }
]
}
```

### Typ `B`

```json
{
"table": "B",
"country": "Monako",
"symbol": "978",
"currency": "euro",
"code": "EUR",
"rates": [
{ "no": "10/B/NBP/2004", "effectiveDate": "2004-04-28", "mid": 4.7805 }
]
}
```

### Typ `C`

```json
{
"table": "C",
"currency": "euro",
"code": "EUR",
"rates": [
{
"no": "039/C/NBP/2022",
"effectiveDate": "2022-02-25",
"bid": 4.648,
"ask": 4.7418
}
]
}
```

## Parametry zapytań o kursy walut

`{table}` - typ tabeli (`A`, `B`, `C`)
`{code}` - kod waluty (standard `ISO 4217`)
`{topCount}` - liczba określająca maksymalną liczność zwracanej serii danych
`{date}`, `{startDate}`, `{endDate}` - daty w formacie `ISO 8601`

## Aktualnie obowiązująca tabela kursów typu `{table}`

`http://api.nbp.pl/api/exchangerates/tables/a?format=json`

Wygląd tabeli:

## Seria ostatnich `{topCount}` tabel kursów typu `{table}`

Wygląd:

```json
[
{
"table": "B",
"no": "006/B/NBP/2022",
"effectiveDate": "2022-02-09",
"rates": [
{
"currency": "afgani (Afganistan)",
"code": "AFN",
"mid": 0.042327
}
]
},
{
"table": "B",
"no": "007/B/NBP/2022",
"effectiveDate": "2022-02-16",
"rates": [
{
"currency": "afgani (Afganistan)",
"code": "AFN",
"mid": 0.04306
}
]
},
{
"table": "B",
"no": "008/B/NBP/2022",
"effectiveDate": "2022-02-23",
"rates": [
{
"currency": "afgani (Afganistan)",
"code": "AFN",
"mid": 0.043601
}
]
}
]
```

## Tabela kursów typu `{table}` opublikowana w dniu dzisiejszym (albo `404`)

```json
[
{
"table": "C",
"no": "039/C/NBP/2022",
"tradingDate": "2022-02-24",
"effectiveDate": "2022-02-25",
"rates": [
{
"currency": "dolar amerykański",
"code": "USD",
"bid": 4.1695,
"ask": 4.2537
}
]
}
]
```

```json
{
"table": "A",
"currency": "funt szterling",
"code": "GBP",
"rates": [
{
"no": "030/A/NBP/2022",
"effectiveDate": "2022-02-14",
"mid": 5.4645
},
]
}
```
4 changes: 4 additions & 0 deletions NBPCurrencyAPILib/Enums/TableType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace NBPAPI.NET.Core.Enums
{
public enum TableType { A, B, C }
}
16 changes: 16 additions & 0 deletions NBPCurrencyAPILib/Models/CurrencyRate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace NBPAPI.NET.Core.Models
{
/// <summary>
/// Rate retrieved in single-currency rate requests.
/// </summary>
public class CurrencyRate
{
public string? No { get; init; }
public DateTime EffectiveDate { get; init; }
public decimal? Bid { get; init; }
public decimal? Mid { get; init; }
public decimal? Ask { get; init; }
}
}
40 changes: 40 additions & 0 deletions NBPCurrencyAPILib/Models/ExchangeRates.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace NBPAPI.NET.Core.Models
{
/// <summary>
/// Class containing definitions of
/// </summary>
public class ExchangeRates
{
/// <summary>
/// Definition of exchange rate table
/// </summary>
public class Table
{
[JsonPropertyName("Table")]
public string? TableName { get; init; }
public string? No { get; init; }
public DateTime EffectiveDate { get; init; }
public DateTime? TradingDate { get; init; }
public IEnumerable<TableRate>? Rates { get; init; }

}

/// <summary>
/// Definition of single-currency exchange rate table
/// </summary>
public class Rate
{
[JsonPropertyName("Table")]
public string? TableName { get; init; }
public string? Country { get; init; }
public string? Symbol { get; init; }
public string? Currency { get; init; }
public string? Code { get; init; }
public IEnumerable<CurrencyRate>? Rates { get; init; }
}
}
}
13 changes: 13 additions & 0 deletions NBPCurrencyAPILib/Models/GoldRate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace NBPAPI.NET.Core.Models
{
/// <summary>
/// Price of 1 kg of gold in PLN
/// </summary>
public class GoldRate
{
public DateTime Data { get; init; }
public decimal Cena { get; init; }
}
}
14 changes: 14 additions & 0 deletions NBPCurrencyAPILib/Models/TableRate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace NBPAPI.NET.Core.Models
{
/// <summary>
/// Rate retrieved in tables request
/// </summary>
public class TableRate
{
public string? Currency { get; init; }
public string? Code { get; init; }
public decimal? Bid { get; init; }
public decimal? Mid { get; init; }
public decimal? Ask { get; init; }
}
}
Loading