-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.py
executable file
·66 lines (56 loc) · 1.63 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
# API Token
API_TOKEN = ''
assert API_TOKEN, "'API_TOKEN' must be set."
# B2C2 URLS
B2C2_BASE_URL = 'https://sandboxapi.b2c2.net'
B2C2_INSTRUMENTS_URL = '/instruments/'
B2C2_REQUEST_FOR_QUOTE_URL = '/request_for_quote/'
B2C2_TRADE_URL = '/trade/'
B2C2_BALANCE_URL = '/balance/'
ERROR_CODES_TO_MEANING_MAPPING = {
400: "Bad Request - Incorrect parameters.",
401: "Unauthorized - Wrong Token.",
404: "Not Found - The specified endpoint could not be found.",
405: "Method Not Allowed - You tried to access an endpoint with an invalid method.",
406: "Not Acceptable - Incorrect request format.",
500: "Internal Server Error - We had a problem with our server. Try again later."
}
KNOWN_ERROR_CODES = ERROR_CODES_TO_MEANING_MAPPING.keys()
# API protocol keys
BUY_COMMAND = 'buy'
SELL_COMMAND = 'sell'
INSTRUMENT_KEY = 'instrument'
SIDE_KEY = 'side'
QUANTITY_KEY = 'quantity'
CLIENT_RFQ_ID_KEY = 'client_rfq_id'
PRICE_KEY = 'price'
RFQ_ID_KEY = 'rfq_id'
# Standard Python Logging Configuration
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "simple",
"stream": "ext://sys.stdout"
},
},
"loggers": {
"my_module": {
"level": "ERROR",
"handlers": ["console"],
"propagate": "no"
}
},
"root": {
"level": "INFO",
"handlers": ["console"]
}
}