Skip to content

Consume Trading APIs from various Crypto Exchanges

Notifications You must be signed in to change notification settings

bethanyuo/trading-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Trading API Project

Consume trading APIs and get prices and orders from the orderbook from various exchanges like Bitstamp, Bitfinex, Coinbase and Kraken. An API is an “application program interface”, usually provided for external access through RESTful Web Services, JSON-RPC or other communication protocols. It basically provides access to a company’s data.

This example will use public data functions which Exchanges offer without having to register using their public APIs.

Requirements

  • Ubuntu 16.04.3
  • Python3

Source Code

TradingAPI

Commands

$ python3 TradingAPI.py

Exchange APIs

Get info from the Bitstamp ticker. Here we use last and with the response, it will give us the last BTC price but you can experiment with other values, for example, volume will give you Last 24 hours volume.

Using similar logic, let’s get last prices from other exchanges like Bitfinex, Coinbase and Kraken.

Get some info from the Bitstamp order book. The difference is that in this case, the API returns a JSON dictionary with "bids" and "asks". Each is a list of open orders and each order is represented as a list holding the price and the amount. Implement code that gets price and quantity for last bid and ask orders.

Print the information in the console and update it in every 3 seconds.

Module

MI2: Module 4: E2

Releases

No releases published

Packages

No packages published

Languages