forked from sammchardy/python-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_order.py
More file actions
39 lines (27 loc) · 786 Bytes
/
Copy pathcreate_order.py
File metadata and controls
39 lines (27 loc) · 786 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
35
36
37
38
39
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
from binance.client import Client
api_key = "" # your api_key here
secret = "" # your secret here
client = Client(api_key, secret, testnet=True)
# create futures order
def create_futures_order():
order = client.futures_create_order(
symbol="LTCUSDT",
side="BUY",
type="MARKET",
quantity=0.1,
positionSide="LONG", # BOTH for One-way Mode ; LONG or SHORT for Hedge Mode
)
print(order)
def create_spot_order():
order = client.create_order(
symbol="LTCUSDT", side="BUY", type="LIMIT", price=60, quantity=0.1
)
print(order)
def main():
create_futures_order()
create_spot_order()
main()