-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidators.py
More file actions
34 lines (20 loc) · 735 Bytes
/
Copy pathvalidators.py
File metadata and controls
34 lines (20 loc) · 735 Bytes
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
def validate_side(side):
side = side.upper()
if side not in ["BUY", "SELL"]:
raise ValueError("Side must be BUY or SELL")
return side
def validate_order_type(order_type):
order_type = order_type.upper()
if order_type not in ["MARKET", "LIMIT"]:
raise ValueError("Order Type must be MARKET or LIMIT")
return order_type
def validate_quantity(quantity):
quantity = float(quantity)
if quantity <= 0:
raise ValueError("Quantity must be greater than 0")
return quantity
def validate_symbol(symbol):
symbol = symbol.upper()
if not symbol.endswith("USDT"):
raise ValueError("Symbol must end with USDT")
return symbol