-
Notifications
You must be signed in to change notification settings - Fork 0
/
BitmexApiCommand.js
212 lines (172 loc) · 4.91 KB
/
BitmexApiCommand.js
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//Bitmex GET /announcement
function BitmexAnnouncement() {
var res = Bitmex("/api/v1/announcement",{},"GET",1)
Logger.log(res)
return res
}
//Bitmex GET /announcement
function BitmexAnnouncementurgent() {
var res = Bitmex("/api/v1/announcement/urgent",{},"GET",2)
Logger.log(res)
return res
}
//Bitmex GET apikey
function BitmexApiKey() {
var res = Bitmex("/api/v1/apiKey",{},"GET",2)
Logger.log(res)
return res
}
//Bitmex Post apikey
function BitmexApiKeyPost() {
var res = Bitmex("/api/v1/apiKey",{},"GET",2)
Logger.log(res)
return res
}
//Bitmex Delete apikey
function BitmexApiKeyDelete(apikey) {
var res = Bitmex("/api/v1/apiKey",{"apiKeyID":apikey},"DELETE",3)
Logger.log(res)
return res
}
//Bitmex Delete apikey
function BitmexApiKeyDisable(apikey) {
var res = Bitmex("/api/v1/apiKey/disable",{"apiKeyID":apikey},"POST",3)
Logger.log(res)
return res
}
//GET /execution
function BitmexExecution() {
var res = Bitmex("/api/v1/execution",{},"GET",2)
Logger.log(res)
return res
}
//GET /execution/tradeHistory
function BitmexExecutionTradeHistory() {
var res = Bitmex("/api/v1/tradeHistory",{},"GET",2)
Logger.log(res)
return res
}
//GET /funding
function Bitmexfunding() {
var res = Bitmex("/api/v1/funding",{},"GET",2)
Logger.log(res)
return res
}
//GET /instrument
function Bitmexinstrument(pair) {
var res = Bitmex("/api/v1/instrument?symbol="+pair,{},"GET",2)
return res
}
//GET /instrument/active
function Bitmexinstrumentactive() {
var res = Bitmex("/api/v1/instrument/active",{},"GET",2)
Logger.log(res)
return res
}
//GET /instrument/activeAndIndices
function BitmexinstrumentactiveAndIndices() {
var res = Bitmex("/api/v1/instrument/activeAndIndices",{},"GET",2)
Logger.log(res)
return res
}
//GET /instrument/activeIntervals
function BitmexinstrumentactiveIntervals() {
var res = Bitmex("/api/v1/instrument/activeIntervals",{},"GET",2)
Logger.log(res)
return res
}
//GET /instrument/compositeIndex
function BitmexinstrumentcompositeIndex(symbol) {
var res = Bitmex("/api/v1/instrument/compositeIndex",'symbol='+symbol,"GET",0)
Logger.log(res)
return res
}
//GET /instrument/indices
function Bitmexinstrumentindices() {
var res = Bitmex("/api/v1/instrument/indices",{},"GET",2)
Logger.log(res)
return res
}
//GET /leaderboard
function Bitmexleaderboard(method) {
var res = Bitmex("/api/v1/leaderboard",'method='+method,"GET",0)
Logger.log(res)
return res
}
//GET /leaderboard/name
function Bitmexleaderboardname() {
var res = Bitmex("/api/v1/leaderboard/name",{},"GET",2)
Logger.log(res)
return res
}
///liquidation
function Bitmexliquidation() {
var res = Bitmex("/api/v1/liquidation","","GET",2)
Logger.log(res)
return res
}
//GET /order
function Bitmexorder() {
var res = Bitmex("/api/v1/order","","GET",2)
Logger.log(res)
return res
}
//PUT /order
function BitmexorderPut(orderid) {
var res = Bitmex("/api/v1/order",{"orderID":orderid},"PUT",3)
Logger.log(res)
return res
}
//PUT /order
function BitmexorderPost(symbol,side,orderQty,price,stopPx,ordType,execInst) {
if (ordType=="Market"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"orderQty":orderQty},"POST",3)
}
else if (ordType=="Limit"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"price":price,"orderQty":orderQty,"ordType":ordType},"POST",3)
}
else if (ordType=="Stop"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"stopPx":stopPx,"execInst":execInst,"orderQty":orderQty},"POST",3)
}
else if (ordType=="StopLimit"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"price":price,"orderQty":orderQty,"stopPx":stopPx,"execInst":execInst,"ordType":ordType},"POST",3)
}
else if (ordType=="MarketIfTouched"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"orderQty":orderQty,"stopPx":stopPx,"execInst":execInst,"ordType":ordType},"POST",3)
}
else if (ordType=="LimitIfTouched"){
var res = Bitmex("/api/v1/order",{"symbol":symbol,"side":side,"price":price,"orderQty":orderQty,"stopPx":stopPx,"execInst":execInst,"ordType":ordType},"POST",3)
}
Logger.log(res)
return res
}
//delete order
function BitmexorderDelete(orderid) {
var res = Bitmex("/api/v1/order",{"orderID":orderid},"DELETE",3)
Logger.log(res)
return res
}
//DELETE /order/all
function BitmexorderDeleteAll(orderid) {
var res = Bitmex("/api/v1/order/all",{},"DELETE",3)
Logger.log(res)
return res
}
//GET /orderBook/L2
function BitmexorderBookL2(symbol) {
var res = Bitmex("/api/v1/orderBook/L2","symbol="+symbol,"GET",0)
Logger.log(res)
return res
}
//GET /position
function BitmexpositionGet(symbol) {
var res = Bitmex("/api/v1/position","","GET",2)
Logger.log(res)
return res
}
//POST /position/isolate?
function BitmexPositionisolate(symbol) {
var res = Bitmex("/api/v1/position/isolate",{"symbol":symbol},"POST",3)
Logger.log(res)
return res
}