Coder Social home page Coder Social logo

cpmmbot.py's Introduction

Coinpit Market Maker Bot

This is sample market maker bot written for Coinpit with hedging.Feel free to modify it as per your need. (Please try this on testnet first)

  1. Coinpit testnet is at https://live.coinpit.me
  2. Bitmex testnet is at https://testnet.bitmex.com

Please make sure you have api key from Bitmex and Coinpit.

Coinpit API Key:

  1. Select 'MANAGE KEY' from top menu.
  2. Click 'API KEYS' from drop down.
  3. Click '+ API KEY' button.
  4. An API KEY file will be generated and downloaded.

Alt text

Bitmex API Key:

  1. Go to Account on top navigation
  2. Click on API Keys from left navigaiton
  3. select 'Order' from 'Key Permissions' and click 'Submit'.

Alt text

Python

Please note that this bot runs on python 3. You can find a very nice documentation here to run python 3 on vertual everonment.

for Ubuntu:

$> sudo apt-get install -y python3-venv
$> mkdir environments
$> cd environments
$> python3 -m venv my_env
$> source my_env/bin/activate
(my_env) sammy@sammy:-/environments$>

Download

build

In cpmmbot.py folder:

On linux/Mac/*nix

run ./build.sh

On Windows

run build.bat

Configuration:

setup.py file will be generated under cpmmbot.py-master or cpmmbot.py folder.

# bitmex api key. This is sample. change with your bitmex api key and secret
BITMEX_API_KEY = 'Ag-_DuBvWrO8IK-6FnGhldzR'
BITMEX_API_SECRET = '_Dss0iITNH5-4QlCNYxqXQ7kA2ngSmhKX4tlRBdn4mmsR3_A'

# coinpit api key. This is sample api key. copy api key content downloaded from coinpit.
COINPIT_API_KEY = {
    "name"         : "c274ee8154f6b7ae",
    "role"         : "trade",
    "apiPublicKey" : "c274ee8154f6b7ae26f83959ebe8a8408f4c8f26e4a2a67aa1183d67855b4923",
    "userid"       : "moVB8e8oWX1oKjaaesdimAGqJHxjih8kjU",
    "secretKey"    : "e41e7e05d72474d315835f9aaa611c4538b70cd9f0da3af8ca5348442c02a01ec274ee8154f6b7ae26f83959ebe8a8408f4c8f26e4a2a67aa1183d67855b4923",
    "authorization": "H035g/EV91qkp8R9SEXaEoCO/6HlNdvYXcBZWgfzmeDzbSIfbdQjq7XTbj/8AO1HbSdNOREC1abFQBehkKk1HiY=",
    "serverAddress": "n3kKyhxAU6n9MLWto9rew89dB5ghgZSbbr",
    "accountid"    : "2NGJqK6fXWfMMtJwWHdKT59WzqKDxFKagJp",
    "publicKey"    : "02d324e7149836c05b66ae4d51ac1a708afb0ab6b72839bcbda14d1f246fb04828"
}

# instrument used for coinpit
COINPIT_SYMBOL = 'BTCUSDW'

# insterest rate used. this will be added as offset from index price.
INTEREST_RATE = 0.06

# decimal paces supported by coinpit instrument
COINPIT_TICK_SIZE = 1

# market maker on coinpit will maintain number of contracts on buy and sell side
COINPIT_QTY = 100

# one contract at coinpit is equal to 100 contracts on bitmex
COINPIT_BITMEX_RATIO = 100

# spread from bitmex is calculated for quantity. quantity = COINPIT_QTY * COINPIT_BITMEX_RATIO * QUANTITY_MULTIPLIER
QUANTITY_MULTIPLIER = 5

# one buy and one sell order is placed 2% away from index to make sure that there is always some spread is avalable.
COINPIT_LATCH = 0.02

BITMEX_SYMBOL = 'XBTUSD'

# places a trailing stop order with peg. if this value is 0, a market order will be placed.
BITMEX_TRAILING_PEG = 10
# BITMEX_TRAILING_PEG = 0

HEDGE_INTERVAL = 2  # in seconds

Starting bot

run following command from

On linux/Mac/*nix

run start-bot.bat

On Windows

run ./start-bot.sh

cpmmbot.py's People

Contributors

nirmalgupta avatar

Watchers

James Cloos 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.