# Configuration

## Bitfinex HTTP Client

{% code title="Create Client" lineNumbers="true" %}

```javascript
import { BitfinexPricingClient } from '@tetherto/wdk-pricing-bitfinex-http'

// Create the client (no options needed)
const client = new BitfinexPricingClient()
```

{% endcode %}

### Current Price

{% code title="Get Current Price" lineNumbers="true" %}

```javascript
const price = await client.getCurrentPrice('BTC', 'USD')
```

{% endcode %}

### Historical Series

Downscales long histories to ≤ 100 points.

{% code title="Get Historical Prices" lineNumbers="true" %}

```javascript
const series = await client.getHistoricalPrice({
  from: 'BTC',
  to: 'USD',
  start: 1709906400000, // optional (ms)
  end:   1709913600000  // optional (ms)
})
```

{% endcode %}

## Provider Integration

Works with `@tetherto/wdk-pricing-provider` as a PricingClient implementation.

{% code title="Wrap with PricingProvider" lineNumbers="true" %}

```javascript
import { PricingProvider } from '@tetherto/wdk-pricing-provider'

const provider = new PricingProvider({
  client,
  priceCacheDurationMs: 60 * 60 * 1000 // optional, defaults to 1h
})

const last = await provider.getLastPrice('BTC', 'USD')
const hist = await provider.getHistoricalPrice({ from: 'BTC', to: 'USD' })
```

{% endcode %}

***

## Need Help?

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-discord">:discord:</i></td><td><strong>Discord Community</strong></td><td>Connect with developers, ask questions, share your projects</td><td><a href="https://discord.gg/arYXDhHB2w" class="button primary">Join Community</a></td><td><a href="https://discord.gg/arYXDhHB2w">https://discord.gg/arYXDhHB2w</a></td></tr><tr><td><i class="fa-github">:github:</i></td><td><strong>GitHub Issues</strong></td><td>Report bugs, request features, and get technical help</td><td><a href="https://github.com/tetherto/wdk-core" class="button secondary">Open an Issue</a></td><td><a href="https://github.com/tetherto/wdk-core">https://github.com/tetherto/wdk-core</a></td></tr><tr><td><i class="fa-envelope">:envelope:</i></td><td><strong>Email Contact</strong></td><td>For sensitive or private matters, contact our team directly</td><td><a href="mailto:wallet-info.tether.io" class="button secondary">Send an email</a></td><td><a href="mailto:wallet-info.tether.io">mailto:wallet-info.tether.io</a></td></tr></tbody></table>
