Giter VIP home page Giter VIP logo

deribit_websocket_v2's Introduction

Deribit Websocket API v2

This is a python wrapper written to make it simple to connect to Deribit's JSON-RPC api v2 using websockets.

Table of Contents

  1. Installation
  2. Credentials
  3. Index Price
  4. Ticker Data
  5. Buy
  6. Sell
  7. Stop Buy
  8. Stop Sell
  9. Edit
  10. Cancel
  11. Cancel All
  12. Account Summary
  13. Get Position
mkdir deribit_ws && cd deribit_ws

git clone https://github.com/Jimmy-sha256/deribit_ws.git

virtualenv --python=/usr/bin/python3.7 venv

source /venv/bin/activate

pip install -r requirements.txt

Add your deribit api access key and access secret to the credentials.py file:

Add either main-net or test-net websocket url to credentials.py file:

  • wss://testapp.deribit.com/ws/api/v2
  • wss://deribit.com/ws/api/v2

index(currency)
Paramaters Type Description
currency string 'BTC', 'ETH'

https://docs.deribit.com/v2/#public-get_index

ticker(instrument_name)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'

https://docs.deribit.com/v2/#public-ticker

buy(instrument_name, amont, order_type, price, post_only)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'
amount int number of contracts to purchase
order_type string 'market', 'limit'
price int price to purchase contracts at
post_only boolean True / False

https://docs.deribit.com/v2/#private-buy

sell(instrument_name, amont, order_type, price, post_only)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'
amount int number of contracts to purchase
order_type string 'market', 'limit'
price int price to purchase contracts at
post_only boolean True / False

https://docs.deribit.com/v2/#private-sell

stop_buy(instrument_name, trigger, amont, order_type, stop_price, price)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'
trigger string 'index_price', 'mark_price', 'last_price'
amount int number of contracts to purchase
order_type string 'stop_market', 'stop_limit'
stop_price int price at which order is triggered
price int price to purchase contracts at

https://docs.deribit.com/v2/#private-buy

stop_sell(instrument_name, trigger, amont, order_type, stop_price, price)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'
trigger string 'index_price', 'mark_price', 'last_price'
amount int number of contracts to purchase
order_type string 'stop_market', 'stop_limit'
stop_price int price at which order is triggered
price int price to purchase contracts at

https://docs.deribit.com/v2/#private-sell

edit(order_id, amount, price)

Paramaters Type Description
order_id string id of order '3032588463'
amount int edit number of contracts
price int edit price of contracts

https://docs.deribit.com/v2/#private-edit

cancel(order_id)

Paramaters Type Description
order_id string id of order to be canceled '3032588463'

https://docs.deribit.com/v2/#private-cancel

cancel_all()

This method takes no parameters

https://docs.deribit.com/v2/#private-cancel_all

account_summary(currency)

Paramaters Type Description
currency string 'BTC', 'ETH'

https://docs.deribit.com/v2/#private-get_account_summary

get_position(currency)

Paramaters Type Description
instrument_name string 'BTC-PERPETUAL', 'ETH-PERPETUAL'

https://docs.deribit.com/v2/#private-get_position

deribit_websocket_v2's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.