Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yeikiu/ts-crypto-cli
β οΈ UNMAINTAINED - π Handy npm cli/lib to operate against some of the most known Crypto Exchanges
https://github.com/yeikiu/ts-crypto-cli
binance cryptocurrency-exchanges hitbtc kraken
Last synced: about 2 months ago
JSON representation
β οΈ UNMAINTAINED - π Handy npm cli/lib to operate against some of the most known Crypto Exchanges
- Host: GitHub
- URL: https://github.com/yeikiu/ts-crypto-cli
- Owner: yeikiu
- License: cc0-1.0
- Created: 2020-06-27T23:42:06.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T21:05:20.000Z (almost 2 years ago)
- Last Synced: 2024-07-30T17:23:51.382Z (5 months ago)
- Topics: binance, cryptocurrency-exchanges, hitbtc, kraken
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/ts-crypto-cli
- Size: 2.06 MB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# π¨ This package has been deprecated
> This package is no longer supported. If you are still interested in a good cli/lib to operate on Kraken we recommend you check the ts-kraken project: https://github.com/yeikiu/ts-kraken
---
# TS Crypto Cli
> A handy npm to operate against some of the most known Crypto Exchanges
- *NEW:* Test it online on the [npm Interactive Playground Demo](https://runkit.com/yeikiu/5f728aa574e29b001b4259d1)
# Option 1 - Use it as a library
- `npm i ts-crypto-cli`
### Library usage demo
> Here is a little handler to perform a safe withdrawal from Kraken in <20 lines of code using the lib.
```typescript
import { krakenPrivateApiRequest } from 'ts-crypto-cli'const krakenWithdrawAsset = async (asset: string, key: string, withdrawAmount: number): Promise => {
const withdrawInfo = await krakenPrivateApiRequest({ url: 'WithdrawInfo', data: {
asset,
key,
amount: withdrawAmount
}})const { limit } = withdrawInfo
if (Number(limit) < Number(withdrawAmount)) {
throw new Error(`CanΒ΄t withdraw ${withdrawAmount} ${asset}. Max. available ${limit}`)
}return krakenPrivateApiRequest({ url: 'Withdraw', data: {
asset,
key,
amount: withdrawAmount
}})
}export {
krakenWithdrawAsset
}
```# Option 2 - Launch the REPL cli on a shell
---
## Option 2.1 - Provide a .env file
> Create a .env file under current working directory with your own API credentials and run
- `npx ts-crypto-cli`
### Environment Variables
```
##
# Each REST request/response can be optionally recorded to a log file if you set a path here
##
#TS_CRYPTO_CLI_LOGS_PATH=./ts_crypto_cli_logsKRAKEN_API_KEY=<...>
KRAKEN_API_SECRET=<...>HITBTC_API_KEY=<...>
HITBTC_API_SECRET=<...>BINANCE_API_KEY=<...>
BINANCE_API_SECRET=<...>##
# DEV only
##
#DEBUG=ts-crypto-cli:*
```## Option 2.2 - Inject your keys/secrets to enable private methods
> This method is more secure as you won't need to persist the KEYS to a file
### Powershell (windows)
- `$env:KRAKEN_API_KEY="<...>" ; $env:KRAKEN_API_SECRET="<...>" ; $env:HITBTC_API_KEY="<...>" ; etc... ; npx ts-crypto-cli`
### cmd (windows)
- `set KRAKEN_API_KEY=<...> & set KRAKEN_API_SECRET=<...> & set HITBTC_API_KEY=<...> & etc... & npx ts-crypto-cli`
### Unix/OSx
- `KRAKEN_API_KEY=<...> KRAKEN_API_SECRET=<...> HITBTC_API_KEY=<...> etc.. npx ts-crypto-cli`
# [Documentation](https://yeikiu.github.io/ts-crypto-cli/)
### Handling multiple API credentials
You can use different API keys/secrets against the same exchange. Generate the new API client instances with one of the following methods:
- `createKrakenPrivateApiClient`
- `createHitBTCPrivateApiClient`
- `createBinancePrivateApiClient`