-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitget_api.py
81 lines (57 loc) · 2.77 KB
/
bitget_api.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
import bitget.spot.public_api as public
import bitget.spot.market_api as market
import bitget.spot.account_api as account
import bitget.spot.order_api as order
import json
if __name__ == '__main__':
api_key = ""
secret_key = ""
passphrase = "" # Password
symbol = 'BTCUSDT_SPBL'
# spot Get currency information
# publicApi = public.PublicApi(api_key, secret_key, passphrase, use_server_time=True, first=False);
# result = publicApi.currencies()
# print(result)
# acquisto 10 USDT di BTC
orderApi = order.OrderApi(api_key, secret_key, passphrase, use_server_time=False, first=False)
result = orderApi.orders(symbol=symbol, price='23850', quantity='0.001', side='buy', orderType='limit',
force='normal')
print(result)
# spot Obtain transaction pair information
# result = publicApi.products()
# print(result)
# spot Get single transaction pair information
# result = publicApi.product('btcusdt_spbl')
# print(result)
# marketApi = market.MarketApi(api_key, secret_key, passphrase, use_server_time=False, first=False);
# result = marketApi.fills(symbol, limit=50)
# print(result)
# result = marketApi.depth(symbol, limit=50, type='step0')
# print(result)
# result = marketApi.ticker(symbol)
# print(result)
# result = marketApi.tickers()
# print(result)
# result = marketApi.candles(symbol, period='1min', after='1624352586', before='1624356186', limit=100)
# print(result)
# accountApi = account.AccountApi(api_key, secret_key, passphrase, use_server_time=False, first=False)
# result = accountApi.assets()
# print(result)
# result = accountApi.bills()
# print(result)
#orderApi = order.OrderApi(api_key, secret_key, passphrase, use_server_time=False, first=False)
# result = orderApi.orders(symbol='bftusdt_spbl', price='2.30222', quantity='1', side='buy', orderType='limit', force='normal', clientOrderId='spot#29028939ss')
# print(result)
#order_data=[{"price":"2.30222","quantity":"1","side":"buy","orderType":"limit","force":"normal","client_oid":"spot#jidhuu19399"}, {"price":"2.30111","quantity":"1","side":"buy","orderType":"limit","force":"normal","client_oid":"spot#akncnai8821"}]
#result = orderApi.batch_orders(symbol='bftusdt_spbl', order_data=order_data)
#print(result)
# result = orderApi.cancel_orders(symbol='bftusdt_spbl', orderId='791171749756964864')
# print(result)
# result = orderApi.cancel_batch_orders(symbol='bftusdt_spbl', orderId=[''])
# print(result)
# result = orderApi.open_order(symbol='bftusdt_spbl')
# print(result)
# result = orderApi.history(symbol='bftusdt_spbl')
# print(result)
# result = orderApi.fills(symbol='bftusdt_spbl')
# print(result)