hyperquant 0.41__tar.gz → 0.42__tar.gz

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.
Files changed (32) hide show
  1. {hyperquant-0.41 → hyperquant-0.42}/PKG-INFO +1 -1
  2. {hyperquant-0.41 → hyperquant-0.42}/pyproject.toml +1 -1
  3. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/core.py +1 -0
  4. hyperquant-0.42/test.py +8 -0
  5. {hyperquant-0.41 → hyperquant-0.42}/tmp.py +8 -17
  6. {hyperquant-0.41 → hyperquant-0.42}/uv.lock +1 -1
  7. hyperquant-0.41/test.py +0 -120
  8. hyperquant-0.41/tmp2.py +0 -32
  9. {hyperquant-0.41 → hyperquant-0.42}/.gitignore +0 -0
  10. {hyperquant-0.41 → hyperquant-0.42}/.python-version +0 -0
  11. {hyperquant-0.41 → hyperquant-0.42}/README.md +0 -0
  12. {hyperquant-0.41 → hyperquant-0.42}/data/logs/notikit.log +0 -0
  13. {hyperquant-0.41 → hyperquant-0.42}/pub.sh +0 -0
  14. {hyperquant-0.41 → hyperquant-0.42}/requirements-dev.lock +0 -0
  15. {hyperquant-0.41 → hyperquant-0.42}/requirements.lock +0 -0
  16. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/__init__.py +0 -0
  17. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/auth.py +0 -0
  18. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/hyperliquid.py +0 -0
  19. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/lib/hpstore.py +0 -0
  20. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  21. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/models/hyperliquid.py +0 -0
  22. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/models/ourbit.py +0 -0
  23. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/ourbit.py +0 -0
  24. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/broker/ws.py +0 -0
  25. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/datavison/_util.py +0 -0
  26. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/datavison/binance.py +0 -0
  27. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/datavison/coinglass.py +0 -0
  28. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/datavison/okx.py +0 -0
  29. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/db.py +0 -0
  30. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/draw.py +0 -0
  31. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/logkit.py +0 -0
  32. {hyperquant-0.41 → hyperquant-0.42}/src/hyperquant/notikit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.41
3
+ Version: 0.42
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.41"
3
+ version = "0.42"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -343,6 +343,7 @@ class Exchange(ExchangeBase):
343
343
 
344
344
  if kwargs:
345
345
  self.opt.update(kwargs)
346
+ self.account[symbol].update(kwargs)
346
347
 
347
348
  # 记录账户总资产到 history
348
349
  if self.recorded:
@@ -0,0 +1,8 @@
1
+ from hyperquant.core import Exchange
2
+
3
+
4
+ e = Exchange([], fee=0)
5
+
6
+ e.Buy('btc', 100, 1, ts=1234)
7
+
8
+ print(e['btc'])
@@ -83,21 +83,12 @@ async def main():
83
83
  # print(f'排序耗时: {time.time()*1000 - ts:.2f} ms')
84
84
 
85
85
  async def test_watch_order():
86
- store = OurbitSpotDataStore()
87
86
 
88
- filled_orders = {}
89
-
90
- async def loop_orders():
91
- with ob_spot.store.orders.watch() as stream:
92
- async for change in stream:
93
- if change.operation == 'delete':
94
- if change.data['state'] == 'filled':
95
- filled_orders[change.data['order_id']] = change.data
96
87
 
97
88
  async def watch_orders(ob_spot: OurbitSpot):
98
89
  with ob_spot.store.orders.watch() as stream:
99
90
  async for change in stream:
100
- print(change)
91
+
101
92
  data = change.data
102
93
  if change.operation == 'delete':
103
94
  state = data['state']
@@ -116,13 +107,13 @@ async def test_watch_order():
116
107
  ob_spot = OurbitSpot(client)
117
108
  await ob_spot.__aenter__()
118
109
  await ob_spot.sub_personal()
119
- # await watch_orders(ob_spot)
110
+ await watch_orders(ob_spot)
120
111
 
121
- with ob_spot.store.orders.watch() as stream:
122
- oid = await ob_spot.place_order('SOL_USDT', 'buy', order_type='market', price=205, quantity=0.03 )
123
- print(oid)
124
- async for change in stream:
125
- print(change)
112
+ # with ob_spot.store.orders.watch() as stream:
113
+ # oid = await ob_spot.place_order('SOL_USDT', 'buy', order_type='market', price=205, quantity=0.03 )
114
+ # print(oid)
115
+ # async for change in stream:
116
+ # print(change)
126
117
 
127
118
 
128
119
  # await asyncio.sleep(1)
@@ -145,4 +136,4 @@ async def test_cancel_order():
145
136
  await ob_spot.cancel_orders([oid])
146
137
 
147
138
  if __name__ == "__main__":
148
- asyncio.run(test_cancel_order())
139
+ asyncio.run(test_watch_order())
@@ -530,7 +530,7 @@ wheels = [
530
530
 
531
531
  [[package]]
532
532
  name = "hyperquant"
533
- version = "0.4"
533
+ version = "0.41"
534
534
  source = { editable = "." }
535
535
  dependencies = [
536
536
  { name = "aiohttp" },
hyperquant-0.41/test.py DELETED
@@ -1,120 +0,0 @@
1
- # import asyncio
2
- # import hyperquant
3
- # from hyperquant.broker.models.ourbit import OurbitSwapDataStore
4
- # import pybotters
5
-
6
- # async def test():
7
- # store = OurbitSwapDataStore()
8
- # async with pybotters.Client(
9
- # apis={
10
- # "ourbit": [
11
- # "WEB3bf088f8b2f2fae07592fe1a6240e2d798100a9cb2a91f8fda1056b6865ab3ee"
12
- # ]
13
- # }
14
- # ) as client:
15
- # await store.initialize( client.get( "https://futures.ourbit.com/api/v1/private/position/open_positions") )
16
- # print(store.position.find())
17
-
18
- # if __name__ == "__main__":
19
- # asyncio.run(test())
20
-
21
- import asyncio
22
- from hyperquant.broker.ourbit import OurbitSwap
23
- import pybotters
24
- import hyperquant
25
-
26
- async def test():
27
- async with pybotters.Client(
28
- apis={
29
- "ourbit": [
30
- "WEB3bf088f8b2f2fae07592fe1a6240e2d798100a9cb2a91f8fda1056b6865ab3ee"
31
- ]
32
- }
33
- ) as client:
34
- ourbit = OurbitSwap(client)
35
- await ourbit.__aenter__()
36
- res = await ourbit.place_order(
37
- symbol="SOL_USDT",
38
- size=1,
39
- side="buy",
40
- order_type="limit_GTC",
41
- price=192
42
- )
43
- print(res)
44
-
45
-
46
- # # await ourbit.update('orders')
47
- # await ourbit.sub_personal()
48
-
49
- # while True:
50
- # await ourbit.store.position.wait()
51
- # print(ourbit.store.position.find())
52
- # # await ourbit.store.position.wait()
53
- # # print(ourbit.store.position.find())
54
- # await ourbit.store.orders.wait()
55
-
56
- # with ourbit.store.orders.watch() as changes:
57
- # async for change in changes:
58
- # print(change.operation, change.data)
59
-
60
-
61
- # print(res.data)
62
-
63
- # print(ourbit.datastore.detail.find({"symbol": "SOL_USDT"}))
64
-
65
- # print(ourbit.datastore.detail.find())
66
-
67
- # await ourbit.update('balance')
68
- # print(ourbit.store.balance.find())
69
-
70
- # res = await client.fetch(
71
- # 'GET',
72
- # 'https://futures.ourbit.com//api/v1/private/order/list/history_orders?category=1&page_num=1&page_size=4&start_time=1755682343814&states=4&symbol=SOL_USDT'
73
- # )
74
-
75
- # print(res.data)
76
-
77
- # print(await ourbit.query_order('219079365441409152'))
78
-
79
- # await ourbit.place_order(
80
- # symbol="SOL_USDT",
81
- # side="sell",
82
- # order_type="market",
83
- # usdt_amount=3,
84
- # price=206.44
85
- # )
86
-
87
- # print(ourbit.datastore.orders.find())
88
-
89
- # await ourbit.cancel_orders(['219206341921656960'])
90
-
91
-
92
- # print(ourbit.datastore.orders.find())
93
-
94
- # ps = ourbit.datastore.position.find({
95
- # "symbol": "SOL_USDT",
96
- # "side": "long"
97
- # })[0]
98
-
99
- # position_id = ps.get("position_id")
100
-
101
- # await ourbit.place_order(
102
- # symbol="SOL_USDT",
103
- # size=1,
104
- # side="close",
105
- # order_type="market",
106
- # position_id=position_id
107
- # )
108
-
109
- # await ourbit.sub_order_book("SOL_USDT")
110
-
111
- # while True:
112
- # await ourbit.store.book.wait()
113
- # asks = ourbit.store.book.find({'side': 'A'})
114
- # bids = ourbit.store.book.find({'side': 'B'})
115
- # print("Ask0:", asks[0]['px'])
116
- # print("Bid0:", bids[0]['px'])
117
- # print('-----\n')
118
-
119
- if __name__ == "__main__":
120
- asyncio.run(test())
hyperquant-0.41/tmp2.py DELETED
@@ -1,32 +0,0 @@
1
- import asyncio
2
- from pybotters.store import DataStore
3
-
4
- store = DataStore(keys=['oid'])
5
-
6
- async def place():
7
- # 模拟服务器返回
8
- store._insert([{'oid': 1}])
9
- # store._delete([{'oid': 1}])
10
- store._find_and_delete({'oid':1})
11
- await asyncio.sleep(0.1)
12
- return
13
-
14
- async def loop_orders():
15
- with store.watch() as stream:
16
- async for change in stream:
17
- print('loop_orders', change)
18
-
19
- async def main():
20
- asyncio.create_task(loop_orders())
21
-
22
-
23
- with store.watch() as stream:
24
- await place()
25
- print('下单完成')
26
- async for change in stream:
27
- print(change)
28
-
29
- if __name__ == "__main__":
30
- asyncio.run(main())
31
-
32
-
File without changes
File without changes
File without changes
File without changes
File without changes