https://github.com/hardyscc/bittrex-api
Bittrex JavaScript API
https://github.com/hardyscc/bittrex-api
Last synced: over 1 year ago
JSON representation
Bittrex JavaScript API
- Host: GitHub
- URL: https://github.com/hardyscc/bittrex-api
- Owner: hardyscc
- License: mit
- Created: 2018-10-22T14:23:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T02:03:40.000Z (over 7 years ago)
- Last Synced: 2024-04-25T15:44:28.198Z (about 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 355 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# Bittrex JavaScript API
## Sample Usage
```javascript
const { Bittrex } = require('@hardyscc/bittrex-api')
const bittrex = new Bittrex({
apikey: 'key',
apisecret: 'secret'
})
;(async () => {
const currency = 'ETH'
console.log('Balance =>', await bittrex.getBalance(currency))
console.log('Market Summary =>', await bittrex.getMarketSummary(currency))
const {
result: { buy, sell }
} = await bittrex.getOrderBook(currency)
console.log('Order Book Bid =>', buy)
console.log('Order Book Ask =>', sell)
console.log('Open Orders =>', await bittrex.getOpenOrders(currency))
const respBuy = await bittrex.buy({
coin: currency,
quantity: 1,
rate: 0.01
})
console.log('Buy =>', respBuy)
if (respBuy.success) {
console.log('Cancel Buy =>', await bittrex.cancel(respBuy.result.uuid))
}
const respSell = await bittrex.sell({
coin: currency,
quantity: 1,
rate: 0.1
})
console.log('Sell =>', respSell)
if (respSell.success) {
console.log('Cancel Sell =>', await bittrex.cancel(respSell.result.uuid))
}
})()
```