1.4.1 • Published 1 year ago
dolar-exchange-sdk v1.4.1
What is dolar-sdk
Is a wrapper of APIs to get currency and the exchange between two of them.
How to use
Instance source API to determinate where data come from.
import { Currencies, Source } from 'dolar-exchange-sdk'; const currency = new Currencies(Source.DOLAR_SI);
Note : Source enum has available sources, current list is: * DOLAR_SI \
initializing data is needed.
```typescript await currency.initiateData(); ```
It will internally request for info and save data to be used, if you want to update the data then call this method whenever you need it. \
- You can get Raw data parsed
response:currency.getCurrency()
[ { label: 'oficial', ask: '123.39', bid: '117.39' }, { label: 'blue', ask: '207.5', bid: '204.5' } ]
- You can get exchange between two currencies.
amount, from and to parameters
response:currency.getExchange({ amount : '300', from: CurrencySymbol.USD, to: CurrencySymbol.ARG })
[ {label: 'oficial', from: 'USD', to: 'ARG', ask: '37017', bid: '35217'}, {label: 'blue', from: 'USD', to: 'ARG', ask: '62250', bid: '61350' } ]
How to add new Source
- Add configuration at factoryConfig.ts
- Add Strategy on /Strategy Folder, adding parseCurrencyData() is needed, use other strategies as reference.
examples
See examples at examples folders, installing globally ts-node and do ts-node <filename.ts>
is recomended.
1.2.0
2 years ago
1.1.19
2 years ago
1.1.18
2 years ago
1.1.17
2 years ago
1.4.1
1 year ago
1.4.0
1 year ago
1.3.0
1 year ago
1.1.16
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.13
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago