hyperquant 0.31__py3-none-any.whl → 0.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,7 +150,7 @@ class OurbitSwap:
150
150
  data["side"] = 4
151
151
  elif side == 'close_sell':
152
152
  data["side"] = 2
153
- data["type"] = 5
153
+
154
154
  if position_id is None:
155
155
  raise ValueError("position_id is required for closing position")
156
156
  data["positionId"] = position_id
@@ -160,6 +160,50 @@ class OurbitSwap:
160
160
  "POST", f"{self.api_url}/api/v1/private/order/create", data=data
161
161
  )
162
162
  return self.ret_content(res)
163
+
164
+ async def place_tpsl(self,
165
+ position_id: int,
166
+ take_profit: Optional[float] = None,
167
+ stop_loss: Optional[float] = None,
168
+ ):
169
+ """
170
+ position_id 持仓ID
171
+
172
+ .. code:: json
173
+
174
+ {
175
+ "success": true,
176
+ "code": 0,
177
+ "data": 2280508
178
+ }
179
+ """
180
+ if (take_profit is None) and (stop_loss is None):
181
+ raise ValueError("params err")
182
+
183
+ data = {
184
+ "positionId": position_id,
185
+ "profitTrend": "1",
186
+ "lossTrend": "1",
187
+ "profitLossVolType": "SAME",
188
+ "volType": 2,
189
+ "takeProfitReverse": 2,
190
+ "stopLossReverse": 2,
191
+ "priceProtect": "0",
192
+ }
193
+
194
+ if take_profit is not None:
195
+ data["takeProfitPrice"] = take_profit
196
+ if stop_loss is not None:
197
+ data["stopLossPrice"] = stop_loss
198
+
199
+
200
+ res = await self.client.fetch(
201
+ "POST",
202
+ f"{self.api_url}/api/v1/private/stoporder/place",
203
+ data=data
204
+ )
205
+
206
+ return self.ret_content(res)
163
207
 
164
208
  async def cancel_orders(self, order_ids: list[str]):
165
209
  res = await self.client.fetch(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.31
3
+ Version: 0.32
4
4
  Summary: A minimal yet hyper-efficient backtesting framework for quantitative trading
5
5
  Project-URL: Homepage, https://github.com/yourusername/hyperquant
6
6
  Project-URL: Issues, https://github.com/yourusername/hyperquant/issues
@@ -6,7 +6,7 @@ hyperquant/logkit.py,sha256=WALpXpIA3Ywr5DxKKK3k5EKubZ2h-ISGfc5dUReQUBQ,7795
6
6
  hyperquant/notikit.py,sha256=x5yAZ_tAvLQRXcRbcg-VabCaN45LUhvlTZnUqkIqfAA,3596
7
7
  hyperquant/broker/auth.py,sha256=hrdVuBTZwD3xSy5GI5JTFJhKiHhvIjZHA_7G5IUFznQ,1580
8
8
  hyperquant/broker/hyperliquid.py,sha256=7MxbI9OyIBcImDelPJu-8Nd53WXjxPB5TwE6gsjHbto,23252
9
- hyperquant/broker/ourbit.py,sha256=VE1eLvQ1hakOxWbXHmW8KXwYrP_Apsv0_FOPtmU3MKs,8033
9
+ hyperquant/broker/ourbit.py,sha256=sPNdKxRiIICGVOjCIu0-VbqA-qPZ_1UeIpoDRaL9G_Q,9119
10
10
  hyperquant/broker/ws.py,sha256=98Djt5n5sHUJKVbQ8Ql1t-G-Wiwu__4MYcUr5P6SDL0,326
11
11
  hyperquant/broker/lib/hpstore.py,sha256=LnLK2zmnwVvhEbLzYI-jz_SfYpO1Dv2u2cJaRAb84D8,8296
12
12
  hyperquant/broker/lib/hyper_types.py,sha256=HqjjzjUekldjEeVn6hxiWA8nevAViC2xHADOzDz9qyw,991
@@ -16,6 +16,6 @@ hyperquant/datavison/_util.py,sha256=92qk4vO856RqycO0YqEIHJlEg-W9XKapDVqAMxe6rbw
16
16
  hyperquant/datavison/binance.py,sha256=3yNKTqvt_vUQcxzeX4ocMsI5k6Q6gLZrvgXxAEad6Kc,5001
17
17
  hyperquant/datavison/coinglass.py,sha256=PEjdjISP9QUKD_xzXNzhJ9WFDTlkBrRQlVL-5pxD5mo,10482
18
18
  hyperquant/datavison/okx.py,sha256=yg8WrdQ7wgWHNAInIgsWPM47N3Wkfr253169IPAycAY,6898
19
- hyperquant-0.31.dist-info/METADATA,sha256=ZfMLDTVVmQdtj-qCg1kwN1fl1TJfRpzHki-6AoUnhEI,4317
20
- hyperquant-0.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
21
- hyperquant-0.31.dist-info/RECORD,,
19
+ hyperquant-0.32.dist-info/METADATA,sha256=n6ti0zu8vGbaBI2cGFAnqI7AlhHpTLnOGd2tRkRPZUU,4317
20
+ hyperquant-0.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
21
+ hyperquant-0.32.dist-info/RECORD,,