-
Notifications
You must be signed in to change notification settings - Fork 4
/
settings.py
123 lines (94 loc) · 4.95 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
from os.path import join
import logging
########################################################################################################################
# Connection/Auth
########################################################################################################################
# API URL.
BASE_URL = "https://testnet.bitmex.com/api/v1/"
# BASE_URL = "https://www.bitmex.com/api/v1/" # Once you're ready, uncomment this.
# The BitMEX API requires permanent API keys. Go to https://testnet.bitmex.com/app/apiKeys to fill these out.
API_KEY = ""
API_SECRET = ""
########################################################################################################################
# Target
########################################################################################################################
# Instrument to market make on BitMEX.
SYMBOL = "XBTUSD"
########################################################################################################################
# Order Size & Spread
########################################################################################################################
# How many pairs of buy/sell orders to keep open
ORDER_PAIRS = 6
# ORDER_START_SIZE will be the number of contracts submitted on level 1
# Number of contracts from level 1 to ORDER_PAIRS - 1 will follow the function
# [ORDER_START_SIZE + ORDER_STEP_SIZE (Level -1)]
ORDER_START_SIZE = 100
ORDER_STEP_SIZE = 100
# Distance between successive orders, as a percentage (example: 0.005 for 0.5%)
INTERVAL = 0.005
# Minimum spread to maintain, in percent, between asks & bids
MIN_SPREAD = 0.01
# If True, market-maker will place orders just inside the existing spread and work the interval % outwards,
# rather than starting in the middle and killing potentially profitable spreads.
MAINTAIN_SPREADS = True
# This number defines far much the price of an existing order can be from a desired order before it is amended.
# This is useful for avoiding unnecessary calls and maintaining your ratelimits.
#
# Further information:
# Each order is designed to be (INTERVAL*n)% away from the spread.
# If the spread changes and the order has moved outside its bound defined as
# abs((desired_order['price'] / order['price']) - 1) > settings.RELIST_INTERVAL)
# it will be resubmitted.
#
# 0.01 == 1%
RELIST_INTERVAL = 0.01
########################################################################################################################
# Trading Behavior
########################################################################################################################
# Position limits - set to True to activate. Values are in contracts.
# If you exceed a position limit, the bot will log and stop quoting that side.
CHECK_POSITION_LIMITS = False
MIN_POSITION = -10000
MAX_POSITION = 10000
# If True, will only send orders that rest in the book (ExecInst: ParticipateDoNotInitiate).
# Use to guarantee a maker rebate.
# However -- orders that would have matched immediately will instead cancel, and you may end up with
# unexpected delta. Be careful.
POST_ONLY = True
########################################################################################################################
# Misc Behavior, Technicals
########################################################################################################################
# If true, don't set up any orders, just say what we would do
# DRY_RUN = True
DRY_RUN = False
# How often to re-check and replace orders.
# Generally, it's safe to make this short because we're fetching from websockets. But if too many
# order amend/replaces are done, you may hit a ratelimit. If so, email BitMEX if you feel you need a higher limit.
LOOP_INTERVAL = 5
# Wait times between orders / errors
API_REST_INTERVAL = 1
API_ERROR_INTERVAL = 10
TIMEOUT = 7
# If we're doing a dry run, use these numbers for BTC balances
DRY_BTC = 50
# Available levels: logging.(DEBUG|INFO|WARN|ERROR)
LOG_LEVEL = logging.INFO
# To uniquely identify orders placed by this bot, the bot sends a ClOrdID (Client order ID) that is attached
# to each order so its source can be identified. This keeps the market maker from cancelling orders that are
# manually placed, or orders placed by another bot.
#
# If you are running multiple bots on the same symbol, give them unique ORDERID_PREFIXes - otherwise they will
# cancel each others' orders.
# Max length is 13 characters.
ORDERID_PREFIX = "mm_bitmex_"
# If any of these files (and this file) changes, reload the bot.
WATCHED_FILES = [
join("market_maker", "market_maker.py"),
join("market_maker", "bitmex.py"),
"settings.py",
]
########################################################################################################################
# BitMEX Portfolio
########################################################################################################################
# Specify the contracts that you hold. These will be used in portfolio calculations.
CONTRACTS = ["XBTUSD"]