This is an implementation of an Order Execution and Management System which functions on WebSocket and is built on C++.
- Generate Credentials: Create an account on https://test.deribit.com/ and generate your API credentials -
client_idandclient_secret. - Clone this repository
git clone https://github.com/ppl-call-me-tima/deribit.git cd deribit - Install the websocketpp library and its dependencies
sudo apt update sudo apt install libwebsocketpp-dev sudo apt install libssl-dev sudo apt install libboost-all-dev
- Install the nlohmann/json library.
sudo apt install nlohmann-json3-dev
- Run the Makefile and upon completion, run the executable.
make ./main
- show: Shows the metdata for the WebSocket connection along with incoming/outgoing messages along with the error logs if any.
- auth: Authenticates user which is required for private methods of the API.
Parameters:client_id,client_secret - buy: Executes a buy request of a particular instrument, amount, type along with a label.
Parameters:instrument_name,amount,type,label - sell: Executes a sell request of a particular instrument, amount, type along with a label.
Parameters:instrument_name,amount,type,label - cancel: Cancels an order with a particular order ID.
Parameters:order_id - cancel all: Cancels all the currnet open orders.
- edit: Edits the amount or price for a current opened order with a particular order ID.
Placeholders:order_id,amount,price - orders: Shows the information of all the current opened orders.
- orderbook: Shows the orderbook for a particular instrument upto a specified depth.
Parameters:instrument_name,depth - positions: Shows the current position of the user for a particular currency.
Parameters:currency - subscribe: Subscribes to a particular instrument channel.
Parameters:channel,interval - unsubscribe: Unsubsribe from a particular instrument channel.
Paramters:channel,interval - tgl: Toggles the continuous incoming of responses of the subscribed channel.
- quit: Close the WebSocket connection.