Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brh55/fitbit-crypto
A library for Fitbit OS to fetch, display, and sync cryptocurrency prices
https://github.com/brh55/fitbit-crypto
Last synced: 24 days ago
JSON representation
A library for Fitbit OS to fetch, display, and sync cryptocurrency prices
- Host: GitHub
- URL: https://github.com/brh55/fitbit-crypto
- Owner: brh55
- Created: 2023-05-27T21:26:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-27T21:46:49.000Z (over 1 year ago)
- Last Synced: 2024-12-30T18:44:44.323Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# fitbit-crypto
[](https://app.travis-ci.com/github/brh55/fitbit-crypto) [](https://coveralls.io/github/brh55/fitbit-crypto) [](https://www.npmjs.com/package/fitbit-crypto)Still in progress for documentation and testing, but working.
### Getting Started
1. Import library in your `app` directory
```js
import Crypto from 'fitbit-crypto/app';
```
2. Import `listen()` method and activate it within your `companion` file
```js
import { listen } from 'fitbit-crypto/companion';listen()
```
3. Create a `Text` element within your views with an Id
4. Initiate Crypto library to create a instance to fetch, display, prices
```js
import Crypto from 'fitbit-crypto/app';const crypto = new Crypto('elementId', { fromSymbol: 'USD', toSymbol: 'BTC' });
const load = async () => {
const btcPrice = await crypto.getPrice();
console.log('BTC Price', btcPrice);
// Display to the target element
crypto.setPrice();
// Get price to update the target element every second
setInterval(async () => {
await crypto.getPrice();
crypto.setPrice
}, 1000);
};load();
```### Advance Usage
Use the library to create multiple listener for different crytocurrencies and attach a refresh button to it
```js
import Crypto from 'fitbit-crypto/app';const btc = new Crypto('btcId', { fromSymbol: 'USD', toSymbol: 'BTC', tapTargetId: 'btcRefreshBtn' });
const doge = new Crypto('dogeId', { fromSymbol: 'USD', toSymbol: 'DOGE', tapTargetId: 'dogeRefreshBtn' });
const eth = new Crypto('ethId', { fromSymbol: 'USD', toSymbol: 'ETH', tapTargetId: 'ethRefreshBtn' });// Set Initial Prices
btc.getPrice().then(() => btc.setPrice());
eth.getPrice().then(() => eth.setPrice());
doge.getPrice().then(() => doge.setPrice());
```## fitbit-crypto/app
`fitfont, fromSymbol = 'BTC', toSymbol = 'USD', onPriceChange, tapTargetId, defaultErrorMessage, quickError = true`## fitbit-crypto/companion
## Used in The Wild
This module is being used for the following watchfaces:- [Dogee](https://gallery.fitbit.com/details/6359d45c-696f-4867-aa15-08397fa0f3fe) (4.8 ⭐s) - A free dogecoin watchface by Pixels on Ridge
Pixels on Ridge
## License
MIT © [Brandon Him](https://github.com/brh55/fitbit-crypto)