1.4.1 • Published 1 year ago

dolar-exchange-sdk v1.4.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

What is dolar-sdk

Is a wrapper of APIs to get currency and the exchange between two of them.

How to use

  1. 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 \  

  2. 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
    currency.getCurrency()
    response:
    [
      { 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
    currency.getExchange({ amount : '300', from: CurrencySymbol.USD, to: CurrencySymbol.ARG })
    response:
    [
      {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

  1. Add configuration at factoryConfig.ts
  2. 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