-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
53 lines (36 loc) · 1.67 KB
/
test.py
File metadata and controls
53 lines (36 loc) · 1.67 KB
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
# ------------------------------------------------------------
# market data
# from utils.market_data import MarketDataStream
# stream = MarketDataStream()
# stream.start() # This will run forever until stopped
# ------------------------------------------------------------
# account info - ALSO CHECK NOTEBOOK
# from utils.account_info import AccountInfo
# account = AccountInfo()
# # print(account.get_position("NVDA"))
# print(account.get_positions())
# ------------------------------------------------------------
# order book stream
# from utils.order_book import OrderBook
# from utils.market_data import MarketDataStream
# # Create order book for BTC/USD
# order_book = OrderBook(symbol="BTC/USD", max_levels=10, trim_frequency=10)
# # Create market data stream and pass the order book
# stream = MarketDataStream(order_book=order_book, verbose=True)
# # Start streaming (this will update the order book automatically)
# stream.start()
# ------------------------------------------------------------
# order manager
# from order_manager import OrderManager
# order_manager = OrderManager()
# order_manager.buy(symbol="BTC/USD", limit_price=100000, quantity=0.01)
# ------------------------------------------------------------
# order book SECOND
from utils.order_book import OrderBook
from utils.market_data_second import MarketDataStreamSecond
# Create order book for BTC/USD
order_book = OrderBook(symbol="BTC/USD", max_levels=10, trim_frequency=10, full=True)
# Create market data stream and pass the order book
stream = MarketDataStreamSecond(order_book=order_book, verbose=True, record_orderbook=True)
# Start streaming (this will update the order book automatically)
stream.start()