Skip to content

kulsuri/B2C2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

b2c2 trading bot

Command line interface to interact and trade with the B2C2 api

Screenshot

alt text

Demo

screengrab

What Does This App Do?

  1. command line interface
  2. request instruments available to trade
  3. request prices from api for given instrument
  • e.g. BTCUSD
  • side (buy/sell)
  • quantity
  1. execute orders
  2. display total balance of the account
  3. ping to check if the connection is ok
  4. ledgers to get trade history
  5. get specific information about a trade
  6. error handling:
  • sending an outdated quote
  • HTTP error from the server
  • losing internet connection
  1. logging

Pre-requisites

  • Python 3
  • Pip
  • Git
  • B2C2 sandbox API token
  • Whitelist client machine IP address

Installation Instructions

  1. Open command prompt (windows) or terminal (mac/linux)
  2. Navigate to a path for which to host project files e.g
cd C:\project
  1. Clone repo
git clone https://github.com/kulsuri/B2C2
  1. Navigate to the project folder e.g.
cd C:\project\B2C2
  1. Install required modules
pip install -r requirements.txt 

Run the App

Navigate to the project folder and run the command:

python app.py

Using the App (Commands)

  1. View tradable instruments
python app.py view-instruments
  1. Request a quote
python app.py request-for-quote
ENTER INSTRUMENT NAME e.g. BTCUSD
> ethgbp
ENTER THE SIDE OF THE TRADE (buy, sell):
> buy
ENTER QUANTITY
> 2.345
  1. Execute a quote (order)
EXECUTE THIS QUOTE? (Y/n)
> Y
  1. View trade history
python app.py trade-history
  1. View ledger
python app.py view-ledger
  1. View balance
python app.py view-balance
  1. Check the connection status
python app.py connection-status

Technologies (modules)

  • requests
  • click
  • uuid
  • datetime

How Does It Work?

File Technology What Does It Do
app.py click runs the app, handles the CLI and calls objects from the other files
library.py requests library of functions for interacting with the B2C2 API

Bugs and Issues

❌ TBC

❌ TBC

Feature Requests and Improvements

🔲 Interactive and dynamic front-end built with React

🔲 Improved error handling

🔲 Improved logging

About

Command line interface to interact and trade with the B2C2 api

Resources

Stars

Watchers

Forks

Languages